opensupaplex: modernize, darwin support (#460505)
This commit is contained in:
@@ -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>
|
||||
@@ -9,6 +9,7 @@
|
||||
opensupaplex,
|
||||
SDL2,
|
||||
SDL2_mixer,
|
||||
desktopToDarwinBundle,
|
||||
}:
|
||||
|
||||
let
|
||||
@@ -18,21 +19,30 @@ 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=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./reproducible-build.patch
|
||||
./darwin.patch
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
SDL2 # For "sdl2-config"
|
||||
copyDesktopItems
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
desktopToDarwinBundle
|
||||
];
|
||||
|
||||
buildInputs = [ SDL2_mixer ];
|
||||
|
||||
enableParallelBuilding = true;
|
||||
@@ -66,30 +76,32 @@ 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"
|
||||
];
|
||||
})
|
||||
];
|
||||
|
||||
# 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${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.
|
||||
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
||||
mainProgram = "opensupaplex";
|
||||
};
|
||||
}
|
||||
})
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user