qt55.qtbase: fix setup hook and QMake hook

+50 -92
+36 -1
pkgs/development/libraries/qt-5/5.5/make-qt-wrapper.sh
··· 1 - ../5.6/make-qt-wrapper.sh 1 + wrapQtProgram() { 2 + local prog="$1" 3 + shift 4 + wrapProgram "$prog" \ 5 + --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \ 6 + --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \ 7 + --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \ 8 + --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \ 9 + --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \ 10 + "$@" 11 + } 12 + 13 + makeQtWrapper() { 14 + local old="$1" 15 + local new="$2" 16 + shift 17 + shift 18 + makeWrapper "$old" "$new" \ 19 + --set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \ 20 + --set QML_IMPORT_PATH "$QML_IMPORT_PATH" \ 21 + --set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \ 22 + --prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \ 23 + --prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \ 24 + "$@" 25 + } 26 + 27 + _makeQtWrapperSetup() { 28 + # cannot use addToSearchPath because these directories may not exist yet 29 + export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins" 30 + export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports" 31 + export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml" 32 + export RUNTIME_XDG_DATA_DIRS="$XDG_DATA_DIRS${XDG_DATA_DIRS:+:}${!outputBin}/share" 33 + export RUNTIME_XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS${XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg" 34 + } 35 + 36 + prePhases+=(_makeQtWrapperSetup)
+13 -91
pkgs/development/libraries/qt-5/5.5/qmake-hook.sh
··· 1 - if [[ -z "$QMAKE" ]]; then 2 - 3 - _qtLinkDependencyDir() { 4 - @lndir@/bin/lndir -silent "$1/$2" "$qtOut/$2" 5 - if [ -n "$NIX_QT_SUBMODULE" ]; then 6 - find "$1/$2" -printf "$2/%P\n" >> "$out/nix-support/qt-inputs" 7 - fi 8 - } 9 - 10 - _qtLinkModule() { 11 - if [ -d "$1/mkspecs" ]; then 12 - # $1 is a Qt module 13 - _qtLinkDependencyDir "$1" mkspecs 14 - 15 - for dir in bin include lib share; do 16 - if [ -d "$1/$dir" ]; then 17 - _qtLinkDependencyDir "$1" "$dir" 18 - fi 19 - done 20 - fi 21 - } 22 - 23 - _qtRmModules() { 24 - cat "$out/nix-support/qt-inputs" | while read file; do 25 - if [ -h "$out/$file" ]; then 26 - rm "$out/$file" 27 - fi 28 - done 1 + qmakeConfigurePhase() { 2 + runHook preConfigure 29 3 30 - cat "$out/nix-support/qt-inputs" | while read file; do 31 - if [ -d "$out/$file" ]; then 32 - rmdir --ignore-fail-on-non-empty -p "$out/$file" 33 - fi 34 - done 35 - 36 - rm "$out/nix-support/qt-inputs" 37 - } 4 + qmake PREFIX=$out $qmakeFlags 38 5 39 - _qtRmQmake() { 40 - rm "$qtOut/bin/qmake" "$qtOut/bin/qt.conf" 6 + runHook postConfigure 41 7 } 42 8 43 - _qtSetQmakePath() { 44 - export PATH="$qtOut/bin${PATH:+:}$PATH" 45 - } 9 + if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then 10 + configurePhase=qmakeConfigurePhase 11 + fi 46 12 47 - _qtMultioutModuleDevs() { 13 + _qtModuleMultioutDevsPre() { 48 14 # We cannot simply set these paths in configureFlags because libQtCore retains 49 15 # references to the paths it was built with. 50 16 moveToOutput "bin" "${!outputDev}" ··· 53 19 # The destination directory must exist or moveToOutput will do nothing 54 20 mkdir -p "${!outputDev}/share" 55 21 moveToOutput "share/doc" "${!outputDev}" 22 + } 56 23 24 + _qtModuleMultioutDevsPost() { 57 25 # Move libtool archives and qmake project files to $dev/lib 58 26 if [ "z${!outputLib}" != "z${!outputDev}" ]; then 59 27 pushd "${!outputLib}" 60 28 if [ -d "lib" ]; then 61 - find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' -print0 \) | \ 29 + find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | \ 62 30 while read -r -d $'\0' file; do 63 31 mkdir -p "${!outputDev}/$(dirname "$file")" 64 32 mv "${!outputLib}/$file" "${!outputDev}/$file" ··· 68 36 fi 69 37 } 70 38 71 - _qtRmQtOut() { 72 - rm -fr "$qtOut" 73 - } 74 - 75 - qmakeConfigurePhase() { 76 - runHook preConfigure 77 - 78 - qmake PREFIX=$out $qmakeFlags 79 - 80 - runHook postConfigure 81 - } 82 - 83 - qtOut="" 84 - if [[ -z "$NIX_QT_SUBMODULE" ]]; then 85 - qtOut=`mktemp -d` 86 - else 87 - qtOut=$out 88 - fi 89 - 90 - mkdir -p "$qtOut/bin" "$qtOut/mkspecs" "$qtOut/include" "$qtOut/nix-support" "$qtOut/lib" "$qtOut/share" 91 - 92 - cp "@qt_dev@/bin/qmake" "$qtOut/bin" 93 - cat >"$qtOut/bin/qt.conf" <<EOF 94 - [Paths] 95 - Prefix = $qtOut 96 - Plugins = lib/qt5/plugins 97 - Imports = lib/qt5/imports 98 - Qml2Imports = lib/qt5/qml 99 - Documentation = share/doc/qt5 100 - EOF 101 - 102 - export QMAKE="$qtOut/bin/qmake" 103 - 104 - envHooks+=(_qtLinkModule) 105 - # Set PATH to find qmake first in a preConfigure hook 106 - # It must run after all the envHooks! 107 - postHooks+=(_qtSetQmakePath) 108 - 109 - if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then 110 - configurePhase=qmakeConfigurePhase 111 - fi 112 - 113 39 if [ -n "$NIX_QT_SUBMODULE" ]; then 114 - postInstallHooks+=(_qtRmQmake _qtRmModules) 115 - preFixupHooks+=(_qtMultioutModuleDevs) 116 - else 117 - postInstallHooks+=(_qtRmQtOut) 118 - fi 119 - 40 + preFixupHooks+=(_qtModuleMultioutDevsPre) 41 + postFixupHooks+=(_qtModuleMultioutDevsPost) 120 42 fi
+1
pkgs/development/libraries/qt-5/5.5/qtbase/default.nix
··· 276 276 fixQtModuleCMakeConfig "Xml" 277 277 ''; 278 278 279 + inherit lndir; 279 280 setupHook = ./setup-hook.sh; 280 281 281 282 enableParallelBuilding = true;