forked from mirrors/nixpkgs
qtbase: Set cmakeFlags and NIX_CFLAGS_COMPILE in setupHook
This commit is contained in:
parent
b80ce0aeca
commit
7744998f04
|
@ -145,7 +145,7 @@ let
|
|||
patches = patches.qtbase;
|
||||
inherit bison cups harfbuzz libGL;
|
||||
withGtk3 = true; inherit dconf gtk3;
|
||||
inherit developerBuild decryptSslTraffic;
|
||||
inherit debug developerBuild decryptSslTraffic;
|
||||
};
|
||||
|
||||
qtcharts = callPackage ../modules/qtcharts.nix {};
|
||||
|
|
|
@ -149,7 +149,7 @@ let
|
|||
patches = patches.qtbase;
|
||||
inherit bison cups harfbuzz libGL;
|
||||
withGtk3 = true; inherit dconf gtk3;
|
||||
inherit developerBuild decryptSslTraffic;
|
||||
inherit debug developerBuild decryptSslTraffic;
|
||||
};
|
||||
|
||||
qtcharts = callPackage ../modules/qtcharts.nix {};
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
if [[ -n "${__nix_qtbase-}" ]]; then
|
||||
# Throw an error if a different version of Qt was already set up.
|
||||
if [[ "$__nix_qtbase" != "@dev@" ]]; then
|
||||
echo >&2 "Error: detected mismatched Qt dependencies:"
|
||||
echo >&2 " @dev@"
|
||||
echo >&2 " $__nix_qtbase"
|
||||
exit 1
|
||||
fi
|
||||
else # Only set up Qt once.
|
||||
__nix_qtbase="@dev@"
|
||||
|
||||
qtPluginPrefix=@qtPluginPrefix@
|
||||
qtQmlPrefix=@qtQmlPrefix@
|
||||
qtDocPrefix=@qtDocPrefix@
|
||||
|
@ -5,6 +16,20 @@ qtDocPrefix=@qtDocPrefix@
|
|||
. @fix_qt_builtin_paths@
|
||||
. @fix_qt_module_paths@
|
||||
|
||||
# Disable debug symbols if qtbase was built without debugging.
|
||||
# This stops -dev paths from leaking into other outputs.
|
||||
if [ -z "@debug@" ]; then
|
||||
NIX_CFLAGS_COMPILE="${NIX_CFLAGS_COMPILE-}${NIX_CFLAGS_COMPILE:+ }-DQT_NO_DEBUG"
|
||||
fi
|
||||
|
||||
# Integration with CMake:
|
||||
# Set the CMake build type corresponding to how qtbase was built.
|
||||
if [ -n "@debug@" ]; then
|
||||
cmakeBuildType="Debug"
|
||||
else
|
||||
cmakeBuildType="Release"
|
||||
fi
|
||||
|
||||
providesQtRuntime() {
|
||||
[ -d "$1/$qtPluginPrefix" ] || [ -d "$1/$qtQmlPrefix" ]
|
||||
}
|
||||
|
@ -19,7 +44,12 @@ export QMAKEPATH
|
|||
QMAKEMODULES=
|
||||
export QMAKEMODULES
|
||||
|
||||
declare -Ag qmakePathSeen=()
|
||||
qmakePathHook() {
|
||||
# Skip this path if we have seen it before.
|
||||
# MUST use 'if' because 'qmakePathSeen[$]' may be unset.
|
||||
if [ -n "${qmakePathSeen[$1]-}" ]; then return; fi
|
||||
qmakePathSeen[$1]=1
|
||||
if [ -d "$1/mkspecs" ]
|
||||
then
|
||||
QMAKEMODULES="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
|
||||
|
@ -34,7 +64,12 @@ envBuildHostHooks+=(qmakePathHook)
|
|||
# package depending on the building package. (This is necessary in case
|
||||
# the building package does not provide runtime dependencies itself and so
|
||||
# would not be propagated to the user environment.)
|
||||
declare -Ag qtEnvHostTargetSeen=()
|
||||
qtEnvHostTargetHook() {
|
||||
# Skip this path if we have seen it before.
|
||||
# MUST use 'if' because 'qmakePathSeen[$]' may be unset.
|
||||
if [ -n "${qtEnvHostTargetSeen[$1]-}" ]; then return; fi
|
||||
qtEnvHostTargetSeen[$1]=1
|
||||
if providesQtRuntime "$1" && [ "z${!outputBin}" != "z${!outputDev}" ]
|
||||
then
|
||||
propagatedBuildInputs+=" $1"
|
||||
|
@ -64,3 +99,5 @@ postPatchMkspecs() {
|
|||
if [ -z "${dontPatchMkspecs-}" ]; then
|
||||
postPhases="${postPhases-}${postPhases:+ }postPatchMkspecs"
|
||||
fi
|
||||
|
||||
fi
|
||||
|
|
|
@ -9,16 +9,6 @@ args:
|
|||
let
|
||||
args_ = {
|
||||
|
||||
NIX_CFLAGS_COMPILE = toString (
|
||||
optional (!debug) "-DQT_NO_DEBUG"
|
||||
++ lib.toList (args.NIX_CFLAGS_COMPILE or []));
|
||||
|
||||
cmakeFlags =
|
||||
(args.cmakeFlags or [])
|
||||
++ [
|
||||
("-DCMAKE_BUILD_TYPE=" + (if debug then "Debug" else "Release"))
|
||||
];
|
||||
|
||||
enableParallelBuilding = args.enableParallelBuilding or true;
|
||||
|
||||
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ wrapQtAppsHook ];
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
libGL,
|
||||
buildExamples ? false,
|
||||
buildTests ? false,
|
||||
debug ? false,
|
||||
developerBuild ? false,
|
||||
decryptSslTraffic ? false
|
||||
}:
|
||||
|
@ -39,6 +40,7 @@ stdenv.mkDerivation {
|
|||
|
||||
name = "qtbase-${version}";
|
||||
inherit qtCompatVersion src version;
|
||||
inherit debug;
|
||||
|
||||
propagatedBuildInputs =
|
||||
[
|
||||
|
|
Loading…
Reference in a new issue