Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/bootstrap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
ghc: ["9.2.8", "9.4.8", "9.6.7", "9.8.4", "9.10.2", "9.12.2"]
ghc: ["9.2.8", "9.4.8", "9.6.7", "9.8.4", "9.10.3", "9.12.2"]
include:
- os: macos-latest
ghc: "9.2.8"
Expand Down
68 changes: 52 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ FORMAT_DIRS_TODO := \
solver-benchmarks

.PHONY: style-todo
style-todo: ## Configured for fourmolu, avoiding GHC parser failures
style-todo: ## Configured for fourmolu, avoiding GHC parser failures.
@fourmolu -q $(FORMAT_DIRS_TODO) > /dev/null

.PHONY: style
Expand Down Expand Up @@ -85,7 +85,7 @@ lint-json: ## Run HLint in JSON mode.
# local checks

.PHONY: checks
checks: whitespace users-guide-typos markdown-typos style lint-json ## Run all local checks; whitespace, typos, style, and lint.
checks: whitespace users-guide-typos markdown-typos style lint-json ## Run all local checks: whitespace, typos, style, and lint.

# source generation: SPDX

Expand Down Expand Up @@ -265,17 +265,53 @@ tags: ## Generate editor tags, vim ctags and emacs etags.
# bootstrapping
##############################################################################

BOOT_GHCUP := $(shell ghcup --version 2>/dev/null)
BOOT_NIX := $(shell nix-shell --version 2>/dev/null)
CABALCONF := $(shell if test -f $$HOME/.config/cabal/config; then echo CABAL_CONFIG=$$HOME/.config/cabal/config; fi)

bootstrap-json-%: phony
cabal build --project-file=cabal.bootstrap.project --with-compiler=ghc-$* --dry-run cabal-install:exe:cabal
cp dist-newstyle/cache/plan.json bootstrap/linux-$*.plan.json
ghcup install ghc "$*" --no-verbose --no-guess-version
$(MAKE) "bootstrap-subr-$*"

# "subroutine", make style
bootstrap-subr-%: phony
rm -rf dist-bootstrap
$(CABALBUILD) --distdir=dist-bootstrap --project-file=cabal.bootstrap.project --with-compiler=ghc-$* --dry-run \
cabal-install:exe:cabal
cp dist-bootstrap/cache/plan.json bootstrap/linux-$*.plan.json
@# -v0 to avoid build output on stdout
cd bootstrap && cabal run -v0 cabal-bootstrap-gen -- linux-$*.plan.json \
cd bootstrap && $(CABALCONF) $(CABALRUN) -v0 cabal-bootstrap-gen -- linux-$*.plan.json \
| python3 -m json.tool > linux-$*.json

BOOTSTRAP_GHC_VERSIONS := 9.2.8 9.4.8 9.6.7 9.8.4 9.10.2 9.12.2
BOOTSTRAP_GHC_VERSIONS := 9.2.8 9.4.8 9.6.7 9.8.4 9.10.3 9.12.2

.PHONY: bootstrap-jsons
bootstrap-jsons: $(BOOTSTRAP_GHC_VERSIONS:%=bootstrap-json-%)
bootstrap-jsons: ## Generate bootstrap JSONs for Linux (autodetects method).
ifeq ($(BOOT_GHCUP), )
ifeq ($(BOOT_NIX), )
@echo If you do not have ghcs $(BOOTSTRAP_GHC_VERSIONS), you will need to install them manually.
$(MAKE) bootstrap-jsons-no-dl
else
$(MAKE) bootstrap-jsons-nix
endif
else
$(MAKE) bootstrap-jsons-ghcup
endif

.PHONY: bootstrap-jsons-no-dl
bootstrap-jsons-no-dl: $(BOOTSTRAP_GHC_VERSIONS:%=bootstrap-subr-%) ## Generate bootstrap JSONs for Linux using existing ghcs.

.PHONY: bootstrap-jsons-nix
bootstrap-jsons-nix: ## Generate bootstrap JSONs for Linux using Nix-provided ghcs.
cd ./bootstrap && $(CABALCONF) ./generate_bootstrap_plans

.PHONY: bootstrap-jsons-ghcup
bootstrap-jsons-ghcup: $(BOOTSTRAP_GHC_VERSIONS:%=bootstrap-json-%) ## Generate bootstrap JSONs for Linux using ghcup.

