Skip to content

Bootstrap rewrite by bgamari #6979

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 9 additions & 19 deletions .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,13 @@ jobs:
name: Bootstrap on Linux
runs-on: ubuntu-18.04
steps:
- name: Set PATH
run: |
echo "::add-path::/opt/ghc/8.6.5/bin"
- uses: actions/checkout@v2
- name: bootstrap.sh
env:
EXTRA_CONFIGURE_OPTS: ""
- name: bootstrap.py
run: |
cd cabal-install
sh ./bootstrap.sh --no-doc
python3 bootstrap/bootstrap.py -w /opt/ghc/8.6.5/bin/ghc -d bootstrap/linux-8.6.5.json
- name: Smoke test
run: |
$HOME/.cabal/bin/cabal --version
packages/tmp/bin/cabal --version

boostrap-macos:
name: Bootstrap on macOS
Expand All @@ -47,17 +41,13 @@ jobs:
cd ghc-*
./configure --prefix=/opt/ghc/8.6.5
sudo make install
- name: Set PATH
run: |
echo "::add-path::/opt/ghc/8.6.5/bin"
echo "::add-path::$HOME/.cabal/bin"
- uses: actions/checkout@v2
- name: bootstrap.sh
env:
EXTRA_CONFIGURE_OPTS: ""

# We use linux dependencies
- name: bootstrap.py
run: |
cd cabal-install
sh ./bootstrap.sh --no-doc
python3 bootstrap/bootstrap.py -w /opt/ghc/8.6.5/bin/ghc -d bootstrap/linux-8.6.5.json

- name: Smoke test
run: |
$HOME/.cabal/bin/cabal --version
packages/tmp/bin/cabal --version
21 changes: 19 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,25 @@ weeder :
tags :
hasktags -b Cabal/src Cabal/Cabal-described/src cabal-install/src cabal-testsuite/src

# boostrapping
##############################################################################

bootstrap-plans-linux: phony
@if [ $$(uname) != "Linux" ]; then echo "Not Linux"; false; fi
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.6.5 --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-8.6.5.plan.json
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.8.3 --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-8.8.3.plan.json
cabal v2-build --project=cabal.project.release --with-compiler ghc-8.10.1 --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-8.10.1.plan.json

bootstrap-jsons-linux: phony
@if [ $$(uname) != "Linux" ]; then echo "Not Linux"; false; fi
cabal v2-build --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen
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
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
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

# documentation
##############################################################################

Expand All @@ -238,5 +257,3 @@ $(USERGUIDE_STAMP) : doc/*.rst
.python-sphinx-virtualenv:
python3 -m venv .python-sphinx-virtualenv
(. ./.python-sphinx-virtualenv/bin/activate)


31 changes: 31 additions & 0 deletions bootstrap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Bootstrapping cabal-install

This utility is only intended for use in building cabal-install
on a new platform. If you already have a functional (if dated) cabal-install
please rather run `cabal v2-install`.

The typical usage is porting to a new linux architecture,
then the `linux-ghcvec.json` file is available in `bootstrap/` folder:

On a (linux) system you are boostrapping, run

bootstrap.py -d linux-ghcver.json -w /path/to-ghc

To generate the `platform-ghcver` files for other platforms, do:

1. On a system with functional cabal-install, install the same GHC version
as you will use to bootstrap on the host system.

2. Build a dependency description file (`platform-ghcver.json`, e.g. `linux-8.8.3.json`) by running:

```sh
cabal v2-build --with-compiler=/path/to/ghc --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/platform-ghcver.plan.json
cabal v2-build --builddir=dist-newstyle-bootstrap --project=cabal.project.bootstrap cabal-bootstrap-gen
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
```

3. You may need to tweak `bootstrap/platform-ghcver.json` file manually,
for example toggle flags.

There are rules in top-level `Makefile` for generation of these files.
Loading