Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, mkDerivation, perl }:
2
3let inherit (lib) licenses maintainers platforms; in
4
5{ self, srcs, patches }:
6
7args:
8
9let
10 inherit (args) pname;
11 version = args.version or srcs.${pname}.version;
12 src = args.src or srcs.${pname}.src;
13in
14
15mkDerivation (args // {
16 inherit pname version src;
17 patches = (args.patches or []) ++ (patches.${pname} or []);
18
19 nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ perl self.qmake ];
20 propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
21
22 outputs = args.outputs or [ "out" "dev" ];
23 setOutputFlags = args.setOutputFlags or false;
24
25 preHook = ''
26 . ${./hooks/move-qt-dev-tools.sh}
27 . ${./hooks/fix-qt-builtin-paths.sh}
28 '';
29
30 preConfigure = ''
31 ${args.preConfigure or ""}
32
33 fixQtBuiltinPaths . '*.pr?'
34 '' + lib.optionalString (builtins.compareVersions "5.15.0" version <= 0)
35 # Note: We use ${version%%-*} to remove any tag from the end of the version
36 # string. Version tags are added by Nixpkgs maintainers and not reflected in
37 # the source version.
38 ''
39 if [[ -z "$dontCheckQtModuleVersion" ]] \
40 && grep -q '^MODULE_VERSION' .qmake.conf 2>/dev/null \
41 && ! grep -q -F "''${version%%-*}" .qmake.conf 2>/dev/null
42 then
43 echo >&2 "error: could not find version ''${version%%-*} in .qmake.conf"
44 echo >&2 "hint: check .qmake.conf and update the package version in Nixpkgs"
45 exit 1
46 fi
47
48 if [[ -z "$dontSyncQt" && -f sync.profile ]]; then
49 syncqt.pl -version "''${version%%-*}"
50 fi
51 '';
52
53 dontWrapQtApps = args.dontWrapQtApps or true;
54
55 postFixup = ''
56 if [ -d "''${!outputDev}/lib/pkgconfig" ]; then
57 find "''${!outputDev}/lib/pkgconfig" -name '*.pc' | while read pc; do
58 sed -i "$pc" \
59 -e "/^prefix=/ c prefix=''${!outputLib}" \
60 -e "/^exec_prefix=/ c exec_prefix=''${!outputBin}" \
61 -e "/^includedir=/ c includedir=''${!outputDev}/include"
62 done
63 fi
64
65 moveQtDevTools
66
67 ${args.postFixup or ""}
68 '';
69
70 meta = {
71 homepage = "https://www.qt.io";
72 description = "A cross-platform application framework for C++";
73 license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ];
74 maintainers = with maintainers; [ qknight ttuegel periklis bkchr ];
75 platforms = platforms.unix;
76 } // (args.meta or {});
77})