From d185d191fe22d041b227fcc1db2e783d47544682 Mon Sep 17 00:00:00 2001 From: Mickey Rose Date: Sat, 17 Aug 2019 22:44:44 +0200 Subject: [PATCH] another take on guessing BOOST_TOOLSET guess_compiler_name $CXX Function guess_compiler_name prints the "basename" of its first argument (or second argument if the first is ccache). Passing non-quoted $CXX takes care of word splitting. The "basename" is extracted with simple shell parameter expansion. It differs from how POSIX basename command works, but in good ways: guess_compiler_name x/ # prints '' command basename x/ # prints 'x' guess_compiler_name '' # prints '' command basename '' # ?? POSIX leaves unspecified whether the resulting string is '.' or ''. guess_compiler_name # prints '' command basename # error: missing operand Parameter expansion just works, with basename command we would need to check that the compiler variable is set and non-null. --- scripts/boost/1.61.0/base.sh | 13 ++++++++++--- scripts/boost/1.62.0/base.sh | 11 +++++++++-- scripts/boost/1.63.0/base.sh | 11 +++++++++-- scripts/boost/1.64.0/base.sh | 11 +++++++++-- scripts/boost/1.65.1/base.sh | 11 +++++++++-- scripts/boost/1.66.0/base.sh | 11 +++++++++-- scripts/boost/1.67.0/base.sh | 11 +++++++++-- 7 files changed, 64 insertions(+), 15 deletions(-) diff --git a/scripts/boost/1.61.0/base.sh b/scripts/boost/1.61.0/base.sh index 543f33d55..720d091cf 100644 --- a/scripts/boost/1.61.0/base.sh +++ b/scripts/boost/1.61.0/base.sh @@ -1,10 +1,17 @@ #!/usr/bin/env bash -# NOTE: use the ./util/new_boost.sh script to create new versions +# NOTE: use the ./utils/new_boost.sh script to create new versions + +function guess_compiler_name() { + case $1 in + ccache| */ccache) shift;; + esac + printf '%s' "${1##*/}" +} export MASON_VERSION=1.61.0 export BOOST_VERSION=${MASON_VERSION//./_} -export BOOST_TOOLSET=$(CC=${CC#ccache }; basename -- ${CC%% *}) -export BOOST_TOOLSET_CXX=$(CXX=${CXX#ccache }; basename -- ${CXX%% *}) +export BOOST_TOOLSET=$(guess_compiler_name $CC) +export BOOST_TOOLSET_CXX=$(guess_compiler_name $CXX) export BOOST_ARCH="x86" export BOOST_SHASUM=0a72c541e468d76a957adc14e54688dd695d566f diff --git a/scripts/boost/1.62.0/base.sh b/scripts/boost/1.62.0/base.sh index c40536be1..b304e13b5 100644 --- a/scripts/boost/1.62.0/base.sh +++ b/scripts/boost/1.62.0/base.sh @@ -2,10 +2,17 @@ # NOTE: use the ./utils/new_boost.sh script to create new versions +function guess_compiler_name() { + case $1 in + ccache| */ccache) shift;; + esac + printf '%s' "${1##*/}" +} + export MASON_VERSION=1.62.0 export BOOST_VERSION=${MASON_VERSION//./_} -export BOOST_TOOLSET=$(CC=${CC#ccache }; basename -- ${CC%% *}) -export BOOST_TOOLSET_CXX=$(CXX=${CXX#ccache }; basename -- ${CXX%% *}) +export BOOST_TOOLSET=$(guess_compiler_name $CC) +export BOOST_TOOLSET_CXX=$(guess_compiler_name $CXX) export BOOST_ARCH="x86" export BOOST_SHASUM=f4151eec3e9394146b7bebcb17b83149de0a6c23 # special override to ensure each library shares the cached download diff --git a/scripts/boost/1.63.0/base.sh b/scripts/boost/1.63.0/base.sh index 3790c7e97..529f1a51a 100644 --- a/scripts/boost/1.63.0/base.sh +++ b/scripts/boost/1.63.0/base.sh @@ -2,10 +2,17 @@ # NOTE: use the ./utils/new_boost.sh script to create new versions +function guess_compiler_name() { + case $1 in + ccache| */ccache) shift;; + esac + printf '%s' "${1##*/}" +} + export MASON_VERSION=1.63.0 export BOOST_VERSION=${MASON_VERSION//./_} -export BOOST_TOOLSET=$(CC=${CC#ccache }; basename -- ${CC%% *}) -export BOOST_TOOLSET_CXX=$(CXX=${CXX#ccache }; basename -- ${CXX%% *}) +export BOOST_TOOLSET=$(guess_compiler_name $CC) +export BOOST_TOOLSET_CXX=$(guess_compiler_name $CXX) export BOOST_ARCH="x86" export BOOST_SHASUM=5c5cf0fd35a5950ed9e00ba54153df47747803f9 # special override to ensure each library shares the cached download diff --git a/scripts/boost/1.64.0/base.sh b/scripts/boost/1.64.0/base.sh index f563660ac..6232e83f6 100644 --- a/scripts/boost/1.64.0/base.sh +++ b/scripts/boost/1.64.0/base.sh @@ -2,10 +2,17 @@ # NOTE: use the ./utils/new_boost.sh script to create new versions +function guess_compiler_name() { + case $1 in + ccache| */ccache) shift;; + esac + printf '%s' "${1##*/}" +} + export MASON_VERSION=1.64.0 export BOOST_VERSION=${MASON_VERSION//./_} -export BOOST_TOOLSET=$(CC=${CC#ccache }; basename -- ${CC%% *}) -export BOOST_TOOLSET_CXX=$(CXX=${CXX#ccache }; basename -- ${CXX%% *}) +export BOOST_TOOLSET=$(guess_compiler_name $CC) +export BOOST_TOOLSET_CXX=$(guess_compiler_name $CXX) export BOOST_ARCH="x86" export BOOST_SHASUM=6e4dad39f14937af73ace20d2279e2468aad14d8 # special override to ensure each library shares the cached download diff --git a/scripts/boost/1.65.1/base.sh b/scripts/boost/1.65.1/base.sh index 725bbaa37..600205f6c 100644 --- a/scripts/boost/1.65.1/base.sh +++ b/scripts/boost/1.65.1/base.sh @@ -2,10 +2,17 @@ # NOTE: use the ./utils/new_boost.sh script to create new versions +function guess_compiler_name() { + case $1 in + ccache| */ccache) shift;; + esac + printf '%s' "${1##*/}" +} + export MASON_VERSION=1.65.1 export BOOST_VERSION=${MASON_VERSION//./_} -export BOOST_TOOLSET=$(CC=${CC#ccache }; basename -- ${CC%% *}) -export BOOST_TOOLSET_CXX=$(CXX=${CXX#ccache }; basename -- ${CXX%% *}) +export BOOST_TOOLSET=$(guess_compiler_name $CC) +export BOOST_TOOLSET_CXX=$(guess_compiler_name $CXX) export BOOST_ARCH="x86" export BOOST_SHASUM=094a03dd6f07e740719b944cfe01a278f5326315 # special override to ensure each library shares the cached download diff --git a/scripts/boost/1.66.0/base.sh b/scripts/boost/1.66.0/base.sh index 5d1f034fc..86f9280f3 100644 --- a/scripts/boost/1.66.0/base.sh +++ b/scripts/boost/1.66.0/base.sh @@ -2,10 +2,17 @@ # NOTE: use the ./utils/new_boost.sh script to create new versions +function guess_compiler_name() { + case $1 in + ccache| */ccache) shift;; + esac + printf '%s' "${1##*/}" +} + export MASON_VERSION=1.66.0 export BOOST_VERSION=${MASON_VERSION//./_} -export BOOST_TOOLSET=$(CC=${CC#ccache }; basename -- ${CC%% *}) -export BOOST_TOOLSET_CXX=$(CXX=${CXX#ccache }; basename -- ${CXX%% *}) +export BOOST_TOOLSET=$(guess_compiler_name $CC) +export BOOST_TOOLSET_CXX=$(guess_compiler_name $CXX) export BOOST_ARCH="x86" export BOOST_SHASUM=5552748d2f0aede9ad1dfbb7f16832bbb054ca4d # special override to ensure each library shares the cached download diff --git a/scripts/boost/1.67.0/base.sh b/scripts/boost/1.67.0/base.sh index 0d4080605..31d315d22 100644 --- a/scripts/boost/1.67.0/base.sh +++ b/scripts/boost/1.67.0/base.sh @@ -2,10 +2,17 @@ # NOTE: use the ./utils/new_boost.sh script to create new versions +function guess_compiler_name() { + case $1 in + ccache| */ccache) shift;; + esac + printf '%s' "${1##*/}" +} + export MASON_VERSION=1.67.0 export BOOST_VERSION=${MASON_VERSION//./_} -export BOOST_TOOLSET=$(CC=${CC#ccache }; basename -- ${CC%% *}) -export BOOST_TOOLSET_CXX=$(CXX=${CXX#ccache }; basename -- ${CXX%% *}) +export BOOST_TOOLSET=$(guess_compiler_name $CC) +export BOOST_TOOLSET_CXX=$(guess_compiler_name $CXX) export BOOST_ARCH="x86" export BOOST_SHASUM=6dde6a5f874a5dfa75865e4430ff9248a43cab07 # special override to ensure each library shares the cached download