diff --git a/bin/bench.sh b/bin/bench.sh index 832cbf87..fa3c3899 100755 --- a/bin/bench.sh +++ b/bin/bench.sh @@ -17,6 +17,7 @@ print_help () { echo " [--quick]" echo " [--raw]" echo " [--dev-build]" + echo " [--with-compiler ]" echo " [--cabal-build-options ]" echo " [--rtsopts ]" echo " [--compare] [--base ] [--candidate ]" @@ -297,6 +298,7 @@ do --fields) shift; FIELDS=$1; shift ;; --base) shift; BASE=$1; shift ;; --candidate) shift; CANDIDATE=$1; shift ;; + --with-compiler) shift; CABAL_WITH_COMPILER=$1; shift ;; --cabal-build-flags) shift; CABAL_BUILD_OPTIONS+=$1; shift ;; --cabal-build-options) shift; CABAL_BUILD_OPTIONS+=$1; shift ;; --rtsopts) shift; RTS_OPTIONS=$1; shift ;; @@ -317,6 +319,8 @@ do done GAUGE_ARGS=$* +set_derived_vars + #----------------------------------------------------------------------------- # Determine targets #----------------------------------------------------------------------------- diff --git a/bin/build-lib.sh b/bin/build-lib.sh index 332808ac..88660b44 100644 --- a/bin/build-lib.sh +++ b/bin/build-lib.sh @@ -137,8 +137,6 @@ set_common_vars () { TARGET_EXE_ARGS= RTS_OPTIONS= - GHC_VERSION=$(ghc --numeric-version) - CABAL_BUILD_OPTIONS="" CABAL_EXECUTABLE=cabal @@ -155,6 +153,18 @@ set_common_vars () { fi } +# To be called after parsing CLI arguments +set_derived_vars () { + if test -n "$CABAL_WITH_COMPILER" + then + CABAL_BUILD_OPTIONS+=" --with-compiler $CABAL_WITH_COMPILER" + else + CABAL_WITH_COMPILER=ghc + fi + + GHC_VERSION=$($CABAL_WITH_COMPILER --numeric-version) +} + # XXX cabal issue "cabal v2-exec which" cannot find benchmark/test executables # $1: builddir diff --git a/bin/test.sh b/bin/test.sh index 1e4032fe..a6348927 100755 --- a/bin/test.sh +++ b/bin/test.sh @@ -9,6 +9,7 @@ SCRIPT_DIR=$(dirname $0) print_help () { echo "Usage: $0 " echo " [--targets <"target1 target2 ..." | help>]" + echo " [--with-compiler ]" echo " [--cabal-build-options