qt5.makeQtWrapper: do not inherit Qt search paths

This commit is contained in:
Thomas Tuegel 2016-07-16 08:59:43 -05:00
parent b2cf5aabb0
commit 78e7f44488
3 changed files with 31 additions and 61 deletions

View File

@ -1,22 +1,31 @@
_ecmSetXdgDirs() {
addToSearchPathOnce XDG_DATA_DIRS "$1/share"
addToSearchPathOnce XDG_CONFIG_DIRS "$1/etc/xdg"
addToSearchPathOnce NIX_WRAP_XDG_CONFIG_DIRS "$1/etc/xdg"
addToSearchPathOnce RUNTIME_XDG_CONFIG_DIRS "$1/etc/xdg"
}
_ecmSharePaths=( \
"appdata" \
"applications" \
"config.cfg" \
"dbus-1" \
"desktop-directories" \
"doc" \
"icons" \
"info" \
"kconf_update" \
"kservices5" \
"kservicetypes5" \
"knotifications5" \
"applications" \
"desktop-directories" \
"kxmlgui5" \
"locale" \
"man" \
"mime" \
"dbus-1" \
"interfaces" \
"services" \
"system-services" )
"polkit-1" \
"sounds" \
"templates" \
"wallpapers" \
)
_ecmPropagateNative() {
for dir in ${_ecmSharePaths[@]}; do
@ -24,7 +33,7 @@ _ecmPropagateNative() {
propagateOnce propagatedNativeBuildInputs "$1"
if [ -z "$crossConfig" ]; then
propagateOnce propagatedUserEnvPkgs "$1"
addToSearchPathOnce NIX_WRAP_XDG_DATA_DIRS "$1/share"
addToSearchPathOnce RUNTIME_XDG_DATA_DIRS "$1/share"
fi
break
fi
@ -38,7 +47,7 @@ _ecmPropagate() {
if [ -d "$1/share/$dir" ]; then
propagateOnce propagatedBuildInputs "$1"
propagateOnce propagatedUserEnvPkgs "$1"
addToSearchPathOnce NIX_WRAP_XDG_DATA_DIRS "$1/share"
addToSearchPathOnce RUNTIME_XDG_DATA_DIRS "$1/share"
break
fi
done

View File

@ -1,38 +0,0 @@
wrapQtProgram() {
local prog="$1"
shift
wrapProgram "$prog" \
--prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
--prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
--prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
--prefix XDG_CONFIG_DIRS : "$NIX_WRAP_XDG_CONFIG_DIRS" \
--prefix XDG_DATA_DIRS : "$NIX_WRAP_XDG_DATA_DIRS" \
"$@"
}
makeQtWrapper() {
local old="$1"
local new="$2"
shift
shift
makeWrapper "$old" "$new" \
--prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
--prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
--prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
--prefix XDG_CONFIG_DIRS : "$NIX_WRAP_XDG_CONFIG_DIRS" \
--prefix XDG_DATA_DIRS : "$NIX_WRAP_XDG_DATA_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 XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS${XDG_CONFIG_DIRS:+:}${!outputLib}/etc/xdg"
export XDG_DATA_DIRS="$XDG_DATA_DIRS${XDG_DATA_DIRS:+:}${!outputLib}/share"
export NIX_WRAP_XDG_CONFIG_DIRS="$NIX_WRAP_XDG_CONFIG_DIRS${NIX_WRAP_XDG_CONFIG_DIRS:+:}${!outputLib}/etc/xdg"
export NIX_WRAP_XDG_DATA_DIRS="$NIX_WRAP_XDG_DATA_DIRS${NIX_WRAP_XDG_DATA_DIRS:+:}${!outputLib}/share"
}
prePhases+=(_makeQtWrapperSetup)

View File

@ -0,0 +1 @@
../5.6/make-qt-wrapper.sh

View File

@ -2,11 +2,11 @@ wrapQtProgram() {
local prog="$1"
shift
wrapProgram "$prog" \
--prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
--prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
--prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
--prefix XDG_CONFIG_DIRS : "$NIX_WRAP_XDG_CONFIG_DIRS" \
--prefix XDG_DATA_DIRS : "$NIX_WRAP_XDG_DATA_DIRS" \
--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" \
"$@"
}
@ -16,11 +16,11 @@ makeQtWrapper() {
shift
shift
makeWrapper "$old" "$new" \
--prefix QT_PLUGIN_PATH : "$QT_PLUGIN_PATH" \
--prefix QML_IMPORT_PATH : "$QML_IMPORT_PATH" \
--prefix QML2_IMPORT_PATH : "$QML2_IMPORT_PATH" \
--prefix XDG_CONFIG_DIRS : "$NIX_WRAP_XDG_CONFIG_DIRS" \
--prefix XDG_DATA_DIRS : "$NIX_WRAP_XDG_DATA_DIRS" \
--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" \
"$@"
}
@ -29,10 +29,8 @@ _makeQtWrapperSetup() {
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 XDG_CONFIG_DIRS="$XDG_CONFIG_DIRS${XDG_CONFIG_DIRS:+:}${!outputLib}/etc/xdg"
export XDG_DATA_DIRS="$XDG_DATA_DIRS${XDG_DATA_DIRS:+:}${!outputLib}/share"
export NIX_WRAP_XDG_CONFIG_DIRS="$NIX_WRAP_XDG_CONFIG_DIRS${NIX_WRAP_XDG_CONFIG_DIRS:+:}${!outputLib}/etc/xdg"
export NIX_WRAP_XDG_DATA_DIRS="$NIX_WRAP_XDG_DATA_DIRS${NIX_WRAP_XDG_DATA_DIRS:+:}${!outputLib}/share"
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)