summary refs log tree commit diff
path: root/pkgs/development/libraries/qt-5/qmake-hook.sh
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/qt-5/qmake-hook.sh')
-rw-r--r--pkgs/development/libraries/qt-5/qmake-hook.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/pkgs/development/libraries/qt-5/qmake-hook.sh b/pkgs/development/libraries/qt-5/qmake-hook.sh
new file mode 100644
index 00000000000..696b4ea8dad
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/qmake-hook.sh
@@ -0,0 +1,42 @@
+qmakeConfigurePhase() {
+    runHook preConfigure
+
+    qmake PREFIX=$out $qmakeFlags
+
+    runHook postConfigure
+}
+
+if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
+    configurePhase=qmakeConfigurePhase
+fi
+
+_qtModuleMultioutDevsPre() {
+    # We cannot simply set these paths in configureFlags because libQtCore retains
+    # references to the paths it was built with.
+    moveToOutput "bin" "${!outputDev}"
+    moveToOutput "include" "${!outputDev}"
+
+    # The destination directory must exist or moveToOutput will do nothing
+    mkdir -p "${!outputDev}/share"
+    moveToOutput "share/doc" "${!outputDev}"
+}
+
+_qtModuleMultioutDevsPost() {
+    # Move libtool archives and qmake project files to $dev/lib
+    if [ "z${!outputLib}" != "z${!outputDev}" ]; then
+        pushd "${!outputLib}"
+        if [ -d "lib" ]; then
+            find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | \
+                while read -r -d $'\0' file; do
+                    mkdir -p "${!outputDev}/$(dirname "$file")"
+                    mv "${!outputLib}/$file" "${!outputDev}/$file"
+                done
+        fi
+        popd
+    fi
+}
+
+if [ -n "$NIX_QT_SUBMODULE" ]; then
+    preFixupHooks+=(_qtModuleMultioutDevsPre)
+    postFixupHooks+=(_qtModuleMultioutDevsPost)
+fi