opensupaplex: darwin support

This commit is contained in:
Matteo Pacini
2025-11-10 23:46:10 +00:00
parent 25481c5e85
commit f8960b06c2
3 changed files with 47 additions and 1 deletions

View File

@@ -0,0 +1,16 @@
diff --git a/src/sdl_common/audio.c b/src/sdl_common/audio.c
index 797c678..ebb9eda 100644
--- a/src/sdl_common/audio.c
+++ b/src/sdl_common/audio.c
@@ -25,11 +25,7 @@
#if HAVE_SDL2
#include <SDL2/SDL.h>
-#if TARGET_OS_MAC
-#include <SDL2_mixer/SDL_mixer.h>
-#else
#include <SDL2/SDL_mixer.h>
-#endif
#elif HAVE_SDL
#include <SDL/SDL.h>
#include <SDL/SDL_mixer.h>

View File

@@ -9,6 +9,7 @@
opensupaplex,
SDL2,
SDL2_mixer,
desktopToDarwinBundle,
}:
let
@@ -29,10 +30,19 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-hP8dJlLXE5J/oxPhRkrrBl1Y5e9MYbJKi8OApFM3+GU=";
};
patches = [
./reproducible-build.patch
./darwin.patch
];
nativeBuildInputs = [
SDL2 # For "sdl2-config"
copyDesktopItems
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
desktopToDarwinBundle
];
buildInputs = [ SDL2_mixer ];
enableParallelBuilding = true;
@@ -82,13 +92,16 @@ stdenv.mkDerivation (finalAttrs: {
})
];
# Strip only the main binary, not the data files which would corrupt them.
stripExclude = [ "lib/opensupaplex/*" ];
meta = {
description = "Decompilation of Supaplex in C and SDL";
homepage = "https://github.com/sergiou87/open-supaplex";
changelog = "https://github.com/sergiou87/open-supaplex/blob/master/changelog/v${finalAttrs.version}.txt";
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ matteopacini ];
platforms = lib.platforms.linux; # Many more are supported upstream, but only linux is tested.
platforms = lib.platforms.linux ++ lib.platforms.darwin;
mainProgram = "opensupaplex";
};
})

View File

@@ -0,0 +1,17 @@
diff --git a/linux/Makefile b/linux/Makefile
index 6041a89..588341c 100644
--- a/linux/Makefile
+++ b/linux/Makefile
@@ -5,6 +5,12 @@ LDFLAGS += -lSDL2_mixer -lvorbis -logg `sdl2-config --libs` -lm
CFLAGS += `sdl2-config --cflags` -DHAVE_SDL2
+UNAME_S := $(shell uname -s)
+ifeq ($(UNAME_S),Darwin)
+# Darwin-specific reproducible build flags
+LDFLAGS += -Wl,-no_uuid
+endif
+
opensupaplex: $(obj)
$(CC) -o $@ $^ $(LDFLAGS)