summaryrefslogtreecommitdiff
path: root/.gitlab/ci.sh
diff options
context:
space:
mode:
Diffstat (limited to '.gitlab/ci.sh')
-rwxr-xr-x.gitlab/ci.sh36
1 files changed, 26 insertions, 10 deletions
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh
index 9b68799e37..e76a5d912b 100755
--- a/.gitlab/ci.sh
+++ b/.gitlab/ci.sh
@@ -70,6 +70,8 @@ Environment variables affecting both build systems:
INSTALL_CONFIGURE_ARGS
Arguments passed to the binary distribution configure script
during installation of test toolchain.
+ NIX_SYSTEM On Darwin, the target platform of the desired toolchain
+ (either "x86-64-darwin" or "aarch-darwin")
Environment variables determining build configuration of Make system:
@@ -182,22 +184,33 @@ function show_tool() {
}
function set_toolchain_paths() {
- needs_toolchain="1"
case "$(uname -m)-$(uname)" in
# Linux toolchains are included in the Docker image
- *-Linux) needs_toolchain="" ;;
+ *-Linux) toolchain_source="env" ;;
# Darwin toolchains are provided via .gitlab/darwin/toolchain.nix
- *-Darwin) needs_toolchain="" ;;
- *) ;;
+ *-Darwin) toolchain_source="nix" ;;
+ *) toolchain_source="extracted" ;;
esac
- if [[ -n "$needs_toolchain" ]]; then
+ case "$toolchain_source" in
+ extracted)
# These are populated by setup_toolchain
GHC="$toolchain/bin/ghc$exe"
CABAL="$toolchain/bin/cabal$exe"
HAPPY="$toolchain/bin/happy$exe"
ALEX="$toolchain/bin/alex$exe"
- else
+ ;;
+ nix)
+ if [[ ! -f toolchain.sh ]]; then
+ case "$NIX_SYSTEM" in
+ x86_64-darwin|aarch64-darwin) ;;
+ *) fail "unknown NIX_SYSTEM" ;;
+ esac
+ nix build -f .gitlab/darwin/toolchain.nix --argstr system "$NIX_SYSTEM" -o toolchain.sh
+ cat toolchain.sh
+ fi
+ source toolchain.sh ;;
+ env)
# These are generally set by the Docker image but
# we provide these handy fallbacks in case the
# script isn't run from within a GHC CI docker image.
@@ -205,7 +218,9 @@ function set_toolchain_paths() {
if [ -z "$CABAL" ]; then CABAL="$(which cabal)"; fi
if [ -z "$HAPPY" ]; then HAPPY="$(which happy)"; fi
if [ -z "$ALEX" ]; then ALEX="$(which alex)"; fi
- fi
+ ;;
+ *) fail "bad toolchain_source"
+ esac
export GHC
export CABAL
@@ -227,9 +242,10 @@ function setup() {
cp -Rf "$CABAL_CACHE"/* "$CABAL_DIR"
fi
- if [[ "$needs_toolchain" = "1" ]]; then
- time_it "setup" setup_toolchain
- fi
+ case $toolchain_source in
+ extracted) time_it "setup" setup_toolchain ;;
+ *) ;;
+ esac
cabal_update