on master help sign in
Add support for --with-compiler
commitcdccb78b7ea6efbe5a71d44d5de4e7c57890b302 authorHarendra Kumar <harendra@composewell.com> dateWed 10 Feb 2021, 16:52 (6 years ago) parent44b0ff2
3 files changed+20−2
bin/bench.sh+4 bin/build-lib.sh+12−2 bin/test.sh+4
bin/bench.sh+4
@@ -17,6 +17,7 @@ print_help () {
1717 echo " [--quick]"
1818 echo " [--raw]"
1919 echo " [--dev-build]"
20+ echo " [--with-compiler <compiler exe name>]"
2021 echo " [--cabal-build-options <options>]"
2122 echo " [--rtsopts <opts>]"
2223 echo " [--compare] [--base <commit>] [--candidate <commit>]"
@@ -297,6 +298,7 @@ do
297298 --fields) shift; FIELDS=$1; shift ;;
298299 --base) shift; BASE=$1; shift ;;
299300 --candidate) shift; CANDIDATE=$1; shift ;;
301+ --with-compiler) shift; CABAL_WITH_COMPILER=$1; shift ;;
300302 --cabal-build-flags) shift; CABAL_BUILD_OPTIONS+=$1; shift ;;
301303 --cabal-build-options) shift; CABAL_BUILD_OPTIONS+=$1; shift ;;
302304 --rtsopts) shift; RTS_OPTIONS=$1; shift ;;
@@ -317,6 +319,8 @@ do
317319done
318320GAUGE_ARGS=$*
319321
322+set_derived_vars
323+
320324#-----------------------------------------------------------------------------
321325# Determine targets
322326#-----------------------------------------------------------------------------
bin/build-lib.sh+12−2
@@ -137,8 +137,6 @@ set_common_vars () {
137137 TARGET_EXE_ARGS=
138138 RTS_OPTIONS=
139139
140− GHC_VERSION=$(ghc --numeric-version)
141−
142140 CABAL_BUILD_OPTIONS=""
143141 CABAL_EXECUTABLE=cabal
144142
@@ -155,6 +153,18 @@ set_common_vars () {
155153 fi
156154}
157155
156+# To be called after parsing CLI arguments
157+set_derived_vars () {
158+ if test -n "$CABAL_WITH_COMPILER"
159+ then
160+ CABAL_BUILD_OPTIONS+=" --with-compiler $CABAL_WITH_COMPILER"
161+ else
162+ CABAL_WITH_COMPILER=ghc
163+ fi
164+
165+ GHC_VERSION=$($CABAL_WITH_COMPILER --numeric-version)
166+}
167+
158168# XXX cabal issue "cabal v2-exec which" cannot find benchmark/test executables
159169
160170# $1: builddir
bin/test.sh+4
@@ -9,6 +9,7 @@ SCRIPT_DIR=$(dirname $0)
99print_help () {
1010 echo "Usage: $0 "
1111 echo " [--targets <"target1 target2 ..." | help>]"
12+ echo " [--with-compiler <compiler exe name>]"
1213 echo " [--cabal-build-options <option>]"
1314 echo " [--dev-build]"
1415 echo " [--coverage]"
@@ -52,6 +53,7 @@ do
5253 -h|--help|help) print_help ;;
5354 # options with arguments
5455 --targets) shift; TARGETS=$1; shift ;;
56+ --with-compiler) shift; CABAL_WITH_COMPILER=$1; shift ;;
5557 --cabal-build-options) shift; CABAL_BUILD_OPTIONS=$1; shift ;;
5658 --hpc-report-options) shift; HPC_REPORT_OPTIONS=$1; shift ;;
5759 --rtsopts) shift; RTS_OPTIONS=$1; shift ;;
@@ -69,6 +71,8 @@ do
6971done
7072TARGET_EXE_ARGS=$*
7173
74+set_derived_vars
75+
7276#-----------------------------------------------------------------------------
7377# Determine targets
7478#-----------------------------------------------------------------------------