# this lets the Nix bootstrap script use the Makefile's definitions instead of hardcoding them itself
.PHONY: bootstrap-jsons-nix-helper
bootstrap-jsons-nix-helper:
@echo "$(BOOTSTRAP_GHC_VERSIONS)"

# documentation
##############################################################################
Expand All @@ -290,45 +326,45 @@ else
PROCS := $(shell nproc)
endif

PHONY: help
.PHONY: help
help: ## Show the commented targets.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

PHONY: help-banner
.PHONY: help-banner
help-banner: ## Show the help banner.
@echo "===================================================================="
@echo "§ all make with no arguments also shows this banner"
@echo "§ help make help will list targets with descriptions"
@echo "===================================================================="

.PHONY: typos-install
typos-install: ## Install typos-cli for typos target using cargo
typos-install: ## Install typos-cli for typos target using cargo.
cargo install typos-cli

GREP_EXCLUDE := grep -v -E 'dist-|cabal-testsuite|python-'
FIND_NAMED := find . -type f -name

.PHONY: hs-typos
hs-typos: ## Find typos in Haskell source files; .hs, .cabal, etc.
hs-typos: ## Find typos in Haskell source files: .hs, .cabal, etc.
typos --config .typos-srcs.toml --force-exclude

.PHONY: hs-fix-typos
hs-fix-typos: ## Fix typos in Haskell source files; .hs, .cabal, etc.
hs-fix-typos: ## Fix typos in Haskell source files: .hs, .cabal, etc.
typos --config .typos-srcs.toml --write-changes --force-exclude

.PHONY: users-guide-typos
users-guide-typos: ## Find typos in users guide
users-guide-typos: ## Find typos in users guide.
cd doc && $(FIND_NAMED) '*.rst' | xargs typos --config ../.typos-docs.toml --force-exclude

.PHONY: users-guide-fix-typos
users-guide-fix-typos: ## Fix typos in users guide
users-guide-fix-typos: ## Fix typos in users guide.
cd doc && $(FIND_NAMED) '*.rst' | xargs typos --config ../.typos-docs.toml --write-changes --force-exclude

.PHONY: markdown-typos
markdown-typos: ## Find typos in markdown files
markdown-typos: ## Find typos in markdown files.
$(FIND_NAMED) '*.md' | $(GREP_EXCLUDE) | xargs typos --config .typos-docs.toml --force-exclude

