diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/include/common.sh | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/scripts/include/common.sh b/scripts/include/common.sh index d57879b..6c2a7e7 100644 --- a/scripts/include/common.sh +++ b/scripts/include/common.sh @@ -244,44 +244,52 @@ function run_switch_branch { } function repack_paths { - if [[ "$1" == "" ]]; then + envvar="$1" + if [[ "$2" != "" ]]; then + envvar="$2" + fi + if [[ "$envvar" == "" ]]; then return fi IFS=":" packedpaths="" - for var in $1 + for var in $envvar do packedpaths="${packedpaths}${bindir}/$var:" done unset IFS - echo "export $2=\"${packedpaths}\$$2\"" >>"${envfile}" + echo "export $3=\"${packedpaths}\$$3\"" >>"${envfile}" check_error $? } function repack_flags { - if [[ "$1" == "" ]]; then + envvar="$1" + if [[ "$2" != "" ]]; then + envvar="$2" + fi + if [[ "$envvar" == "" ]]; then return fi IFS=":" packedpaths="" - for var in $1 + for var in $envvar do - packedpaths="${packedpaths}${3}${bindir}/$var " + packedpaths="${packedpaths}${4}${bindir}/$var " done unset IFS - echo "export $2=\"${packedpaths}\$$2\"" >>"${envfile}" + echo "export $3=\"${packedpaths}\$$3\"" >>"${envfile}" check_error $? } function package_use { echo "package_use" - repack_paths "$ENV_PATH" "PATH" - repack_paths "$ENV_LD_LIBRARY_PATH" "LD_LIBRARY_PATH" - repack_paths "$ENV_PKG_CONFIG_PATH" "PKG_CONFIG_PATH" - repack_paths "$ENV_MANPATH" "MANPATH" - repack_paths "$ENV_ACLOCAL_PATH" "ACLOCAL_PATH" - repack_flags "$ENV_LDFLAGS_PATH" "LDFLAGS" "-L" - repack_flags "$ENV_CPPFLAGS_PATH" "CPPFLAGS" "-I" + repack_paths "$ENV_PATH" "$OVERRIDE_ENV_PATH" "PATH" + repack_paths "$ENV_LD_LIBRARY_PATH" "$OVERRIDE_ENV_LD_LIBRARY_PATH" "LD_LIBRARY_PATH" + repack_paths "$ENV_PKG_CONFIG_PATH" "$OVERRIDE_ENV_PKG_CONFIG_PATH" "PKG_CONFIG_PATH" + repack_paths "$ENV_MANPATH" "$OVERRIDE_ENV_MANPATH" "MANPATH" + repack_paths "$ENV_ACLOCAL_PATH" "$OVERRIDE_ENV_ACLOCAL_PATH" "ACLOCAL_PATH" + repack_flags "$ENV_LDFLAGS_PATH" "$OVERRIDE_ENV_LDFLAGS_PATH" "LDFLAGS" "-L" + repack_flags "$ENV_CPPFLAGS_PATH" "$OVERRIDE_ENV_CPPFLAGS_PATH" "CPPFLAGS" "-I" } function common_use_package { |