... |
... |
@@ -349,47 +349,45 @@ function fetch_ghc() { |
349
|
349
|
}
|
350
|
350
|
|
351
|
351
|
function fetch_cabal() {
|
352
|
|
- if [ ! -e "$CABAL" ]; then
|
353
|
|
- local v="$CABAL_INSTALL_VERSION"
|
354
|
|
- if [[ -z "$v" ]]; then
|
355
|
|
- fail "neither CABAL nor CABAL_INSTALL_VERSION are not set"
|
356
|
|
- fi
|
|
352
|
+ local v="$CABAL_INSTALL_VERSION"
|
|
353
|
+ if [[ -z "$v" ]]; then
|
|
354
|
+ fail "neither CABAL nor CABAL_INSTALL_VERSION are not set"
|
|
355
|
+ fi
|
357
|
356
|
|
358
|
|
- start_section "fetch cabal"
|
|
357
|
+ start_section "fetch cabal"
|
|
358
|
+ case "$(uname)" in
|
|
359
|
+ # N.B. Windows uses zip whereas all others use .tar.xz
|
|
360
|
+ MSYS_*|MINGW*)
|
|
361
|
+ case "$MSYSTEM" in
|
|
362
|
+ CLANG64) cabal_arch="x86_64" ;;
|
|
363
|
+ *) fail "unknown MSYSTEM $MSYSTEM" ;;
|
|
364
|
+ esac
|
|
365
|
+ url="https://downloads.haskell.org/~cabal/cabal-install-$v/cabal-install-$v-$cabal_arch-windows.zip"
|
|
366
|
+ info "Fetching cabal binary distribution from $url..."
|
|
367
|
+ curl "$url" > "$TMP/cabal.zip"
|
|
368
|
+ unzip "$TMP/cabal.zip"
|
|
369
|
+ mv cabal.exe "$CABAL"
|
|
370
|
+ ;;
|
|
371
|
+ *)
|
|
372
|
+ local base_url="https://downloads.haskell.org/~cabal/cabal-install-$v/"
|
359
|
373
|
case "$(uname)" in
|
360
|
|
- # N.B. Windows uses zip whereas all others use .tar.xz
|
361
|
|
- MSYS_*|MINGW*)
|
362
|
|
- case "$MSYSTEM" in
|
363
|
|
- CLANG64) cabal_arch="x86_64" ;;
|
364
|
|
- *) fail "unknown MSYSTEM $MSYSTEM" ;;
|
365
|
|
- esac
|
366
|
|
- url="https://downloads.haskell.org/~cabal/cabal-install-$v/cabal-install-$v-$cabal_arch-windows.zip"
|
367
|
|
- info "Fetching cabal binary distribution from $url..."
|
368
|
|
- curl "$url" > "$TMP/cabal.zip"
|
369
|
|
- unzip "$TMP/cabal.zip"
|
370
|
|
- mv cabal.exe "$CABAL"
|
371
|
|
- ;;
|
372
|
|
- *)
|
373
|
|
- local base_url="https://downloads.haskell.org/~cabal/cabal-install-$v/"
|
374
|
|
- case "$(uname)" in
|
375
|
|
- Darwin) cabal_url="$base_url/cabal-install-$v-x86_64-apple-darwin17.7.0.tar.xz" ;;
|
376
|
|
- FreeBSD) cabal_url="$base_url/cabal-install-$v-x86_64-freebsd14.tar.xz" ;;
|
377
|
|
- *) fail "don't know where to fetch cabal-install for $(uname)"
|
378
|
|
- esac
|
379
|
|
- echo "Fetching cabal-install from $cabal_url"
|
380
|
|
- curl "$cabal_url" > cabal.tar.xz
|
381
|
|
- tmp="$(tar -tJf cabal.tar.xz | head -n1)"
|
382
|
|
- $TAR -xJf cabal.tar.xz
|
383
|
|
- # Check if the bindist has directory structure
|
384
|
|
- if [[ "$tmp" = "cabal" ]]; then
|
385
|
|
- mv cabal "$toolchain/bin"
|
386
|
|
- else
|
387
|
|
- mv "$tmp/cabal" "$toolchain/bin"
|
388
|
|
- fi
|
389
|
|
- ;;
|
|
374
|
+ Darwin) cabal_url="$base_url/cabal-install-$v-x86_64-apple-darwin17.7.0.tar.xz" ;;
|
|
375
|
+ FreeBSD) cabal_url="$base_url/cabal-install-$v-x86_64-freebsd14.tar.xz" ;;
|
|
376
|
+ *) fail "don't know where to fetch cabal-install for $(uname)"
|
390
|
377
|
esac
|
391
|
|
- end_section "fetch cabal"
|
392
|
|
- fi
|
|
378
|
+ echo "Fetching cabal-install from $cabal_url"
|
|
379
|
+ curl "$cabal_url" > cabal.tar.xz
|
|
380
|
+ tmp="$(tar -tJf cabal.tar.xz | head -n1)"
|
|
381
|
+ $TAR -xJf cabal.tar.xz
|
|
382
|
+ # Check if the bindist has directory structure
|
|
383
|
+ if [[ "$tmp" = "cabal" ]]; then
|
|
384
|
+ mv cabal "$toolchain/bin"
|
|
385
|
+ else
|
|
386
|
+ mv "$tmp/cabal" "$toolchain/bin"
|
|
387
|
+ fi
|
|
388
|
+ ;;
|
|
389
|
+ esac
|
|
390
|
+ end_section "fetch cabal"
|
393
|
391
|
}
|
394
|
392
|
|
395
|
393
|
# For non-Docker platforms we prepare the bootstrap toolchain
|
... |
... |
@@ -397,10 +395,13 @@ function fetch_cabal() { |
397
|
395
|
# build.
|
398
|
396
|
function setup_toolchain() {
|
399
|
397
|
if [ ! -e "$GHC" ]; then
|
400
|
|
- fetch_ghc
|
|
398
|
+ fetch_ghc
|
|
399
|
+ fi
|
|
400
|
+
|
|
401
|
+ if [ ! -e "$CABAL" ]; then
|
|
402
|
+ fetch_cabal
|
401
|
403
|
fi
|
402
|
404
|
|
403
|
|
- fetch_cabal
|
404
|
405
|
cabal_update
|
405
|
406
|
|
406
|
407
|
local cabal_install="$CABAL v2-install \
|
... |
... |
@@ -723,11 +724,14 @@ function test_hadrian() { |
723
|
724
|
echo 'main = putStrLn "hello world"' > expected
|
724
|
725
|
run "$test_compiler" -package ghc "$TOP/.gitlab/hello.hs" -v -o hello
|
725
|
726
|
|
|
727
|
+ # If build is targeted to Windows/MinGW we should use .exe suffix to test cross compiler output
|
|
728
|
+ local cross_target_exe=""
|
726
|
729
|
if [[ "${CROSS_TARGET:-no_cross_target}" =~ "mingw" ]]; then
|
727
|
|
- ${CROSS_EMULATOR:-} ./hello.exe > actual
|
728
|
|
- else
|
729
|
|
- ${CROSS_EMULATOR:-} ./hello > actual
|
|
730
|
+ cross_target_exe=".exe"
|
730
|
731
|
fi
|
|
732
|
+ readonly cross_target_exe
|
|
733
|
+
|
|
734
|
+ ${CROSS_EMULATOR:-} ./hello${cross_target_exe} > actual
|
731
|
735
|
|
732
|
736
|
# We have to use `-w` to make the test more stable across supported
|
733
|
737
|
# platforms, i.e. Windows:
|