.PHONY: markdown-fix-typos
markdown-fix-typos: ## Fix typos in markdown files
markdown-fix-typos: ## Fix typos in markdown files.
$(FIND_NAMED) '*.md' | $(GREP_EXCLUDE) | xargs typos --config .typos-docs.toml --write-changes --force-exclude
19 changes: 6 additions & 13 deletions bootstrap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ in the same way as it is shown for Linux above. On a system with functional `cab

1. 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. `macosx-8.8.4.json`) by running:
2. Build a dependency description file (`$PLATFORM-$GHCVER.json`, e.g. `macosx-8.8.4.json`).

```sh
cabal build --with-compiler=/path/to/ghc --dry-run cabal-install:exe:cabal
Expand All @@ -45,15 +45,8 @@ in the same way as it is shown for Linux above. On a system with functional `cab
3. You may need to tweak `bootstrap/$PLATFORM-$GHCVER.json` file manually,
for example, to toggle flags.

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

# Updating Bootstrap Plans

In order to update the bootstrap plans on linux there is the convenient `./generate_bootstrap_plans`
script. You can modify this script with the GHC versions you want to generate the plans for and
then run it to generate the plans.

```
./generate_bootstrap_plans
```

The top level `Makefile` has a rule `bootstrap-jsons` to generate Linux bootstrap files for all
supported ghc versions, or `bootstrap-json-$GHCVER` for a single ghc version. The rules know
how to obtain the requisite ghc versions via `ghcup` or Nix; if you have neither, you will
have to obtain versioned ghc binaries from `downloads.haskell.org` or other suitable
repository.
9 changes: 5 additions & 4 deletions bootstrap/cabal-bootstrap-gen.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ executable cabal-bootstrap-gen
main-is: Main.hs
build-depends:
, aeson ^>=1.5.2.0 || ^>=2.0.3.0 || ^>=2.1.0.0 || ^>=2.2.0.0
, base ^>=4.12.0.0 || ^>=4.13.0.0 || ^>=4.14.0.0 || ^>=4.15.0.0 || ^>=4.16.0.0 || ^>=4.17.0.0 || ^>=4.18.0.0 || ^>=4.19.0.0 || ^>=4.20.0.0
, bytestring ^>=0.10.8.2 || ^>=0.11.0.0
, base >=4.12.0.0 && < 5
, bytestring >=0.10.8.2 && <0.13
, Cabal ^>=3.14.1.0 || ^>=3.16.0.0
, Cabal-syntax ^>=3.14.1.0 || ^>=3.16.0.0
-- For the release process, we need the last *two* Cabal-syntax
Expand All @@ -20,7 +20,8 @@ executable cabal-bootstrap-gen
-- rerun `make bootstrap-jsons`.
, cabal-install-parsers ^>=0.6
, cabal-plan ^>=0.7.0.0
, containers ^>=0.6.0.1
, text ^>=1.2.3.0 || ^>=2.0.1
-- upper bound is conjectural
, containers >=0.6.0.1 && <0.10
, text >=1.2.3.0 && <3
, topograph ^>=1.0.0.1
, transformers ^>=0.5.6.2 || ^>=0.6.0.4
26 changes: 15 additions & 11 deletions bootstrap/generate_bootstrap_plans
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
nix build nixpkgs#jq.bin -o jq
PATH+=:$PWD/jq-bin/bin
#! /bin/sh
nix build nixpkgs#jq.bin -o jq --extra-experimental-features nix-command --extra-experimental-features flakes
PATH="$PATH:$PWD/jq-bin/bin"

ghcs_nix="https://gitlab.haskell.org/bgamari/ghcs-nix/-/archive/master/ghcs-nix-master.tar.gz"

nix build -f "$ghcs_nix" ghc-9_6_5 -o boot_ghc
nix build -f "$ghcs_nix" ghc-9_6_5 -o boot_ghc --extra-experimental-features nix-command

run() {
local ver="$1"
local drv="ghc-$ver"
echo "$ver"
nix build -f "$ghcs_nix" $drv
(cd ../; rm -r dist-bootstrap; cabal --distdir=dist-bootstrap build --project-file=cabal.bootstrap.project --dry-run cabal-install:exe:cabal -w bootstrap/result/bin/ghc)
nix build -f "$ghcs_nix" $drv --extra-experimental-features nix-command
(cd .. && rm -rf dist-bootstrap && cabal --distdir=dist-bootstrap build --project-file=cabal.bootstrap.project --dry-run cabal-install:exe:cabal -w bootstrap/result/bin/ghc)
jq --sort-keys < ../dist-bootstrap/cache/plan.json > "plan-$ver.json"
cabal run --with-ghc-pkg $PWD/boot_ghc/bin/ghc-pkg -w $PWD/boot_ghc/bin/ghc -v0 cabal-bootstrap-gen -- "plan-$ver.json" | jq --sort-keys | tee "linux-$(echo $ver | tr "_" ".").json"
}

run "9_2_8"
run "9_4_8"
run "9_6_7"
run "9_8_4"
run "9_10_1"
run "9_12_2"
if [ $# -eq 0 ]; then
# get bootstrap ghc list from Makefile instead of hardcoded
# MAKELEVEL silences sub-make output if this is run from the top level Makefile
set -- $(cd ..; MAKELEVEL= make bootstrap-jsons-nix-helper)
fi

for ghc in "$@"; do
run $(echo "$ghc" | tr . _)
done
12 changes: 6 additions & 6 deletions bootstrap/linux-9.10.2.json → bootstrap/linux-9.10.3.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
},
{
"package": "ghc-internal",
"version": "9.1002.0"
"version": "9.1003.0"
},
{
"package": "base",
"version": "4.20.1.0"
"version": "4.20.2.0"
},
{
"package": "array",
Expand All @@ -30,7 +30,7 @@
},
{
"package": "ghc-boot-th",
"version": "9.10.2"
"version": "9.10.3"
},
{
"package": "pretty",
Expand Down Expand Up @@ -66,7 +66,7 @@
},
{
"package": "os-string",
"version": "2.0.4"
"version": "2.0.7"
},
{
"package": "filepath",
Expand All @@ -78,7 +78,7 @@
},
{
"package": "unix",
"version": "2.8.6.0"
"version": "2.8.7.0"
},
{
"package": "directory",
Expand All @@ -90,7 +90,7 @@
},
{
"package": "text",
"version": "2.1.2"
"version": "2.1.3"
},
{
"package": "parsec",
Expand Down
Loading