Skip to content

Commit 30f7913

Browse files
authored
klayout: fix darwin build (NixOS#393052)
2 parents e44e27c + d92003b commit 30f7913

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

pkgs/applications/misc/klayout/default.nix

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
1-
{ lib, mkDerivation, fetchFromGitHub
2-
, python3, ruby, qtbase, qtmultimedia, qttools, qtxmlpatterns
3-
, which, perl, libgit2
1+
{
2+
lib,
3+
mkDerivation,
4+
fetchFromGitHub,
5+
python3,
6+
ruby,
7+
qtbase,
8+
qtmultimedia,
9+
qttools,
10+
qtxmlpatterns,
11+
which,
12+
perl,
13+
libgit2,
14+
stdenv,
415
}:
516

617
mkDerivation rec {
@@ -41,12 +52,28 @@ mkDerivation rec {
4152
runHook postBuild
4253
'';
4354

44-
postBuild = ''
45-
mkdir $out/bin
46-
mv $out/lib/klayout $out/bin/
55+
postBuild =
56+
lib.optionalString stdenv.hostPlatform.isLinux ''
57+
mkdir $out/bin
4758
48-
install -Dm444 etc/klayout.desktop -t $out/share/applications
49-
install -Dm444 etc/logo.png $out/share/icons/hicolor/256x256/apps/klayout.png
59+
install -Dm444 etc/klayout.desktop -t $out/share/applications
60+
install -Dm444 etc/logo.png $out/share/icons/hicolor/256x256/apps/klayout.png
61+
mv $out/lib/klayout $out/bin/
62+
''
63+
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
64+
mkdir -p $out/Applications
65+
mv $out/lib/klayout.app $out/Applications/
66+
'';
67+
68+
preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
69+
exec_name=$out/Applications/klayout.app/Contents/MacOS/klayout
70+
71+
for lib in $out/lib/libklayout_*.0.dylib; do
72+
base_name=$(basename $lib)
73+
install_name_tool -change "$base_name" "@rpath/$base_name" "$exec_name"
74+
done
75+
76+
wrapQtApp "$out/Applications/klayout.app/Contents/MacOS/klayout"
5077
'';
5178

5279
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-parentheses" ];
@@ -63,8 +90,7 @@ mkDerivation rec {
6390
license = with licenses; [ gpl2Plus ];
6491
homepage = "https://www.klayout.de/";
6592
changelog = "https://www.klayout.de/development.html#${version}";
66-
platforms = platforms.linux;
93+
platforms = platforms.linux ++ platforms.darwin;
6794
maintainers = with maintainers; [ ];
6895
};
6996
}
70-

0 commit comments

Comments
 (0)