qt5.qmakeHook: init, move from qtbase's setup hook
This commit is contained in:
parent
065a7515a7
commit
b857459bdb
@ -37,12 +37,10 @@ let
|
|||||||
inherit src;
|
inherit src;
|
||||||
|
|
||||||
propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
|
propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
|
||||||
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ self.fixQtModuleCMakeConfig ];
|
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ self.fixQtModuleCMakeConfig self.qmakeHook ];
|
||||||
|
|
||||||
NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
|
NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
|
||||||
dontAddPrefix = args.dontAddPrefix or true;
|
|
||||||
dontFixLibtool = args.dontFixLibtool or true;
|
dontFixLibtool = args.dontFixLibtool or true;
|
||||||
configureScript = args.configureScript or "qmake";
|
|
||||||
|
|
||||||
outputs = args.outputs or [ "dev" "out" ];
|
outputs = args.outputs or [ "dev" "out" ];
|
||||||
setOutputFlags = false;
|
setOutputFlags = false;
|
||||||
@ -109,6 +107,7 @@ let
|
|||||||
|
|
||||||
makeQtWrapper = makeSetupHook { deps = [ makeWrapper ]; } ./make-qt-wrapper.sh;
|
makeQtWrapper = makeSetupHook { deps = [ makeWrapper ]; } ./make-qt-wrapper.sh;
|
||||||
fixQtModuleCMakeConfig = makeSetupHook { } ./fix-qt-module-cmake-config.sh;
|
fixQtModuleCMakeConfig = makeSetupHook { } ./fix-qt-module-cmake-config.sh;
|
||||||
|
qmakeHook = makeSetupHook { substitutions = { qt_dev = qtbase.dev; lndir = pkgs.xorg.lndir; }; } ./qmake-hook.sh;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
120
pkgs/development/libraries/qt-5/5.4/qmake-hook.sh
Normal file
120
pkgs/development/libraries/qt-5/5.4/qmake-hook.sh
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
if [[ -z "$QMAKE" ]]; then
|
||||||
|
|
||||||
|
_qtLinkDependencyDir() {
|
||||||
|
@lndir@/bin/lndir -silent "$1/$2" "$qtOut/$2"
|
||||||
|
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
||||||
|
find "$1/$2" -printf "$2/%P\n" >> "$out/nix-support/qt-inputs"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_qtLinkModule() {
|
||||||
|
if [ -d "$1/mkspecs" ]; then
|
||||||
|
# $1 is a Qt module
|
||||||
|
_qtLinkDependencyDir "$1" mkspecs
|
||||||
|
|
||||||
|
for dir in bin include lib share; do
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
_qtPropagateRuntimeDependencies() {
|
||||||
|
for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
|
||||||
|
if [ -d "$1/$dir" ]; then
|
||||||
|
propagateOnce propagatedBuildInputs "$1"
|
||||||
|
propagateOnce propagatedUserEnvPkgs "$1"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
|
||||||
|
addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
|
||||||
|
addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
_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
|
||||||
|
# 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}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_qtMultioutDevs() {
|
||||||
|
# This is necessary whether the package is a Qt module or not
|
||||||
|
moveToOutput "mkspecs" "${!outputDev}"
|
||||||
|
}
|
||||||
|
|
||||||
|
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 _qtPropagateRuntimeDependencies)
|
||||||
|
# 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
|
||||||
|
|
||||||
|
preFixupHooks+=(_qtMultioutDevs)
|
||||||
|
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
||||||
|
postInstallHooks+=(_qtRmQmake _qtRmModules)
|
||||||
|
preFixupHooks+=(_qtMultioutModuleDevs)
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
@ -239,7 +239,6 @@ stdenv.mkDerivation {
|
|||||||
fixQtModuleCMakeConfig "Xml"
|
fixQtModuleCMakeConfig "Xml"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
inherit lndir;
|
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
@ -1,41 +1,3 @@
|
|||||||
if [[ -z "$QMAKE" ]]; then
|
|
||||||
|
|
||||||
_qtLinkDependencyDir() {
|
|
||||||
@lndir@/bin/lndir -silent "$1/$2" "$qtOut/$2"
|
|
||||||
if [[ -n "$NIX_QT_SUBMODULE" ]]; then
|
|
||||||
find "$1/$2" -printf "$2/%P\n" >> "$out/nix-support/qt-inputs"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtLinkModule() {
|
|
||||||
if [ -d "$1/mkspecs" ]; then
|
|
||||||
# $1 is a Qt module
|
|
||||||
_qtLinkDependencyDir "$1" mkspecs
|
|
||||||
|
|
||||||
for dir in bin include lib share; do
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
addToSearchPathOnceWithCustomDelimiter() {
|
addToSearchPathOnceWithCustomDelimiter() {
|
||||||
local delim="$1"
|
local delim="$1"
|
||||||
local search="$2"
|
local search="$2"
|
||||||
@ -43,11 +5,14 @@ addToSearchPathOnceWithCustomDelimiter() {
|
|||||||
local dirs
|
local dirs
|
||||||
local exported
|
local exported
|
||||||
IFS="$delim" read -a dirs <<< "${!search}"
|
IFS="$delim" read -a dirs <<< "${!search}"
|
||||||
|
local canonical
|
||||||
|
if canonical=$(readlink -e "$target"); then
|
||||||
for dir in ${dirs[@]}; do
|
for dir in ${dirs[@]}; do
|
||||||
if [ "z$dir" == "z$target" ]; then exported=1; fi
|
if [ "z$dir" == "z$canonical" ]; then exported=1; fi
|
||||||
done
|
done
|
||||||
if [ -z $exported ]; then
|
if [ -z $exported ]; then
|
||||||
eval "export ${search}=\"${!search}${!search:+$delim}$target\""
|
eval "export ${search}=\"${!search}${!search:+$delim}$canonical\""
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,76 +24,6 @@ propagateOnce() {
|
|||||||
addToSearchPathOnceWithCustomDelimiter ' ' "$@"
|
addToSearchPathOnceWithCustomDelimiter ' ' "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
_qtPropagateRuntimeDependencies() {
|
|
||||||
for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
|
|
||||||
if [ -d "$1/$dir" ]; then
|
|
||||||
propagateOnce propagatedBuildInputs "$1"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
|
|
||||||
addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
|
|
||||||
addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
|
|
||||||
}
|
|
||||||
|
|
||||||
_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
|
|
||||||
# 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}"
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtMultioutDevs() {
|
|
||||||
# This is necessary whether the package is a Qt module or not
|
|
||||||
moveToOutput "mkspecs" "${!outputDev}"
|
|
||||||
}
|
|
||||||
|
|
||||||
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 "@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 _qtPropagateRuntimeDependencies)
|
|
||||||
# Set PATH to find qmake first in a preConfigure hook
|
|
||||||
# It must run after all the envHooks!
|
|
||||||
preConfigureHooks+=(_qtSetQmakePath)
|
|
||||||
|
|
||||||
preFixupHooks+=(_qtMultioutDevs)
|
|
||||||
if [[ -n "$NIX_QT_SUBMODULE" ]]; then
|
|
||||||
postInstallHooks+=(_qtRmQmake _qtRmModules)
|
|
||||||
preFixupHooks+=(_qtMultioutModuleDevs)
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$NIX_QT_PIC" ]]; then
|
if [[ -z "$NIX_QT_PIC" ]]; then
|
||||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE${NIX_CFLAGS_COMPILE:+ }-fPIC"
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE${NIX_CFLAGS_COMPILE:+ }-fPIC"
|
||||||
export NIX_QT_PIC=1
|
export NIX_QT_PIC=1
|
||||||
|
@ -42,10 +42,9 @@ let
|
|||||||
inherit src;
|
inherit src;
|
||||||
|
|
||||||
propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
|
propagatedBuildInputs = args.qtInputs ++ (args.propagatedBuildInputs or []);
|
||||||
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ self.fixQtModuleCMakeConfig ];
|
nativeBuildInputs = (args.nativeBuildInputs or []) ++ [ self.fixQtModuleCMakeConfig self.qmakeHook ];
|
||||||
|
|
||||||
NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
|
NIX_QT_SUBMODULE = args.NIX_QT_SUBMODULE or true;
|
||||||
dontAddPrefix = args.dontAddPrefix or true;
|
|
||||||
dontFixLibtool = args.dontFixLibtool or true;
|
dontFixLibtool = args.dontFixLibtool or true;
|
||||||
configureScript = args.configureScript or "qmake";
|
configureScript = args.configureScript or "qmake";
|
||||||
|
|
||||||
@ -115,6 +114,7 @@ let
|
|||||||
|
|
||||||
makeQtWrapper = makeSetupHook { deps = [ makeWrapper ]; } ./make-qt-wrapper.sh;
|
makeQtWrapper = makeSetupHook { deps = [ makeWrapper ]; } ./make-qt-wrapper.sh;
|
||||||
fixQtModuleCMakeConfig = makeSetupHook { } ./fix-qt-module-cmake-config.sh;
|
fixQtModuleCMakeConfig = makeSetupHook { } ./fix-qt-module-cmake-config.sh;
|
||||||
|
qmakeHook = makeSetupHook { substitutions = { qt_dev = qtbase.dev; lndir = pkgs.xorg.lndir; }; } ./qmake-hook.sh;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
120
pkgs/development/libraries/qt-5/5.5/qmake-hook.sh
Normal file
120
pkgs/development/libraries/qt-5/5.5/qmake-hook.sh
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
if [[ -z "$QMAKE" ]]; then
|
||||||
|
|
||||||
|
_qtLinkDependencyDir() {
|
||||||
|
@lndir@/bin/lndir -silent "$1/$2" "$qtOut/$2"
|
||||||
|
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
||||||
|
find "$1/$2" -printf "$2/%P\n" >> "$out/nix-support/qt-inputs"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
_qtLinkModule() {
|
||||||
|
if [ -d "$1/mkspecs" ]; then
|
||||||
|
# $1 is a Qt module
|
||||||
|
_qtLinkDependencyDir "$1" mkspecs
|
||||||
|
|
||||||
|
for dir in bin include lib share; do
|
||||||
|
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"
|
||||||
|
}
|
||||||
|
|
||||||
|
_qtPropagateRuntimeDependencies() {
|
||||||
|
for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
|
||||||
|
if [ -d "$1/$dir" ]; then
|
||||||
|
propagateOnce propagatedBuildInputs "$1"
|
||||||
|
propagateOnce propagatedUserEnvPkgs "$1"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
|
||||||
|
addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
|
||||||
|
addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
|
||||||
|
}
|
||||||
|
|
||||||
|
_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
|
||||||
|
# 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}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_qtMultioutDevs() {
|
||||||
|
# This is necessary whether the package is a Qt module or not
|
||||||
|
moveToOutput "mkspecs" "${!outputDev}"
|
||||||
|
}
|
||||||
|
|
||||||
|
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 _qtPropagateRuntimeDependencies)
|
||||||
|
# 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
|
||||||
|
|
||||||
|
preFixupHooks+=(_qtMultioutDevs)
|
||||||
|
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
||||||
|
postInstallHooks+=(_qtRmQmake _qtRmModules)
|
||||||
|
preFixupHooks+=(_qtMultioutModuleDevs)
|
||||||
|
fi
|
||||||
|
|
||||||
|
fi
|
@ -254,7 +254,6 @@ stdenv.mkDerivation {
|
|||||||
fixQtModuleCMakeConfig "Xml"
|
fixQtModuleCMakeConfig "Xml"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
inherit lndir;
|
|
||||||
setupHook = ./setup-hook.sh;
|
setupHook = ./setup-hook.sh;
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
|
@ -1,41 +1,3 @@
|
|||||||
if [[ -z "$QMAKE" ]]; then
|
|
||||||
|
|
||||||
_qtLinkDependencyDir() {
|
|
||||||
@lndir@/bin/lndir -silent "$1/$2" "$qtOut/$2"
|
|
||||||
if [ -n "$NIX_QT_SUBMODULE" ]; then
|
|
||||||
find "$1/$2" -printf "$2/%P\n" >> "$out/nix-support/qt-inputs"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtLinkModule() {
|
|
||||||
if [ -d "$1/mkspecs" ]; then
|
|
||||||
# $1 is a Qt module
|
|
||||||
_qtLinkDependencyDir "$1" mkspecs
|
|
||||||
|
|
||||||
for dir in bin include lib share; do
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
addToSearchPathOnceWithCustomDelimiter() {
|
addToSearchPathOnceWithCustomDelimiter() {
|
||||||
local delim="$1"
|
local delim="$1"
|
||||||
local search="$2"
|
local search="$2"
|
||||||
@ -62,77 +24,6 @@ propagateOnce() {
|
|||||||
addToSearchPathOnceWithCustomDelimiter ' ' "$@"
|
addToSearchPathOnceWithCustomDelimiter ' ' "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
_qtPropagateRuntimeDependencies() {
|
|
||||||
for dir in "lib/qt5/plugins" "lib/qt5/qml" "lib/qt5/imports"; do
|
|
||||||
if [ -d "$1/$dir" ]; then
|
|
||||||
propagateOnce propagatedBuildInputs "$1"
|
|
||||||
propagateOnce propagatedUserEnvPkgs "$1"
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
addToSearchPathOnce QT_PLUGIN_PATH "$1/lib/qt5/plugins"
|
|
||||||
addToSearchPathOnce QML_IMPORT_PATH "$1/lib/qt5/imports"
|
|
||||||
addToSearchPathOnce QML2_IMPORT_PATH "$1/lib/qt5/qml"
|
|
||||||
}
|
|
||||||
|
|
||||||
_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
|
|
||||||
# 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}"
|
|
||||||
}
|
|
||||||
|
|
||||||
_qtMultioutDevs() {
|
|
||||||
# This is necessary whether the package is a Qt module or not
|
|
||||||
moveToOutput "mkspecs" "${!outputDev}"
|
|
||||||
}
|
|
||||||
|
|
||||||
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 "@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 _qtPropagateRuntimeDependencies)
|
|
||||||
# Set PATH to find qmake first in a preConfigure hook
|
|
||||||
# It must run after all the envHooks!
|
|
||||||
preConfigureHooks+=(_qtSetQmakePath)
|
|
||||||
|
|
||||||
preFixupHooks+=(_qtMultioutDevs)
|
|
||||||
if [[ -n "$NIX_QT_SUBMODULE" ]]; then
|
|
||||||
postInstallHooks+=(_qtRmQmake _qtRmModules)
|
|
||||||
preFixupHooks+=(_qtMultioutModuleDevs)
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -z "$NIX_QT_PIC" ]]; then
|
if [[ -z "$NIX_QT_PIC" ]]; then
|
||||||
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE${NIX_CFLAGS_COMPILE:+ }-fPIC"
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE${NIX_CFLAGS_COMPILE:+ }-fPIC"
|
||||||
export NIX_QT_PIC=1
|
export NIX_QT_PIC=1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user