forked from mirrors/nixpkgs
3f3d33a078
Using a distinct prefix for plugins and QML libraries allows multiple Qt 5 minor versions to coexist in the same environment.
36 lines
1.3 KiB
Bash
36 lines
1.3 KiB
Bash
wrapQtProgram() {
|
|
local prog="$1"
|
|
shift
|
|
wrapProgram "$prog" \
|
|
--set QT_PLUGIN_PATH "$QT_PLUGIN_PATH" \
|
|
--set QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
|
|
--set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
|
|
--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 QML2_IMPORT_PATH "$QML2_IMPORT_PATH" \
|
|
--set DYLD_FRAMEWORK_PATH "/System/Library/Frameworks" \
|
|
--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}/$qtPluginPrefix"
|
|
export QML2_IMPORT_PATH="$QML2_IMPORT_PATH${QML2_IMPORT_PATH:+:}${!outputLib}/$qtQmlPrefix"
|
|
export RUNTIME_XDG_DATA_DIRS="$RUNTIME_XDG_DATA_DIRS${RUNTIME_XDG_DATA_DIRS:+:}${!outputBin}/share"
|
|
export RUNTIME_XDG_CONFIG_DIRS="$RUNTIME_XDG_CONFIG_DIRS${RUNTIME_XDG_CONFIG_DIRS:+:}${!outputBin}/etc/xdg"
|
|
}
|
|
|
|
prePhases+=(_makeQtWrapperSetup)
|