1.1 --- a/scripts/functions Mon May 25 20:27:14 2009 +0000
1.2 +++ b/scripts/functions Wed May 27 21:07:37 2009 +0000
1.3 @@ -265,6 +265,36 @@
1.4 yes "$1" || true
1.5 }
1.6
1.7 +# Add the specified directory to LD_LIBRARY_PATH, and export it
1.8 +# If the specified patch is already present, just export
1.9 +# $1: path to add
1.10 +# $2: add as 'first' or 'last' path, 'first' is assumed if $2 is empty
1.11 +# Usage CT_SetLibPath /some/where/lib [first|last]
1.12 +CT_SetLibPath() {
1.13 + local path="$1"
1.14 + local pos="$2"
1.15 +
1.16 + case ":${LD_LIBRARY_PATH}:" in
1.17 + *:"${path}":*) ;;
1.18 + *) case "${pos}" in
1.19 + last)
1.20 + CT_DoLog DEBUG "Adding '${path}' at end of LD_LIBRARY_PATH"
1.21 + LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}${path}"
1.22 + ;;
1.23 + first|"")
1.24 + CT_DoLog DEBUG "Adding '${path}' at start of LD_LIBRARY_PATH"
1.25 + LD_LIBRARY_PATH="${path}${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}"
1.26 + ;;
1.27 + *)
1.28 + CT_Abort "Incorrect position '${pos}' to add '${path}' to LD_LIBRARY_PATH"
1.29 + ;;
1.30 + esac
1.31 + ;;
1.32 + esac
1.33 + CT_DoLog DEBUG "==> LD_LIBRARY_PATH='${LD_LIBRARY_PATH}'"
1.34 + export LD_LIBRARY_PATH
1.35 +}
1.36 +
1.37 # Get the file name extension of a component
1.38 # Usage: CT_GetFileExtension <component_name-component_version> [extension]
1.39 # If found, echoes the extension to stdout