qt55.qtbase: fix setup hook and QMake hook
This commit is contained in:
parent
5c837e952d
commit
343415e02e
@ -1 +0,0 @@
|
|||||||
../5.6/make-qt-wrapper.sh
|
|
36
pkgs/development/libraries/qt-5/5.5/make-qt-wrapper.sh
Normal file
36
pkgs/development/libraries/qt-5/5.5/make-qt-wrapper.sh
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
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" \
|
||||||
|
--prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
|
||||||
|
--prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
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" \
|
||||||
|
--prefix XDG_DATA_DIRS : "$RUNTIME_XDG_DATA_DIRS" \
|
||||||
|
--prefix XDG_CONFIG_DIRS : "$RUNTIME_XDG_CONFIG_DIRS" \
|
||||||
|
"$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
_makeQtWrapperSetup() {
|
||||||
|
# cannot use addToSearchPath because these directories may not exist yet
|
||||||
|
export QT_PLUGIN_PATH="$QT_PLUGIN_PATH${QT_PLUGIN_PATH:+:}${!outputLib}/lib/qt5/plugins"
|
||||||
|
export QML_IMPORT_PATH="$QML_IMPORT_PATH${QML_IMPORT_PATH:+:}${!outputLib}/lib/qt5/imports"
|
||||||
|
export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/lib/qt5/qml"
|
||||||
|
export RUNTIME_XDG_DATA_DIRS="$XDG_DATA_DIRS${XDG_DATA_DIRS:+:}${!outputBin}/share"
|
||||||
|
export RUNTIME_XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS${XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
|
||||||
|
}
|
||||||
|
|
||||||
|
prePhases+=(_makeQtWrapperSetup)
|
@ -1,50 +1,16 @@
|
|||||||
if [[ -z "$QMAKE" ]]; then
|
qmakeConfigurePhase() {
|
||||||
|
runHook preConfigure
|
||||||
|
|
||||||
_qtLinkDependencyDir() {
|
qmake PREFIX=$out $qmakeFlags
|
||||||
@lndir@/bin/lndir -silent "$1/$2" "$qtOut/$2"
|
|
||||||
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
runHook postConfigure
|
||||||
find "$1/$2" -printf "$2/%P\n" >> "$out/nix-support/qt-inputs"
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_qtLinkModule() {
|
if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
|
||||||
if [ -d "$1/mkspecs" ]; then
|
configurePhase=qmakeConfigurePhase
|
||||||
# $1 is a Qt module
|
fi
|
||||||
_qtLinkDependencyDir "$1" mkspecs
|
|
||||||
|
|
||||||
for dir in bin include lib share; do
|
_qtModuleMultioutDevsPre() {
|
||||||
if [ -d "$1/$dir" ]; then
|
|
||||||
_qtLinkDependencyDir "$1" "$dir"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtRmModules() {
|
|
||||||
cat "$out/nix-support/qt-inputs" | while read file; do
|
|
||||||
if [ -h "$out/$file" ]; then
|
|
||||||
rm "$out/$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
cat "$out/nix-support/qt-inputs" | while read file; do
|
|
||||||
if [ -d "$out/$file" ]; then
|
|
||||||
rmdir --ignore-fail-on-non-empty -p "$out/$file"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
rm "$out/nix-support/qt-inputs"
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtRmQmake() {
|
|
||||||
rm "$qtOut/bin/qmake" "$qtOut/bin/qt.conf"
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtSetQmakePath() {
|
|
||||||
export PATH="$qtOut/bin${PATH:+:}$PATH"
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtMultioutModuleDevs() {
|
|
||||||
# We cannot simply set these paths in configureFlags because libQtCore retains
|
# We cannot simply set these paths in configureFlags because libQtCore retains
|
||||||
# references to the paths it was built with.
|
# references to the paths it was built with.
|
||||||
moveToOutput "bin" "${!outputDev}"
|
moveToOutput "bin" "${!outputDev}"
|
||||||
@ -53,12 +19,14 @@ _qtMultioutModuleDevs() {
|
|||||||
# The destination directory must exist or moveToOutput will do nothing
|
# The destination directory must exist or moveToOutput will do nothing
|
||||||
mkdir -p "${!outputDev}/share"
|
mkdir -p "${!outputDev}/share"
|
||||||
moveToOutput "share/doc" "${!outputDev}"
|
moveToOutput "share/doc" "${!outputDev}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_qtModuleMultioutDevsPost() {
|
||||||
# Move libtool archives and qmake project files to $dev/lib
|
# Move libtool archives and qmake project files to $dev/lib
|
||||||
if [ "z${!outputLib}" != "z${!outputDev}" ]; then
|
if [ "z${!outputLib}" != "z${!outputDev}" ]; then
|
||||||
pushd "${!outputLib}"
|
pushd "${!outputLib}"
|
||||||
if [ -d "lib" ]; then
|
if [ -d "lib" ]; then
|
||||||
find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' -print0 \) | \
|
find lib \( -name '*.a' -o -name '*.la' -o -name '*.prl' \) -print0 | \
|
||||||
while read -r -d $'\0' file; do
|
while read -r -d $'\0' file; do
|
||||||
mkdir -p "${!outputDev}/$(dirname "$file")"
|
mkdir -p "${!outputDev}/$(dirname "$file")"
|
||||||
mv "${!outputLib}/$file" "${!outputDev}/$file"
|
mv "${!outputLib}/$file" "${!outputDev}/$file"
|
||||||
@ -68,53 +36,7 @@ _qtMultioutModuleDevs() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_qtRmQtOut() {
|
|
||||||
rm -fr "$qtOut"
|
|
||||||
}
|
|
||||||
|
|
||||||
qmakeConfigurePhase() {
|
|
||||||
runHook preConfigure
|
|
||||||
|
|
||||||
qmake PREFIX=$out $qmakeFlags
|
|
||||||
|
|
||||||
runHook postConfigure
|
|
||||||
}
|
|
||||||
|
|
||||||
qtOut=""
|
|
||||||
if [[ -z "$NIX_QT_SUBMODULE" ]]; then
|
|
||||||
qtOut=`mktemp -d`
|
|
||||||
else
|
|
||||||
qtOut=$out
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p "$qtOut/bin" "$qtOut/mkspecs" "$qtOut/include" "$qtOut/nix-support" "$qtOut/lib" "$qtOut/share"
|
|
||||||
|
|
||||||
cp "@qt_dev@/bin/qmake" "$qtOut/bin"
|
|
||||||
cat >"$qtOut/bin/qt.conf" <<EOF
|
|
||||||
[Paths]
|
|
||||||
Prefix = $qtOut
|
|
||||||
Plugins = lib/qt5/plugins
|
|
||||||
Imports = lib/qt5/imports
|
|
||||||
Qml2Imports = lib/qt5/qml
|
|
||||||
Documentation = share/doc/qt5
|
|
||||||
EOF
|
|
||||||
|
|
||||||
export QMAKE="$qtOut/bin/qmake"
|
|
||||||
|
|
||||||
envHooks+=(_qtLinkModule)
|
|
||||||
# Set PATH to find qmake first in a preConfigure hook
|
|
||||||
# It must run after all the envHooks!
|
|
||||||
postHooks+=(_qtSetQmakePath)
|
|
||||||
|
|
||||||
if [ -z "$dontUseQmakeConfigure" -a -z "$configurePhase" ]; then
|
|
||||||
configurePhase=qmakeConfigurePhase
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
||||||
postInstallHooks+=(_qtRmQmake _qtRmModules)
|
preFixupHooks+=(_qtModuleMultioutDevsPre)
|
||||||
preFixupHooks+=(_qtMultioutModuleDevs)
|
postFixupHooks+=(_qtModuleMultioutDevsPost)
|
||||||
else
|
|
||||||
postInstallHooks+=(_qtRmQtOut)
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
@ -276,6 +276,7 @@ stdenv.mkDerivation {
|
|||||||
fixQtModuleCMakeConfig "Xml"
|
fixQtModuleCMakeConfig "Xml"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
inherit lndir;
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user