Add support for --with-compiler

This commit is contained in:
Harendra Kumar 2021-02-10 16:52:07 +05:30 committed by Harendra Kumar
parent 44b0ff2ac3
commit cdccb78b7e
3 changed files with 20 additions and 2 deletions

View File

@ -17,6 +17,7 @@ print_help () {
echo " [--quick]"
echo " [--raw]"
echo " [--dev-build]"
echo " [--with-compiler <compiler exe name>]"
echo " [--cabal-build-options <options>]"
echo " [--rtsopts <opts>]"
echo " [--compare] [--base <commit>] [--candidate <commit>]"
@ -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
#-----------------------------------------------------------------------------

View File

@ -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

View File

@ -9,6 +9,7 @@ SCRIPT_DIR=$(dirname $0)
print_help () {
echo "Usage: $0 "
echo " [--targets <"target1 target2 ..." | help>]"
echo " [--with-compiler <compiler exe name>]"
echo " [--cabal-build-options <option>]"
echo " [--dev-build]"
echo " [--coverage]"
@ -52,6 +53,7 @@ do
-h|--help|help) print_help ;;
# options with arguments
--targets) shift; TARGETS=$1; shift ;;
--with-compiler) shift; CABAL_WITH_COMPILER=$1; shift ;;
--cabal-build-options) shift; CABAL_BUILD_OPTIONS=$1; shift ;;
--hpc-report-options) shift; HPC_REPORT_OPTIONS=$1; shift ;;
--rtsopts) shift; RTS_OPTIONS=$1; shift ;;
@ -69,6 +71,8 @@ do
done
TARGET_EXE_ARGS=$*
set_derived_vars
#-----------------------------------------------------------------------------
# Determine targets
#-----------------------------------------------------------------------------