summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/5.4/setup-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/qt-5/5.4/setup-hook.sh')
-rw-r--r--pkgs/development/libraries/qt-5/5.4/setup-hook.sh59
1 files changed, 59 insertions, 0 deletions
diff --git a/pkgs/development/libraries/qt-5/5.4/setup-hook.sh b/pkgs/development/libraries/qt-5/5.4/setup-hook.sh
new file mode 100644
index 00000000000..8ab4071becf
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.4/setup-hook.sh
@@ -0,0 +1,59 @@
+addQtModule() {
+    if [[ -d "$1/mkspecs" ]]; then
+
+        @lndir@/bin/lndir -silent "$1/mkspecs" "$qtOut/mkspecs"
+        if [[ -n $qtSubmodule ]]; then
+            find "$1/mkspecs" -printf 'mkspecs/%P\n' >> "$qtOut/nix-support/qt-inputs"
+        fi
+
+        if [[ -d "$1/bin" ]]; then
+            @lndir@/bin/lndir -silent "$1/bin" "$qtOut/bin"
+            if [[ -n $qtSubmodule ]]; then
+                find "$1/bin" -printf 'bin/%P\n' >> "$qtOut/nix-support/qt-inputs"
+            fi
+        fi
+
+        if [[ -d "$1/include" ]]; then
+            @lndir@/bin/lndir -silent "$1/include" "$qtOut/include"
+            if [[ -n $qtSubmodule ]]; then
+                find "$1/include" -printf 'include/%P\n' >> "$qtOut/nix-support/qt-inputs"
+            fi
+        fi
+
+        if [[ -n $qtSubmodule ]] && [[ -d "$1/lib" ]]; then
+            @lndir@/bin/lndir -silent "$1/lib" "$qtOut/lib"
+            find "$1/lib" -printf 'lib/%P\n' >> "$qtOut/nix-support/qt-inputs"
+        fi
+
+        propagatedBuildInputs+=" $1"
+    fi
+
+    if [[ -d "$1/lib/qt5/qml" ]] || [[ -d "$1/lib/qt5/plugins" ]] || [[ -d "$1/lib/qt5/imports" ]]; then
+        propagatedUserEnvPkgs+=" $1"
+    fi
+}
+
+setQMakePath() {
+    export PATH="$qtOut/bin${PATH:+:}$PATH"
+}
+
+qtOut=""
+if [[ -z $qtSubmodule ]]; then
+    qtOut="$PWD/qmake-$name"
+else
+    qtOut=$out
+fi
+
+mkdir -p "$qtOut/bin" "$qtOut/mkspecs" "$qtOut/include" "$qtOut/nix-support" "$qtOut/lib"
+
+cp "@out@/bin/qmake" "$qtOut/bin"
+cat >"$qtOut/bin/qt.conf" <<EOF
+[Paths]
+Prefix = $qtOut
+Plugins = $qtOut/lib/qt5/plugins
+Imports = $qtOut/lib/qt5/imports
+Qml2Imports = $qtOut/lib/qt5/qml
+EOF
+
+envHooks+=(addQtModule)
+preConfigurePhases+=" setQMakePath"