Skip to content

Commit e9069b1

Browse files
authored
vengi-tools: fix build on darwin (#399609)
2 parents 61d80ae + 236a54d commit e9069b1

File tree

2 files changed

+31
-25
lines changed

2 files changed

+31
-25
lines changed

pkgs/applications/graphics/vengi-tools/default.nix

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
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,36 @@ 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+
mkdir -p $out/bin
98+
ln -s $out/Applications/vengi-voxconvert.app/Contents/MacOS/vengi-voxconvert $out/bin/vengi-voxconvert
99+
''
100+
else
101+
# Set the data directory for each executable. We cannot set it at build time
102+
# with the PKGDATADIR cmake variable because each executable needs a specific
103+
# one.
104+
# This is not needed on darwin, since on that platform data files are saved
105+
# in *.app/Contents/Resources/ too, and are picked up automatically.
106+
''
107+
for prog in $out/bin/*; do
108+
wrapProgram "$prog" \
109+
--set CORE_PATH $out/share/$(basename "$prog")/
110+
done
111+
'';
103112

104113
passthru.tests = {
105114
voxconvert-roundtrip = callPackage ./test-voxconvert-roundtrip.nix { };
@@ -124,6 +133,5 @@ stdenv.mkDerivation (finalAttrs: {
124133
];
125134
maintainers = with maintainers; [ fgaz ];
126135
platforms = platforms.all;
127-
broken = stdenv.hostPlatform.isDarwin;
128136
};
129137
})

pkgs/top-level/all-packages.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16285,9 +16285,7 @@ with pkgs;
1628516285

1628616286
vdirsyncer = with python3Packages; toPythonApplication vdirsyncer;
1628716287

16288-
vengi-tools = darwin.apple_sdk_11_0.callPackage ../applications/graphics/vengi-tools {
16289-
inherit (darwin.apple_sdk_11_0.frameworks) Carbon CoreServices OpenCL;
16290-
};
16288+
vengi-tools = callPackage ../applications/graphics/vengi-tools { };
1629116289

1629216290
veusz = libsForQt5.callPackage ../applications/graphics/veusz { };
1629316291

0 commit comments

Comments
 (0)