nixpkgs/pkgs/development/libraries/qt-6/qtModule.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

89 lines
2.7 KiB
Nix
Raw Normal View History

2021-10-16 12:22:24 +00:00
{ stdenv, lib, perl, cmake, ninja, writeText }:
{ self, srcs, patches ? [ ] }:
args:
let
inherit (args) pname;
version = args.version or srcs.${pname}.version;
src = args.src or srcs.${pname}.src;
in
stdenv.mkDerivation (args // {
inherit pname version src;
patches = args.patches or patches.${pname} or [ ];
buildInputs = args.buildInputs or [ ];
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
perl
cmake
ninja
2022-08-14 17:18:40 +00:00
self.qmake
2021-10-16 12:22:24 +00:00
];
propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or [ ]);
2022-08-14 17:18:40 +00:00
preHook = ''
. ${./hooks/move-qt-dev-tools.sh}
. ${./hooks/fix-qt-builtin-paths.sh}
'';
2021-10-16 12:22:24 +00:00
outputs = args.outputs or [ "out" "dev" ];
dontWrapQtApps = args.dontWrapQtApps or true;
postInstall = ''
if [ ! -z "$dev" ]; then
mkdir "$dev"
for dir in libexec mkspecs
2021-10-16 12:22:24 +00:00
do
moveToOutput "$dir" "$dev"
done
fi
2022-08-14 17:18:40 +00:00
fixQtBuiltinPaths $out/lib "*.pr?"
2021-10-16 12:22:24 +00:00
${args.postInstall or ""}
'';
2022-08-14 17:18:40 +00:00
preConfigure = args.preConfigure or "" + ''
fixQtBuiltinPaths . '*.pr?'
'' + lib.optionalString (builtins.compareVersions "5.15.0" version <= 0)
# Note: We use ${version%%-*} to remove any tag from the end of the version
# string. Version tags are added by Nixpkgs maintainers and not reflected in
# the source version.
''
if [[ -z "$dontCheckQtModuleVersion" ]] \
&& grep -q '^MODULE_VERSION' .qmake.conf 2>/dev/null \
&& ! grep -q -F "''${version%%-*}" .qmake.conf 2>/dev/null
then
echo >&2 "error: could not find version ''${version%%-*} in .qmake.conf"
echo >&2 "hint: check .qmake.conf and update the package version in Nixpkgs"
exit 1
fi
if [[ -z "$dontSyncQt" && -f sync.profile ]]; then
# FIXME: this probably breaks crosscompiling as it's not from nativeBuildInputs
# I don't know how to get /libexec from nativeBuildInputs to work, it's not under /bin
${lib.getDev self.qtbase}/libexec/syncqt.pl -version "''${version%%-*}"
2022-08-14 17:18:40 +00:00
fi
'';
postFixup = ''
if [ -d "''${!outputDev}/lib/pkgconfig" ]; then
find "''${!outputDev}/lib/pkgconfig" -name '*.pc' | while read pc; do
sed -i "$pc" \
-e "/^prefix=/ c prefix=''${!outputLib}" \
-e "/^exec_prefix=/ c exec_prefix=''${!outputBin}" \
-e "/^includedir=/ c includedir=''${!outputDev}/include"
done
fi
moveQtDevTools
'' + args.postFixup or "";
2021-10-16 12:22:24 +00:00
meta = with lib; {
homepage = "https://www.qt.io/";
description = "A cross-platform application framework for C++";
2022-10-27 20:48:13 +00:00
license = with licenses; [ fdl13Plus gpl2Plus lgpl21Plus lgpl3Plus ];
2021-10-16 12:22:24 +00:00
maintainers = with maintainers; [ milahu nickcao ];
2022-11-28 23:33:35 +00:00
platforms = platforms.unix;
2021-10-16 12:22:24 +00:00
} // (args.meta or { });
})