1 if [[ -n "${__nix_qtbase-}" ]]; then
2 # Throw an error if a different version of Qt was already set up.
3 if [[ "$__nix_qtbase" != "@dev@" ]]; then
4 echo >&2 "Error: detected mismatched Qt dependencies:"
6 echo >&2 " $__nix_qtbase"
9 else # Only set up Qt once.
12 qtPluginPrefix
=@qtPluginPrefix@
13 qtQmlPrefix
=@qtQmlPrefix@
14 qtDocPrefix
=@qtDocPrefix@
16 . @fix_qt_builtin_paths@
17 . @fix_qt_module_paths@
19 # Disable debug symbols if qtbase was built without debugging.
20 # This stops -dev paths from leaking into other outputs.
21 if [ -z "@debug@" ]; then
22 NIX_CFLAGS_COMPILE
="${NIX_CFLAGS_COMPILE-}${NIX_CFLAGS_COMPILE:+ }-DQT_NO_DEBUG"
25 # Integration with CMake:
26 # Set the CMake build type corresponding to how qtbase was built.
27 if [ -n "@debug@" ]; then
28 cmakeBuildType
="Debug"
30 cmakeBuildType
="Release"
34 [ -d "$1/$qtPluginPrefix" ] ||
[ -d "$1/$qtQmlPrefix" ]
37 # Build tools are often confused if QMAKE is unset.
47 declare -Ag qmakePathSeen
=()
49 # Skip this path if we have seen it before.
50 # MUST use 'if' because 'qmakePathSeen[$]' may be unset.
51 if [ -n "${qmakePathSeen[$1]-}" ]; then return; fi
53 if [ -d "$1/mkspecs" ]
55 QMAKEMODULES
="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
56 QMAKEPATH
="${QMAKEPATH}${QMAKEPATH:+:}$1"
59 envBuildHostHooks
+=(qmakePathHook
)
61 # Propagate any runtime dependency of the building package.
62 # Each dependency is propagated to the user environment and as a build
63 # input so that it will be re-propagated to the user environment by any
64 # package depending on the building package. (This is necessary in case
65 # the building package does not provide runtime dependencies itself and so
66 # would not be propagated to the user environment.)
67 declare -Ag qtEnvHostTargetSeen
=()
68 qtEnvHostTargetHook
() {
69 # Skip this path if we have seen it before.
70 # MUST use 'if' because 'qmakePathSeen[$]' may be unset.
71 if [ -n "${qtEnvHostTargetSeen[$1]-}" ]; then return; fi
72 qtEnvHostTargetSeen
[$1]=1
73 if providesQtRuntime
"$1" && [ "z${!outputBin}" != "z${!outputDev}" ]
75 propagatedBuildInputs
+=" $1"
78 envHostTargetHooks
+=(qtEnvHostTargetHook
)
81 # Prevent this hook from running multiple times
84 local bin
="${!outputBin}"
85 local dev
="${!outputDev}"
86 local doc
="${!outputDoc}"
87 local lib
="${!outputLib}"
89 moveToOutput
"mkspecs" "$dev"
91 if [ -d "$dev/mkspecs/modules" ]; then
92 fixQtModulePaths
"$dev/mkspecs/modules"
95 if [ -d "$dev/mkspecs" ]; then
96 fixQtBuiltinPaths
"$dev/mkspecs" '*.pr?'
99 if [ -z "${dontPatchMkspecs-}" ]; then
100 postPhases
="${postPhases-}${postPhases:+ }postPatchMkspecs"
104 # Check that wrapQtAppsHook is used, or it is explicitly disabled.
105 if [[ -z "$__nix_wrapQtAppsHook" && -z "$dontWrapQtApps" ]]; then
106 echo >&2 "Error: wrapQtAppsHook is not used, and dontWrapQtApps is not set."
110 prePhases
+=" qtPreHook"