extra-cmake-modules: add addToSearchPathOnce

This commit is contained in:
Thomas Tuegel 2016-01-25 09:37:16 -06:00
parent ae75c88808
commit 7f43f08930

View file

@ -1,26 +1,36 @@
addMimePkg() { _propagateMimeTypes() {
local propagated if [ -d "$1/share/mime" ]; then
propagateOnce propagatedUserEnvPkgs "$1"
addToSearchPathOnce XDG_DATA_DIRS "$1/share"
fi
}
if [[ -d "$1/share/mime" ]]; then addToSearchPathOnceWithCustomDelimiter() {
propagated= local delim="$1"
for pkg in $propagatedBuildInputs; do local search="$2"
if [[ "z$pkg" == "z$1" ]]; then local target="$3"
propagated=1 local dirs
fi local exported
IFS="$delim" read -a dirs <<< "${!search}"
for dir in ${dirs[@]}; do
if [ "z$dir" == "z$target" ]; then exported=1; fi
done done
if [[ -z $propagated ]]; then if [ -z $exported ]; then
propagatedBuildInputs="$propagatedBuildInputs $1" eval "export ${search}=\"${!search}${!search:+$delim}$target\""
fi fi
}
propagated= addToSearchPathOnce() {
for pkg in $propagatedUserEnvPkgs; do addToSearchPathOnceWithCustomDelimiter ':' "$@"
if [[ "z$pkg" == "z$1" ]]; then }
propagated=1
fi propagateOnce() {
done addToSearchPathOnceWithCustomDelimiter ' ' "$@"
if [[ -z $propagated ]]; then }
propagatedUserEnvPkgs="$propagatedUserEnvPkgs $1"
fi _exportLocales() {
if [[ -d "$1/share/locale" ]]; then
addToSearchPathOnce XDG_DATA_DIRS "$1/share"
fi fi
} }
@ -67,5 +77,5 @@ _ecmConfig() {
cmakeFlags+=" -DKDE_INSTALL_AUTOSTARTDIR=${!outputLib}/etc/xdg/autostart" cmakeFlags+=" -DKDE_INSTALL_AUTOSTARTDIR=${!outputLib}/etc/xdg/autostart"
} }
envHooks+=(addMimePkg) envHooks+=(_propagateMimeTypes _exportLocales)
preConfigureHooks+=(_ecmConfig) preConfigureHooks+=(_ecmConfig)