summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorThomas Tuegel <ttuegel@gmail.com>2015-10-14 09:44:10 -0500
committerThomas Tuegel <ttuegel@gmail.com>2015-10-30 16:10:37 -0500
commitd57e50d840589db867397cac29d1fd88092fbfd9 (patch)
tree7c4a6132db21ec13c769b740c7d0c3b35cab0022 /pkgs/development
parent895100ef91690e2b68c12a0d201c923fee08b441 (diff)
downloadnixlib-d57e50d840589db867397cac29d1fd88092fbfd9.tar
nixlib-d57e50d840589db867397cac29d1fd88092fbfd9.tar.gz
nixlib-d57e50d840589db867397cac29d1fd88092fbfd9.tar.bz2
nixlib-d57e50d840589db867397cac29d1fd88092fbfd9.tar.lz
nixlib-d57e50d840589db867397cac29d1fd88092fbfd9.tar.xz
nixlib-d57e50d840589db867397cac29d1fd88092fbfd9.tar.zst
nixlib-d57e50d840589db867397cac29d1fd88092fbfd9.zip
separate makeQtWrapper from qtbase setup-hook
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/libraries/qt-5/5.5/default.nix4
-rw-r--r--pkgs/development/libraries/qt-5/5.5/make-qt-wrapper.sh52
-rw-r--r--pkgs/development/libraries/qt-5/5.5/qtbase/setup-hook.sh32
3 files changed, 55 insertions, 33 deletions
diff --git a/pkgs/development/libraries/qt-5/5.5/default.nix b/pkgs/development/libraries/qt-5/5.5/default.nix
index 87895eaa0aa2..d5f542a06fa3 100644
--- a/pkgs/development/libraries/qt-5/5.5/default.nix
+++ b/pkgs/development/libraries/qt-5/5.5/default.nix
@@ -18,7 +18,7 @@
 , decryptSslTraffic ? false
 }:
 
-let inherit (pkgs) stdenv; in
+let inherit (pkgs) makeSetupHook makeWrapper stdenv; in
 
 with stdenv.lib;
 
@@ -101,6 +101,8 @@ let
       qtx11extras = callPackage ./qtx11extras.nix {};
       qtxmlpatterns = callPackage ./qtxmlpatterns.nix {};
 
+      makeQtWrapper = makeSetupHook { deps = [ makeWrapper ]; } ./make-qt-wrapper.sh;
+
     };
 
 in makeScope pkgs.newScope addPackages
diff --git a/pkgs/development/libraries/qt-5/5.5/make-qt-wrapper.sh b/pkgs/development/libraries/qt-5/5.5/make-qt-wrapper.sh
new file mode 100644
index 000000000000..f4f13833b8d0
--- /dev/null
+++ b/pkgs/development/libraries/qt-5/5.5/make-qt-wrapper.sh
@@ -0,0 +1,52 @@
+addQtDependency() {
+    addToSearchPath QT_PLUGIN_PATH "$1/lib/qt5/plugins"
+    addToSearchPath QML_IMPORT_PATH "$1/lib/qt5/imports"
+    addToSearchPath QML2_IMPORT_PATH "$1/lib/qt5/qml"
+    addToSearchPath XDG_DATA_DIRS "$1/share"
+}
+
+wrapQtProgram() {
+    local prog="$1"
+    shift
+    if [[ -n "$QT_WRAPPER_IMPURE" ]]; then
+        wrapProgram "$prog" \
+            --prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
+            --prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
+            --prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
+            "$@"
+    else
+        wrapProgram "$prog" \
+            --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
+            --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
+            --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
+            "$@"
+    fi
+}
+
+makeQtWrapper() {
+    local old="$1"
+    local new="$2"
+    shift
+    shift
+    if [[ -n "$QT_WRAPPER_IMPURE" ]]; then
+        makeWrapper "$old" "$new" \
+            --prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
+            --prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
+            --prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
+            "$@"
+    else
+        makeWrapper "$old" "$new" \
+            --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
+            --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
+            --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
+            "$@"
+    fi
+}
+
+# cannot use addToSearchPath because these directories may not exist yet
+export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}$out/lib/qt5/plugins"
+export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}$out/lib/qt5/imports"
+export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}$out/lib/qt5/qml"
+export XDG_DATA_DIRS="$XDG_DATA_DIRS${XDG_DATA_DIRS:+:}$out/share"
+
+envHooks+=(addQtDependency)
diff --git a/pkgs/development/libraries/qt-5/5.5/qtbase/setup-hook.sh b/pkgs/development/libraries/qt-5/5.5/qtbase/setup-hook.sh
index cae1aeaac2cc..ab34cbd36751 100644
--- a/pkgs/development/libraries/qt-5/5.5/qtbase/setup-hook.sh
+++ b/pkgs/development/libraries/qt-5/5.5/qtbase/setup-hook.sh
@@ -18,11 +18,6 @@ addQtModule() {
             fi
         done
     fi
-
-    addToSearchPath QT_PLUGIN_PATH "$1/lib/qt5/plugins"
-    addToSearchPath QML_IMPORT_PATH "$1/lib/qt5/imports"
-    addToSearchPath QML2_IMPORT_PATH "$1/lib/qt5/qml"
-    addToSearchPath XDG_DATA_DIRS "$1/share"
 }
 
 rmQtModules() {
@@ -49,28 +44,6 @@ setQMakePath() {
     export PATH="$qtOut/bin${PATH:+:}$PATH"
 }
 
-wrapQtProgram() {
-    local prog="$1"
-    shift
-    wrapProgram "$prog" \
-        --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
-        --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
-        --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
-        "$@"
-}
-
-makeQtWrapper() {
-    local old="$1"
-    local new="$2"
-    shift
-    shift
-    makeWrapper "$old" "$new" \
-        --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
-        --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \
-        --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
-        "$@"
-}
-
 qtOut=""
 if [[ -z "$NIX_QT_SUBMODULE" ]]; then
     qtOut="$PWD/qmake-$name"
@@ -91,11 +64,6 @@ Documentation = share/doc/qt5
 EOF
 
 export QMAKE="$qtOut/bin/qmake"
-# cannot use addToSearchPath because these directories may not exist yet
-export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}$out/lib/qt5/plugins"
-export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}$out/lib/qt5/imports"
-export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}$out/lib/qt5/qml"
-export XDG_DATA_DIRS="$XDG_DATA_DIRS${XDG_DATA_DIRS:+:}$out/share"
 
 envHooks+=(addQtModule)
 preConfigurePhases+=(setQMakePath)