diff options
author | Zubin Duggal <zubin.duggal@gmail.com> | 2021-06-13 16:02:06 +0530 |
---|---|---|
committer | Matthew Pickering <matthewtpickering@gmail.com> | 2022-02-21 11:18:58 +0000 |
commit | 7ce1b694f7be7fbf6e2d7b7eb0639e61fbe358c6 (patch) | |
tree | 9e6ff5ac7982e9d22987f551a531d0f034ec942c /.gitlab | |
parent | 2f0ceecc42789558c648c6dcff431d3c8ac3aa46 (diff) | |
download | haskell-7ce1b694f7be7fbf6e2d7b7eb0639e61fbe358c6.tar.gz |
Reinstallable GHC
This patch allows ghc and its dependencies to be built using a normal
invocation of cabal-install. Each componenent which relied on generated
files or additional configuration now has a Setup.hs file.
There are also various fixes to the cabal files to satisfy
cabal-install.
There is a new hadrian command which will build a stage2 compiler and
then a stage3 compiler by using cabal.
```
./hadrian/build build-cabal
```
There is also a new CI job which tests running this command.
For the 9.4 release we will upload all the dependent executables to
hackage and then end users will be free to build GHC and GHC executables
via cabal.
There are still some unresolved questions about how to ensure soundness
when loading plugins into a reinstalled GHC (#20742) which will be
tighted up in due course.
Fixes #19896
Diffstat (limited to '.gitlab')
-rwxr-xr-x | .gitlab/ci.sh | 82 |
1 files changed, 54 insertions, 28 deletions
diff --git a/.gitlab/ci.sh b/.gitlab/ci.sh index f727da77be..74cba5ea36 100755 --- a/.gitlab/ci.sh +++ b/.gitlab/ci.sh @@ -90,6 +90,8 @@ Environment variables determining build configuration of Make system: Environment variables determining build configuration of Hadrian system: BUILD_FLAVOUR Which flavour to build. + REINSTALL_GHC Build and test a reinstalled "stage3" ghc built using cabal-install + This tests the "reinstall" configuration Environment variables determining bootstrap toolchain (Linux): @@ -348,6 +350,7 @@ function setup_toolchain() { --with-compiler=$GHC \ --index-state=$HACKAGE_INDEX_STATE \ --installdir=$toolchain/bin \ + --ignore-project \ --overwrite-policy=always" # Avoid symlinks on Windows @@ -487,9 +490,14 @@ function build_hadrian() { # N.B. First build Hadrian, unsetting MACOSX_DEPLOYMENT_TARGET which may warn # if the bootstrap libraries were built with a different version expectation. MACOSX_DEPLOYMENT_TARGET="" run_hadrian stage1:exe:ghc-bin - run_hadrian binary-dist -V - mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz" + if [[ -n "${REINSTALL_GHC:-}" ]]; then + run_hadrian build-cabal -V + else + run_hadrian binary-dist -V + mv _build/bindist/ghc*.tar.xz "$BIN_DIST_NAME.tar.xz" + fi + } function test_hadrian() { @@ -514,32 +522,50 @@ function test_hadrian() { fi fi - cd _build/bindist/ghc-*/ - case "$(uname)" in - MSYS_*|MINGW*) - mkdir -p "$TOP"/_build/install - cp -a * "$TOP"/_build/install - ;; - *) - read -r -a args <<< "${INSTALL_CONFIGURE_ARGS:-}" - run ./configure --prefix="$TOP"/_build/install "${args[@]}" - run "$MAKE" install - ;; - esac - cd ../../../ - - run_hadrian \ - test \ - --test-root-dirs=testsuite/tests/stage1 \ - --test-compiler=stage1 \ - "runtest.opts+=${RUNTEST_ARGS:-}" - - run_hadrian \ - test \ - --summary-junit=./junit.xml \ - --test-have-intree-files \ - --test-compiler="$TOP/_build/install/bin/ghc$exe" \ - "runtest.opts+=${RUNTEST_ARGS:-}" + + if [[ -n "${REINSTALL_GHC:-}" ]]; then + run_hadrian \ + test \ + --test-root-dirs=testsuite/tests/stage1 \ + --test-compiler=stage-cabal \ + --test-root-dirs=testsuite/tests/perf \ + --test-root-dirs=testsuite/tests/typecheck \ + "runtest.opts+=${RUNTEST_ARGS:-}" + else + cd _build/bindist/ghc-*/ + case "$(uname)" in + MSYS_*|MINGW*) + mkdir -p "$TOP"/_build/install + cp -a * "$TOP"/_build/install + ;; + *) + read -r -a args <<< "${INSTALL_CONFIGURE_ARGS:-}" + run ./configure --prefix="$TOP"/_build/install "${args[@]}" + run "$MAKE" install + ;; + esac + cd ../../../ + test_compiler="$TOP/_build/install/bin/ghc$exe" + + + run_hadrian \ + test \ + --test-root-dirs=testsuite/tests/stage1 \ + --test-compiler=stage1 \ + "runtest.opts+=${RUNTEST_ARGS:-}" + + shell ls + shell ls _build/stage-cabal/bin + + run_hadrian \ + test \ + --summary-junit=./junit.xml \ + --test-have-intree-files \ + --test-compiler="${test_compiler}" \ + "runtest.opts+=${RUNTEST_ARGS:-}" \ + + fi + } function cabal_test() { |