Skip to content

Commit 3a2b22a

Browse files
committed
vengi-tools: fix build on darwin
Also, move *.app bundles under /Applications/ directory. Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
1 parent 38884ec commit 3a2b22a

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

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

Lines changed: 27 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,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
})

pkgs/top-level/all-packages.nix

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

1645416454
vdirsyncer = with python3Packages; toPythonApplication vdirsyncer;
1645516455

16456-
vengi-tools = darwin.apple_sdk_11_0.callPackage ../applications/graphics/vengi-tools {
16457-
inherit (darwin.apple_sdk_11_0.frameworks) Carbon CoreServices OpenCL;
16458-
};
16456+
vengi-tools = callPackage ../applications/graphics/vengi-tools { };
1645916457

1646016458
veusz = libsForQt5.callPackage ../applications/graphics/veusz { };
1646116459

0 commit comments

Comments
 (0)