diff options
Diffstat (limited to 'pkgs/development/libraries/qt-5/5.6/qtbase/setup-hook.sh')
-rw-r--r-- | pkgs/development/libraries/qt-5/5.6/qtbase/setup-hook.sh | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/pkgs/development/libraries/qt-5/5.6/qtbase/setup-hook.sh b/pkgs/development/libraries/qt-5/5.6/qtbase/setup-hook.sh new file mode 100644 index 0000000000000..a9c4fbc855f77 --- /dev/null +++ b/pkgs/development/libraries/qt-5/5.6/qtbase/setup-hook.sh @@ -0,0 +1,52 @@ +addToSearchPathOnceWithCustomDelimiter() { + local delim="$1" + local search="$2" + local target="$3" + local dirs + local exported + IFS="$delim" read -a dirs <<< "${!search}" + local canonical + if canonical=$(readlink -e "$target"); then + for dir in ${dirs[@]}; do + if [ "z$dir" == "z$canonical" ]; then exported=1; fi + done + if [ -z $exported ]; then + eval "export ${search}=\"${!search}${!search:+$delim}$canonical\"" + fi + fi +} + +addToSearchPathOnce() { + addToSearchPathOnceWithCustomDelimiter ':' "$@" +} + +propagateOnce() { + addToSearchPathOnceWithCustomDelimiter ' ' "$@" +} + +_qtPropagateRuntimeDependencies() { + for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do + if [ -d "$1/$dir" ]; then + propagateOnce propagatedBuildInputs "$1" + propagateOnce propagatedUserEnvPkgs "$1" + break + fi + done + addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins" + addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports" + addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml" +} + +envHooks+=(_qtPropagateRuntimeDependencies) + +_qtMultioutDevs() { + # This is necessary whether the package is a Qt module or not + moveToOutput "mkspecs" "${!outputDev}" +} + +preFixupHooks+=(_qtMultioutDevs) + +if [[ -z "$NIX_QT_PIC" ]]; then + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE${NIX_CFLAGS_COMPILE:+ }-fPIC" + export NIX_QT_PIC=1 +fi |