From 25481c5e851d8a509f5013914f8e2ce2b2c51a28 Mon Sep 17 00:00:00 2001 From: Matteo Pacini Date: Mon, 10 Nov 2025 23:45:18 +0000 Subject: [PATCH 1/2] opensupaplex: modernize --- pkgs/by-name/op/opensupaplex/package.nix | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/pkgs/by-name/op/opensupaplex/package.nix b/pkgs/by-name/op/opensupaplex/package.nix index b1cbe51469f0..9181bd82045f 100644 --- a/pkgs/by-name/op/opensupaplex/package.nix +++ b/pkgs/by-name/op/opensupaplex/package.nix @@ -18,15 +18,15 @@ let sha256 = "sha256-nKeSBUGjSulbEP7xxc6smsfCRjyc/xsLykH0o3Rq5wo="; }; in -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "opensupaplex"; version = "7.1.2"; src = fetchFromGitHub { owner = "sergiou87"; repo = "open-supaplex"; - rev = "v${version}"; - sha256 = "sha256-hP8dJlLXE5J/oxPhRkrrBl1Y5e9MYbJKi8OApFM3+GU="; + tag = "v${finalAttrs.version}"; + hash = "sha256-hP8dJlLXE5J/oxPhRkrrBl1Y5e9MYbJKi8OApFM3+GU="; }; nativeBuildInputs = [ @@ -66,18 +66,17 @@ stdenv.mkDerivation rec { passthru.tests.version = testers.testVersion { package = opensupaplex; command = "opensupaplex --help"; - version = "v${version}"; + version = "v${finalAttrs.version}"; }; desktopItems = [ (makeDesktopItem { name = "opensupaplex"; - exec = meta.mainProgram; + exec = finalAttrs.meta.mainProgram; icon = "open-supaplex"; desktopName = "OpenSupaplex"; - comment = meta.description; + comment = finalAttrs.meta.description; categories = [ - "Application" "Game" ]; }) @@ -86,10 +85,10 @@ stdenv.mkDerivation rec { 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${version}.txt"; + 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. mainProgram = "opensupaplex"; }; -} +}) From f8960b06c25d07d0f3b0e5ef91b7e91e0c231246 Mon Sep 17 00:00:00 2001 From: Matteo Pacini Date: Mon, 10 Nov 2025 23:46:10 +0000 Subject: [PATCH 2/2] opensupaplex: darwin support --- pkgs/by-name/op/opensupaplex/darwin.patch | 16 ++++++++++++++++ pkgs/by-name/op/opensupaplex/package.nix | 15 ++++++++++++++- .../op/opensupaplex/reproducible-build.patch | 17 +++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/op/opensupaplex/darwin.patch create mode 100644 pkgs/by-name/op/opensupaplex/reproducible-build.patch diff --git a/pkgs/by-name/op/opensupaplex/darwin.patch b/pkgs/by-name/op/opensupaplex/darwin.patch new file mode 100644 index 000000000000..7db9432f7302 --- /dev/null +++ b/pkgs/by-name/op/opensupaplex/darwin.patch @@ -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 +-#if TARGET_OS_MAC +-#include +-#else + #include +-#endif + #elif HAVE_SDL + #include + #include diff --git a/pkgs/by-name/op/opensupaplex/package.nix b/pkgs/by-name/op/opensupaplex/package.nix index 9181bd82045f..cb95343bec73 100644 --- a/pkgs/by-name/op/opensupaplex/package.nix +++ b/pkgs/by-name/op/opensupaplex/package.nix @@ -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"; }; }) diff --git a/pkgs/by-name/op/opensupaplex/reproducible-build.patch b/pkgs/by-name/op/opensupaplex/reproducible-build.patch new file mode 100644 index 000000000000..3c2a14917064 --- /dev/null +++ b/pkgs/by-name/op/opensupaplex/reproducible-build.patch @@ -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) +