1 if [[ -n "${__nix_qtbase-}" ]]; then
2 # Throw an error if a different version of Qt was already set up.
3 if [[ "$__nix_qtbase" != "@out@" ]]; 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@
15 . @fix_qt_builtin_paths@
16 . @fix_qt_module_paths@
18 # Build tools are often confused if QMAKE is unset.
19 export QMAKE
=@out@
/bin
/qmake
25 declare -Ag qmakePathSeen
=()
27 # Skip this path if we have seen it before.
28 # MUST use 'if' because 'qmakePathSeen[$]' may be unset.
29 if [ -n "${qmakePathSeen[$1]-}" ]; then return; fi
31 if [ -d "$1/mkspecs" ]; then
32 QMAKEMODULES
="${QMAKEMODULES}${QMAKEMODULES:+:}/mkspecs"
33 QMAKEPATH
="${QMAKEPATH}${QMAKEPATH:+:}$1"
36 envBuildHostHooks
+=(qmakePathHook
)
40 declare -Ag qttoolsPathSeen
=()
42 # Skip this path if we have seen it before.
43 # MUST use 'if' because 'qttoolsPathSeen[$]' may be unset.
44 if [ -n "${qttoolsPathSeen[$1]-}" ]; then return; fi
46 if [ -d "$1/libexec" ]; then
47 QTTOOLSPATH
="${QTTOOLSPATH}${QTTOOLSPATH:+:}$1/libexec"
50 addEnvHooks
"$hostOffset" qtToolsHook
53 # Prevent this hook from running multiple times
56 local lib
="${!outputLib}"
57 local dev
="${!outputDev}"
59 moveToOutput
"mkspecs/modules" "$dev"
61 if [ -d "$dev/mkspecs/modules" ]; then
62 fixQtModulePaths
"$dev/mkspecs/modules"
65 if [ -d "$lib/mkspecs" ]; then
66 fixQtBuiltinPaths
"$lib/mkspecs" '*.pr?'
69 if [ -d "$lib/lib" ]; then
70 fixQtBuiltinPaths
"$lib/lib" '*.pr?'
73 if [ -z "${dontPatchMkspecs-}" ]; then
74 appendToVar postPhases postPatchMkspecs
78 # Check that wrapQtAppsHook/wrapQtAppsNoGuiHook is used, or it is explicitly disabled.
79 if [[ -z "$__nix_wrapQtAppsHook" && -z "$dontWrapQtApps" ]]; then
80 echo >&2 "Error: this derivation depends on qtbase, but no wrapping behavior was specified."
81 echo >&2 " - If this is a graphical application, add wrapQtAppsHook to nativeBuildInputs"
82 echo >&2 " - If this is a CLI application, add wrapQtAppsNoGuiHook to nativeBuildInputs"
83 echo >&2 " - If this is a library or you need custom wrapping logic, set dontWrapQtApps = true"
87 appendToVar prePhases qtPreHook
90 addToSearchPath QT_ADDITIONAL_PACKAGES_PREFIX_PATH
$1
92 addEnvHooks
"$hostOffset" addQtModulePrefix