Skip to content

Commit bcbe8c7

Browse files
hsyl20angerman
authored andcommitted
feat: Implement cabal-based multi-stage build system
This commit introduces a comprehensive cabal-based build infrastructure to support multi-target and cross-compilation scenarios for GHC. The new build system provides a clean separation between different build stages and better modularity for toolchain components. Key changes: - Add Makefile with stage1, stage2, and stage3 build targets - Create separate cabal.project files for each build stage - Update configure.ac for new build system requirements - Adapt hie.yaml to support cabal-based builds - Update GitHub CI workflow for new build process Build stages explained: - Stage 1: Bootstrap compiler built with system GHC - Stage 2: Intermediate compiler built with Stage 1 - Stage 3: Final compiler built with Stage 2 (for validation) This modular approach enables: - Clean cross-compilation support - Better dependency management - Simplified build process for different targets - Improved build reproducibility Contributors: - Andrea Bedini: Build system design and Makefile implementation - Moritz Angermann: Cross-compilation infrastructure The new build system maintains compatibility with existing workflows while providing a more maintainable foundation for future enhancements.
1 parent a91146b commit bcbe8c7

File tree

13 files changed

+1797
-25
lines changed

13 files changed

+1797
-25
lines changed

.github/workflows/ci.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: CI
2+
3+
# Trigger the workflow on push or pull request, but only for the master branch
4+
on:
5+
pull_request:
6+
types:
7+
- opened
8+
- synchronize
9+
push:
10+
branches: [master]
11+
12+
workflow_dispatch:
13+
14+
jobs:
15+
cabal:
16+
name: ${{ matrix.plat }} / ghc ${{ matrix.ghc }}
17+
runs-on: "${{ fromJSON('{\"x86_64-linux\": \"ubuntu-24.04\", \"aarch64-linux\": \"ubuntu-24.04-arm\", \"x86_64-darwin\": \"macos-latest\", \"aarch64-darwin\": \"macos-latest\"}')[matrix.plat] }}"
18+
19+
strategy:
20+
fail-fast: false
21+
matrix:
22+
plat:
23+
- x86_64-linux
24+
# - aarch64-linux # disabled: waiting for devx images to be fixed
25+
# - x86_64-darwin # disabled: waiting for devx images to be fixed
26+
- aarch64-darwin
27+
ghc: ['98'] # bootstrapping compiler
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
submodules: "recursive"
33+
34+
- uses: input-output-hk/actions/devx@latest
35+
with:
36+
platform: ${{ matrix.plat }}
37+
compiler-nix-name: 'ghc98'
38+
minimal: true
39+
ghc: true
40+
41+
- name: Update hackage
42+
shell: devx {0}
43+
run: cabal update
44+
45+
# The Makefile will run configure (and boot 😞), we also need to create a
46+
# synthetic package before running configure. Once this nuissance is fixed
47+
# we can do proper configure + make again. Until then... we have to live
48+
# with the hack of running everything from the make target.
49+
# - name: Configure the build
50+
# shell: devx {0}
51+
# run: ./configure
52+
53+
- name: Build the bindist
54+
shell: devx {0}
55+
run: make CABAL=$PWD/_build/stage0/bin/cabal
56+
57+
- name: Upload artifacts
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: ${{ matrix.plat }}-bindist
61+
path: _build/bindist
62+
63+
- name: Run the testsuite
64+
shell: devx {0}
65+
run: make test CABAL=$PWD/_build/stage0/bin/cabal
66+
67+
- name: Upload test results
68+
uses: actions/upload-artifact@v4
69+
if: ${{ !cancelled() }} # upload test results even if the testsuite failed to pass
70+
with:
71+
name: ${{ matrix.plat }}-testsuite-results
72+
path: |
73+
_build/test-perf.csv
74+
_build/test-summary.txt
75+
_build/test-junit.xml

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,9 @@ missing-win32-tarballs
221221
VERSION
222222
GIT_COMMIT_ID
223223

224+
/libraries/ghc-boot-th-next/.synth-stamp
225+
/libraries/ghc-boot-th-next/ghc-boot-th-next.cabal.in
226+
224227
# -------------------------------------------------------------------------------------
225228
# when using a docker image, one can mount the source code directory as the home folder
226229
# -------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)