Zubin pushed to branch wip/26296 at Glasgow Haskell Compiler / GHC
Commits:
-
95b47966
by Zubin Duggal at 2025-08-18T12:43:33+05:30
3 changed files:
Changes:
... | ... | @@ -96,7 +96,9 @@ Environment variables determining bootstrap toolchain (Linux): |
96 | 96 | |
97 | 97 | Environment variables determining bootstrap toolchain (non-Linux):
|
98 | 98 | |
99 | - GHC_VERSION Which GHC version to fetch for bootstrapping.
|
|
99 | + FETCH_GHC_VERSION Which GHC version to fetch for bootstrapping.
|
|
100 | + This should not be set if GHC is already provisioned, i.e. in the
|
|
101 | + docker image for linux platforms and via nix for darwin platforms
|
|
100 | 102 | CABAL_INSTALL_VERSION
|
101 | 103 | Cabal-install version to fetch for bootstrapping.
|
102 | 104 | EOF
|
... | ... | @@ -197,9 +199,6 @@ function set_toolchain_paths() { |
197 | 199 | CABAL="$toolchain/bin/cabal$exe"
|
198 | 200 | HAPPY="$toolchain/bin/happy$exe"
|
199 | 201 | ALEX="$toolchain/bin/alex$exe"
|
200 | - if [ "$(uname)" = "FreeBSD" ]; then
|
|
201 | - GHC=/usr/local/bin/ghc
|
|
202 | - fi
|
|
203 | 202 | ;;
|
204 | 203 | nix)
|
205 | 204 | if [[ ! -f toolchain.sh ]]; then
|
... | ... | @@ -275,29 +274,50 @@ function setup() { |
275 | 274 | }
|
276 | 275 | |
277 | 276 | function fetch_ghc() {
|
277 | + local should_fetch=false
|
|
278 | +
|
|
278 | 279 | if [ ! -e "$GHC" ]; then
|
279 | - local v="$GHC_VERSION"
|
|
280 | - if [[ -z "$v" ]]; then
|
|
281 | - fail "neither GHC nor GHC_VERSION are not set"
|
|
280 | + if [ -z "${FETCH_GHC_VERSION:-}" ]; then
|
|
281 | + fail "GHC not found at '$GHC' and FETCH_GHC_VERSION is not set"
|
|
282 | + fi
|
|
283 | + should_fetch=true
|
|
284 | + elif [ -n "${FETCH_GHC_VERSION:-}" ]; then
|
|
285 | + local current_version
|
|
286 | + if current_version=$($GHC --numeric-version 2>/dev/null); then
|
|
287 | + if [ "$current_version" != "$FETCH_GHC_VERSION" ]; then
|
|
288 | + info "GHC version mismatch: found $current_version, expected $FETCH_GHC_VERSION"
|
|
289 | + should_fetch=true
|
|
282 | 290 | fi
|
291 | + fi
|
|
292 | + fi
|
|
293 | +
|
|
294 | + if [ "$should_fetch" = true ]; then
|
|
295 | + local v="$FETCH_GHC_VERSION"
|
|
283 | 296 | |
284 | 297 | start_section fetch-ghc "Fetch GHC"
|
285 | - url="https://downloads.haskell.org/~ghc/${GHC_VERSION}/ghc-${GHC_VERSION}-${boot_triple}.tar.xz"
|
|
298 | + case "$(uname)" in
|
|
299 | + FreeBSD)
|
|
300 | + url="https://downloads.haskell.org/ghcup/unofficial-bindists/ghc/${FETCH_GHC_VERSION}/ghc-${FETCH_GHC_VERSION}-${boot_triple}.tar.xz"
|
|
301 | + ;;
|
|
302 | + *)
|
|
303 | + url="https://downloads.haskell.org/~ghc/${FETCH_GHC_VERSION}/ghc-${FETCH_GHC_VERSION}-${boot_triple}.tar.xz"
|
|
304 | + ;;
|
|
305 | + esac
|
|
286 | 306 | info "Fetching GHC binary distribution from $url..."
|
287 | 307 | curl "$url" > ghc.tar.xz || fail "failed to fetch GHC binary distribution"
|
288 | 308 | $TAR -xJf ghc.tar.xz || fail "failed to extract GHC binary distribution"
|
289 | 309 | case "$(uname)" in
|
290 | 310 | MSYS_*|MINGW*)
|
291 | - cp -r ghc-${GHC_VERSION}*/* "$toolchain"
|
|
311 | + cp -r ghc-${FETCH_GHC_VERSION}*/* "$toolchain"
|
|
292 | 312 | ;;
|
293 | 313 | *)
|
294 | - pushd ghc-${GHC_VERSION}*
|
|
314 | + pushd ghc-${FETCH_GHC_VERSION}*
|
|
295 | 315 | ./configure --prefix="$toolchain"
|
296 | 316 | "$MAKE" install
|
297 | 317 | popd
|
298 | 318 | ;;
|
299 | 319 | esac
|
300 | - rm -Rf "ghc-${GHC_VERSION}" ghc.tar.xz
|
|
320 | + rm -Rf "ghc-${FETCH_GHC_VERSION}" ghc.tar.xz
|
|
301 | 321 | end_section fetch-ghc
|
302 | 322 | fi
|
303 | 323 |
... | ... | @@ -446,7 +446,7 @@ opsysVariables _ FreeBSD14 = mconcat |
446 | 446 | -- Prefer to use the system's clang-based toolchain and not gcc
|
447 | 447 | , "CC" =: "cc"
|
448 | 448 | , "CXX" =: "c++"
|
449 | - , "GHC_VERSION" =: "9.6.4"
|
|
449 | + , "FETCH_GHC_VERSION" =: "9.10.1"
|
|
450 | 450 | , "CABAL_INSTALL_VERSION" =: "3.10.3.0"
|
451 | 451 | ]
|
452 | 452 | opsysVariables arch (Linux distro) = distroVariables arch distro
|
... | ... | @@ -478,7 +478,7 @@ opsysVariables _ (Windows {}) = mconcat |
478 | 478 | , "LANG" =: "en_US.UTF-8"
|
479 | 479 | , "CABAL_INSTALL_VERSION" =: "3.10.2.0"
|
480 | 480 | , "HADRIAN_ARGS" =: "--docs=no-sphinx-pdfs"
|
481 | - , "GHC_VERSION" =: "9.10.1"
|
|
481 | + , "FETCH_GHC_VERSION" =: "9.10.1"
|
|
482 | 482 | ]
|
483 | 483 | opsysVariables _ _ = mempty
|
484 | 484 |
... | ... | @@ -1467,7 +1467,7 @@ |
1467 | 1467 | "CC": "cc",
|
1468 | 1468 | "CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
|
1469 | 1469 | "CXX": "c++",
|
1470 | - "GHC_VERSION": "9.6.4",
|
|
1470 | + "FETCH_GHC_VERSION": "9.10.1",
|
|
1471 | 1471 | "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
1472 | 1472 | "RUNTEST_ARGS": "",
|
1473 | 1473 | "TEST_ENV": "x86_64-freebsd14-validate",
|
... | ... | @@ -3698,7 +3698,7 @@ |
3698 | 3698 | "BUILD_FLAVOUR": "validate",
|
3699 | 3699 | "CABAL_INSTALL_VERSION": "3.10.2.0",
|
3700 | 3700 | "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
3701 | - "GHC_VERSION": "9.10.1",
|
|
3701 | + "FETCH_GHC_VERSION": "9.10.1",
|
|
3702 | 3702 | "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
|
3703 | 3703 | "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
3704 | 3704 | "LANG": "en_US.UTF-8",
|
... | ... | @@ -3761,7 +3761,7 @@ |
3761 | 3761 | "BUILD_FLAVOUR": "validate",
|
3762 | 3762 | "CABAL_INSTALL_VERSION": "3.10.2.0",
|
3763 | 3763 | "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
3764 | - "GHC_VERSION": "9.10.1",
|
|
3764 | + "FETCH_GHC_VERSION": "9.10.1",
|
|
3765 | 3765 | "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
|
3766 | 3766 | "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
3767 | 3767 | "LANG": "en_US.UTF-8",
|
... | ... | @@ -4355,7 +4355,7 @@ |
4355 | 4355 | "CC": "cc",
|
4356 | 4356 | "CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
|
4357 | 4357 | "CXX": "c++",
|
4358 | - "GHC_VERSION": "9.6.4",
|
|
4358 | + "FETCH_GHC_VERSION": "9.10.1",
|
|
4359 | 4359 | "IGNORE_PERF_FAILURES": "all",
|
4360 | 4360 | "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
4361 | 4361 | "RUNTEST_ARGS": "",
|
... | ... | @@ -5579,7 +5579,7 @@ |
5579 | 5579 | "BUILD_FLAVOUR": "release",
|
5580 | 5580 | "CABAL_INSTALL_VERSION": "3.10.2.0",
|
5581 | 5581 | "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
5582 | - "GHC_VERSION": "9.10.1",
|
|
5582 | + "FETCH_GHC_VERSION": "9.10.1",
|
|
5583 | 5583 | "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
|
5584 | 5584 | "IGNORE_PERF_FAILURES": "all",
|
5585 | 5585 | "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
... | ... | @@ -5643,7 +5643,7 @@ |
5643 | 5643 | "BUILD_FLAVOUR": "release",
|
5644 | 5644 | "CABAL_INSTALL_VERSION": "3.10.2.0",
|
5645 | 5645 | "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
5646 | - "GHC_VERSION": "9.10.1",
|
|
5646 | + "FETCH_GHC_VERSION": "9.10.1",
|
|
5647 | 5647 | "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
|
5648 | 5648 | "IGNORE_PERF_FAILURES": "all",
|
5649 | 5649 | "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
... | ... | @@ -5782,7 +5782,7 @@ |
5782 | 5782 | "CC": "cc",
|
5783 | 5783 | "CONFIGURE_ARGS": "--with-iconv-includes=/usr/local/include --with-iconv-libraries=/usr/local/lib --with-system-libffi --with-ffi-includes=/usr/local/include --with-ffi-libraries=/usr/local/lib --with-gmp-includes=/usr/local/include --with-gmp-libraries=/usr/local/lib --enable-strict-ghc-toolchain-check",
|
5784 | 5784 | "CXX": "c++",
|
5785 | - "GHC_VERSION": "9.6.4",
|
|
5785 | + "FETCH_GHC_VERSION": "9.10.1",
|
|
5786 | 5786 | "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
5787 | 5787 | "RUNTEST_ARGS": "",
|
5788 | 5788 | "TEST_ENV": "x86_64-freebsd14-validate"
|
... | ... | @@ -7982,7 +7982,7 @@ |
7982 | 7982 | "BUILD_FLAVOUR": "validate",
|
7983 | 7983 | "CABAL_INSTALL_VERSION": "3.10.2.0",
|
7984 | 7984 | "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
7985 | - "GHC_VERSION": "9.10.1",
|
|
7985 | + "FETCH_GHC_VERSION": "9.10.1",
|
|
7986 | 7986 | "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
|
7987 | 7987 | "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
7988 | 7988 | "LANG": "en_US.UTF-8",
|
... | ... | @@ -8044,7 +8044,7 @@ |
8044 | 8044 | "BUILD_FLAVOUR": "validate",
|
8045 | 8045 | "CABAL_INSTALL_VERSION": "3.10.2.0",
|
8046 | 8046 | "CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
8047 | - "GHC_VERSION": "9.10.1",
|
|
8047 | + "FETCH_GHC_VERSION": "9.10.1",
|
|
8048 | 8048 | "HADRIAN_ARGS": "--docs=no-sphinx-pdfs",
|
8049 | 8049 | "INSTALL_CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
|
8050 | 8050 | "LANG": "en_US.UTF-8",
|