about summary refs log tree commit diff
path: root/pkgs/games
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2024-06-13 14:23:55 +0200
committerGitHub <noreply@github.com>2024-06-13 14:23:55 +0200
commit01ce9b7556319334eb26ebf0b10b2461fb6e54e7 (patch)
treef1ff39e1ddab8de5f7348362dde45778128a0fd1 /pkgs/games
parentc9b3406603b62db1df60dc28d18a69ce41749729 (diff)
parentfc7e5a2b819fdd34beda637cbe6ca29c262bb9f1 (diff)
Merge pull request #318047 from matteo-pacini/julius
Diffstat (limited to 'pkgs/games')
-rw-r--r--pkgs/games/julius/darwin-fixes.patch49
-rw-r--r--pkgs/games/julius/default.nix37
2 files changed, 81 insertions, 5 deletions
diff --git a/pkgs/games/julius/darwin-fixes.patch b/pkgs/games/julius/darwin-fixes.patch
new file mode 100644
index 0000000000000..b4dfee59659b7
--- /dev/null
+++ b/pkgs/games/julius/darwin-fixes.patch
@@ -0,0 +1,49 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 038a34ba..d46b9258 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -669,16 +669,14 @@ endif()
+ if(APPLE)
+     # generating a macOS icns file (see https://stackoverflow.com/a/20703594)
+     add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/res/julius.icns
+-        COMMAND mkdir -p julius.iconset
+-        COMMAND sips -z 16 16    julius_256.png --out julius.iconset/icon_16x16.png
+-        COMMAND sips -z 32 32    julius_256.png --out julius.iconset/icon_16x16@2x.png
+-        COMMAND sips -z 32 32    julius_256.png --out julius.iconset/icon_32x32.png
+-        COMMAND sips -z 64 64    julius_256.png --out julius.iconset/icon_32x32@2x.png
+-        COMMAND sips -z 128 128  julius_256.png --out julius.iconset/icon_128x128.png
+-        COMMAND sips -z 256 256  julius_256.png --out julius.iconset/icon_128x128@2x.png
+-        COMMAND sips -z 256 256  julius_256.png --out julius.iconset/icon_256x256.png
+-        COMMAND sips -z 512 512  julius_512.png --out julius.iconset/icon_256x256@2x.png
+-        COMMAND iconutil -c icns julius.iconset
++        COMMAND mkdir julius.iconset
++        COMMAND convert julius_256.png -resize 16x16 julius.iconset/icon_16.png
++        COMMAND convert julius_256.png -resize 32x32 julius.iconset/icon_32.png
++        COMMAND convert julius_256.png -resize 64x64 julius.iconset/icon_64.png
++        COMMAND convert julius_256.png -resize 128x128 julius.iconset/icon_128.png
++        COMMAND cp julius_256.png julius.iconset/icon_256.png
++        COMMAND cp julius_512.png julius.iconset/icon_512.png
++        COMMAND png2icns julius.icns julius.iconset/icon_{16,32,64,128,256,512}.png
+         COMMAND rm -R julius.iconset
+         WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/res)
+     set_source_files_properties(${PROJECT_SOURCE_DIR}/res/julius.icns PROPERTIES
+@@ -687,7 +685,6 @@ if(APPLE)
+     # setting variables that will populate Info.plist
+     set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.github.bvschaik.julius")
+     set(MACOSX_BUNDLE_BUNDLE_NAME ${USER_FRIENDLY_NAME})
+-    set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "Minimum OS X deployment version" FORCE)
+     set(MACOSX_BUNDLE_ICON_FILE "julius.icns")
+     set(MACOSX_BUNDLE_BUNDLE_VERSION
+         "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${VERSION_REVISION}")
+diff --git a/cmake/FindSDL2_mixer.cmake b/cmake/FindSDL2_mixer.cmake
+index 29cc683c..1fa28a1f 100644
+--- a/cmake/FindSDL2_mixer.cmake
++++ b/cmake/FindSDL2_mixer.cmake
+@@ -93,7 +93,6 @@ ELSE()
+         PATH_SUFFIXES include include/SDL2
+         PATHS ${SDL2_SEARCH_PATHS}
+       )
+-      set(SDL2_MIXER_INCLUDE_DIR "${SDL2_MIXER_INCLUDE_DIR}/Headers")
+     endif()
+ 
+     if(NOT APPLE OR NOT EXISTS "${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h")
diff --git a/pkgs/games/julius/default.nix b/pkgs/games/julius/default.nix
index b269541a0aaf1..69f3c34a1f0ff 100644
--- a/pkgs/games/julius/default.nix
+++ b/pkgs/games/julius/default.nix
@@ -5,8 +5,10 @@
 , SDL2_mixer
 , cmake
 , libpng
+, darwin
+, libicns
+, imagemagick
 }:
-
 stdenv.mkDerivation rec {
   pname = "julius";
   version = "1.7.0";
@@ -18,16 +20,41 @@ stdenv.mkDerivation rec {
     hash = "sha256-I5GTaVWzz0ryGLDSS3rzxp+XFVXZa9hZmgwon/6r83A=";
   };
 
-  nativeBuildInputs = [ cmake ];
-  buildInputs = [ SDL2 SDL2_mixer libpng ];
+  patches = [
+    # This fixes the darwin bundle generation, sets min. deployment version
+    # and patches SDL2_mixer include
+    ./darwin-fixes.patch
+  ];
+
+  nativeBuildInputs = [
+    cmake
+  ] ++ lib.optionals stdenv.isDarwin [
+    darwin.sigtool
+    libicns
+    imagemagick
+  ];
+
+  buildInputs = [
+    SDL2
+    SDL2_mixer
+    libpng
+  ] ++ lib.optionals stdenv.isDarwin [
+    darwin.apple_sdk.frameworks.Cocoa
+  ];
+
+  installPhase = lib.optionalString stdenv.isDarwin ''
+    runHook preInstall
+    mkdir -p $out/Applications
+    cp -r julius.app $out/Applications/
+    runHook postInstall
+  '';
 
   meta = with lib; {
     homepage = "https://github.com/bvschaik/julius";
     description = "Open source re-implementation of Caesar III";
     mainProgram = "julius";
     license = licenses.agpl3Only;
-    maintainers = with maintainers; [ Thra11 ];
+    maintainers = with maintainers; [ Thra11 matteopacini ];
     platforms = platforms.all;
-    broken = stdenv.isDarwin;
   };
 }