2727 SDL2 ,
2828 SDL2_mixer ,
2929 wayland-protocols ,
30- Carbon ,
31- CoreServices ,
32- OpenCL ,
3330
3431 callPackage ,
3532 nixosTests ,
@@ -46,6 +43,15 @@ stdenv.mkDerivation (finalAttrs: {
4643 hash = "sha256-8rGnW+VtqNJYqUqQDp0yOVIQd7w+cq7PIpqqIQPhkbE=" ;
4744 } ;
4845
46+ prePatch = lib . optionalString stdenv . hostPlatform . isDarwin ''
47+ # Disable code signing on macOS
48+ substituteInPlace cmake/macros.cmake --replace-fail "codesign" "true"
49+ substituteInPlace cmake/system/apple.cmake --replace-fail "if(APPLE)" "if(false)"
50+
51+ # calls otool -L on /usr/lib/libSystem.B.dylib and fails because it doesn't exist
52+ substituteInPlace cmake/applebundle.cmake --replace-fail 'fixup_bundle("'' ${TARGET_BUNDLE_DIR}" "" "")' ""
53+ '' ;
54+
4955 nativeBuildInputs = [
5056 cmake
5157 pkg-config
@@ -73,33 +79,33 @@ stdenv.mkDerivation (finalAttrs: {
7379 SDL2_mixer
7480 ]
7581 ++ lib . optional stdenv . hostPlatform . isLinux wayland-protocols
76- ++ lib . optionals stdenv . hostPlatform . isDarwin [
77- Carbon
78- CoreServices
79- OpenCL
80- ]
8182 ++ lib . optional ( ! stdenv . hostPlatform . isDarwin ) opencl-headers ;
8283
83- cmakeFlags = lib . optional stdenv . hostPlatform . isDarwin "-DCORESERVICES_LIB=${ CoreServices } " ;
84-
8584 # error: "The plain signature for target_link_libraries has already been used"
8685 doCheck = false ;
8786
8887 checkInputs = [
8988 gtest
9089 ] ;
9190
92- # Set the data directory for each executable. We cannot set it at build time
93- # with the PKGDATADIR cmake variable because each executable needs a specific
94- # one.
95- # This is not needed on darwin, since on that platform data files are saved
96- # in *.app/Contents/Resources/ too, and are picked up automatically.
97- postInstall = lib . optionalString ( ! stdenv . hostPlatform . isDarwin ) ''
98- for prog in $out/bin/*; do
99- wrapProgram "$prog" \
100- --set CORE_PATH $out/share/$(basename "$prog")/
101- done
102- '' ;
91+ postInstall =
92+ if stdenv . hostPlatform . isDarwin then
93+ ''
94+ mkdir -p $out/Applications
95+ mv $out/*.app $out/Applications/
96+ ''
97+ else
98+ # Set the data directory for each executable. We cannot set it at build time
99+ # with the PKGDATADIR cmake variable because each executable needs a specific
100+ # one.
101+ # This is not needed on darwin, since on that platform data files are saved
102+ # in *.app/Contents/Resources/ too, and are picked up automatically.
103+ ''
104+ for prog in $out/bin/*; do
105+ wrapProgram "$prog" \
106+ --set CORE_PATH $out/share/$(basename "$prog")/
107+ done
108+ '' ;
103109
104110 passthru . tests = {
105111 voxconvert-roundtrip = callPackage ./test-voxconvert-roundtrip.nix { } ;
@@ -124,6 +130,5 @@ stdenv.mkDerivation (finalAttrs: {
124130 ] ;
125131 maintainers = with maintainers ; [ fgaz ] ;
126132 platforms = platforms . all ;
127- broken = stdenv . hostPlatform . isDarwin ;
128133 } ;
129134} )
0 commit comments