mirror of
https://github.com/FirestormViewer/fs-build-variables.git
synced 2026-08-14 00:57:58 +00:00
* Fix conveinvence script platform check for msys shell on windows * Introduce LL_BUILD_DARWIN_DEPLOY_TARGET for use in build tools that accept an explicit osx platform target
58 lines
1.6 KiB
Plaintext
58 lines
1.6 KiB
Plaintext
# Bring in the functions from the 'functions' script in the same directory as
|
|
# this script. Beware: since this script is itself sourced, its name is NOT in
|
|
# $0, but rather in $BASH_SOURCE!
|
|
d="$(dirname "$BASH_SOURCE")"
|
|
source "$d/functions"
|
|
|
|
# Now the 'variables' script
|
|
source "$d/variables"
|
|
|
|
# Enumerate the known universe of buildtypes and suffixes.
|
|
# Alternatively we could trawl the output of 'set' for variables whose name
|
|
# matches a regexp, but this way feels more predictable.
|
|
T=(BASE RELEASE RELWITHDEBINFO DEBUG)
|
|
X=(_MACROS _SWITCHES "")
|
|
|
|
case "$OSTYPE" in
|
|
cygwin | msys)
|
|
p="WINDOWS"
|
|
;;
|
|
darwin*)
|
|
p="DARWIN"
|
|
;;
|
|
linux*)
|
|
p="LINUX"
|
|
;;
|
|
*)
|
|
echo "Unrecognized platform $OSTYPE" 1>&2
|
|
exit 2
|
|
;;
|
|
esac
|
|
|
|
# make aliases for all LL_BUILD_{platform}_{buildtype}{suffix}
|
|
# variables that eliminate the {platform} part:
|
|
# LL_BUILD_{buildtype}{suffix}
|
|
# e.g. LL_BUILD_RELEASE has Release switches for current platform
|
|
for t in "${T[@]}"
|
|
do for x in "${X[@]}"
|
|
do eval LL_BUILD_$t$x=\$LL_BUILD_${p}_$t$x
|
|
done
|
|
done
|
|
|
|
# further, if $1 is passed as a buildtype (Release, RelWithDebInfo, Debug),
|
|
# make aliases that eliminate the {buildtype} part: just
|
|
# LL_BUILD{suffix}
|
|
# e.g. if we assume 'source convenience Release', then
|
|
# LL_BUILD has Release switches for current platform
|
|
if [ -n "${1:-}" ]
|
|
then # uppercase the buildtype so that's not on our caller
|
|
t="$(toupper "$1")"
|
|
for x in "${X[@]}"
|
|
do eval LL_BUILD$x=\$LL_BUILD_$t$x
|
|
done
|
|
fi
|
|
|
|
# Since this script is designed to be sourced, explicitly delete temporary
|
|
# variables.
|
|
unset d p T X t x
|