1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
{
lib,
mkDerivation,
fetchFromGitHub,
python3,
ruby,
qtbase,
qtmultimedia,
qttools,
qtxmlpatterns,
which,
perl,
libgit2,
stdenv,
}:
mkDerivation rec {
pname = "klayout";
version = "0.30.3";
src = fetchFromGitHub {
owner = "KLayout";
repo = "klayout";
rev = "v${version}";
hash = "sha256-YsyKCSSxg0THflzPVF9yRn1X2liVT5xNafeQej/pdyI=";
};
postPatch = ''
substituteInPlace src/klayout.pri --replace "-Wno-reserved-user-defined-literal" ""
patchShebangs .
'';
nativeBuildInputs = [
which
perl
python3
ruby
];
buildInputs = [
qtbase
qtmultimedia
qttools
qtxmlpatterns
libgit2
];
buildPhase = ''
runHook preBuild
mkdir -p $out/lib
./build.sh -qt5 -prefix $out/lib -option -j$NIX_BUILD_CORES
runHook postBuild
'';
postBuild =
lib.optionalString stdenv.hostPlatform.isLinux ''
mkdir $out/bin
install -Dm444 etc/klayout.desktop -t $out/share/applications
install -Dm444 etc/logo.png $out/share/icons/hicolor/256x256/apps/klayout.png
mv $out/lib/klayout $out/bin/
''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
mkdir -p $out/Applications
mv $out/lib/klayout.app $out/Applications/
'';
preFixup = lib.optionalString stdenv.hostPlatform.isDarwin ''
exec_name=$out/Applications/klayout.app/Contents/MacOS/klayout
for lib in $out/lib/libklayout_*.0.dylib; do
base_name=$(basename $lib)
install_name_tool -change "$base_name" "@rpath/$base_name" "$exec_name"
done
wrapQtApp "$out/Applications/klayout.app/Contents/MacOS/klayout"
'';
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-parentheses" ];
dontInstall = true; # Installation already happens as part of "build.sh"
# Fix: "gsiDeclQMessageLogger.cc:126:42: error: format not a string literal
# and no format arguments [-Werror=format-security]"
hardeningDisable = [ "format" ];
meta = {
description = "High performance layout viewer and editor with support for GDS and OASIS";
mainProgram = "klayout";
license = with lib.licenses; [ gpl2Plus ];
homepage = "https://www.klayout.de/";
changelog = "https://www.klayout.de/development.html#${version}";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
maintainers = with lib.maintainers; [ ];
};
}
|