Skip to content

Commit 269d2db

Browse files
authored
Merge pull request #6979 from phadej/bootstrap-bgamari
Bootstrap rewrite by bgamari
2 parents f723535 + 859f1f2 commit 269d2db

File tree

15 files changed

+1642
-598
lines changed

15 files changed

+1642
-598
lines changed

.github/workflows/bootstrap.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,13 @@ jobs:
2121
name: Bootstrap on Linux
2222
runs-on: ubuntu-18.04
2323
steps:
24-
- name: Set PATH
25-
run: |
26-
echo "::add-path::/opt/ghc/8.6.5/bin"
2724
- uses: actions/checkout@v2
28-
- name: bootstrap.sh
29-
env:
30-
EXTRA_CONFIGURE_OPTS: ""
25+
- name: bootstrap.py
3126
run: |
32-
cd cabal-install
33-
sh ./bootstrap.sh --no-doc
27+
python3 bootstrap/bootstrap.py -w /opt/ghc/8.6.5/bin/ghc -d bootstrap/linux-8.6.5.json
3428
- name: Smoke test
3529
run: |
36-
$HOME/.cabal/bin/cabal --version
30+
packages/tmp/bin/cabal --version
3731
3832
boostrap-macos:
3933
name: Bootstrap on macOS
@@ -47,17 +41,13 @@ jobs:
4741
cd ghc-*
4842
./configure --prefix=/opt/ghc/8.6.5
4943
sudo make install
50-
- name: Set PATH
51-
run: |
52-
echo "::add-path::/opt/ghc/8.6.5/bin"
53-
echo "::add-path::$HOME/.cabal/bin"
5444
- uses: actions/checkout@v2
55-
- name: bootstrap.sh
56-
env:
57-
EXTRA_CONFIGURE_OPTS: ""
45+
46+
# We use linux dependencies
47+
- name: bootstrap.py
5848
run: |
59-
cd cabal-install
60-
sh ./bootstrap.sh --no-doc
49+
python3 bootstrap/bootstrap.py -w /opt/ghc/8.6.5/bin/ghc -d bootstrap/linux-8.6.5.json
50+
6151
- name: Smoke test
6252
run: |
63-
$HOME/.cabal/bin/cabal --version
53+
packages/tmp/bin/cabal --version

Makefile

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,25 @@ weeder :
221221
tags :
222222
hasktags -b Cabal/src Cabal/Cabal-described/src cabal-install/src cabal-testsuite/src
223223

224+
# boostrapping
225+
##############################################################################
226+
227+
bootstrap-plans-linux: phony
228+
@if [ $$(uname) != "Linux" ]; then echo "Not Linux"; false; fi
229+
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.6.5 --dry-run cabal-install:exe:cabal
230+
cp dist-newstyle/cache/plan.json bootstrap/linux-8.6.5.plan.json
231+
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.8.3 --dry-run cabal-install:exe:cabal
232+
cp dist-newstyle/cache/plan.json bootstrap/linux-8.8.3.plan.json
233+
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.10.1 --dry-run cabal-install:exe:cabal
234+
cp dist-newstyle/cache/plan.json bootstrap/linux-8.10.1.plan.json
235+
236+
bootstrap-jsons-linux: phony
237+
@if [ $$(uname) != "Linux" ]; then echo "Not Linux"; false; fi
238+
cabal v2-build --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen
239+
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.6.5.plan.json | python -m json.tool | tee bootstrap/linux-8.6.5.json
240+
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.8.3.plan.json | python -m json.tool | tee bootstrap/linux-8.8.3.json
241+
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/linux-8.10.1.plan.json | python -m json.tool | tee bootstrap/linux-8.10.1.json
242+
224243
# documentation
225244
##############################################################################
226245

@@ -238,5 +257,3 @@ $(USERGUIDE_STAMP) : doc/*.rst
238257
.python-sphinx-virtualenv:
239258
python3 -m venv .python-sphinx-virtualenv
240259
(. ./.python-sphinx-virtualenv/bin/activate)
241-
242-

bootstrap/README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Bootstrapping cabal-install
2+
3+
This utility is only intended for use in building cabal-install
4+
on a new platform. If you already have a functional (if dated) cabal-install
5+
please rather run `cabal v2-install`.
6+
7+
The typical usage is porting to a new linux architecture,
8+
then the `linux-ghcvec.json` file is available in `bootstrap/` folder:
9+
10+
On a (linux) system you are boostrapping, run
11+
12+
bootstrap.py -d linux-ghcver.json -w /path/to-ghc
13+
14+
To generate the `platform-ghcver` files for other platforms, do:
15+
16+
1. On a system with functional cabal-install, install the same GHC version
17+
as you will use to bootstrap on the host system.
18+
19+
2. Build a dependency description file (`platform-ghcver.json`, e.g. `linux-8.8.3.json`) by running:
20+
21+
```sh
22+
cabal v2-build --with-compiler=/path/to/ghc --dry-run cabal-install:exe:cabal
23+
cp dist-newstyle/cache/plan.json bootstrap/platform-ghcver.plan.json
24+
cabal v2-build --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen
25+
cabal v2-run -vnormal+stderr --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen -- bootstrap/platform-ghcver.plan.json | tee bootstrap/platform-ghcver.json
26+
```
27+
28+
3. You may need to tweak `bootstrap/platform-ghcver.json` file manually,
29+
for example toggle flags.
30+
31+
There are rules in top-level `Makefile` for generation of these files.

0 commit comments

Comments
 (0)