From b2d494e403e7c2b23796d7c13d879962f7389850 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Tue, 3 Feb 2026 09:58:27 +0100 Subject: [PATCH 1/8] GHCup targets --- .github/workflows/main.yml | 9 +++++++++ Makefile | 20 ++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 48478fe..c093b16 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -35,6 +35,15 @@ jobs: - name: Build JS using Nix run: nix develop .#ghcjs --command bash -c "make js" + - name: Install GHCup + uses: haskell/ghcup-setup@v1 + with: + cabal: latest + + - name: Build using GHC + run: | + make ghcup-build + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: diff --git a/Makefile b/Makefile index dcf1171..dc44345 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,9 @@ .PHONY= update build optim +CABAL_ARGS += --allow-newer=base,template-haskell --with-compiler=wasm32-wasi-ghc --with-hc-pkg=wasm32-wasi-ghc-pkg --with-hsc2hs=wasm32-wasi-hsc2hs --with-haddock=wasm32-wasi-haddock +RELEASE_CHANNEL := https://gitlab.haskell.org/haskell-wasm/ghc-wasm-meta/-/raw/master/ghcup-wasm-0.0.9.yaml +WASM_BOOTSTRAP := https://gitlab.haskell.org/haskell-wasm/ghc-wasm-meta/-/raw/master/bootstrap.sh + all: update build optim js: update-js build-js @@ -21,6 +25,19 @@ build: $(shell wasm32-wasi-ghc --print-libdir)/post-link.mjs --input $(my_wasm) --output public/ghc_wasm_jsffi.js cp -v $(my_wasm) public/ +ghcup-update: + cabal update $(CABAL_ARGS) + +ghcup-build: | install-wasm-via-ghcup ghcup-update + . ~/.ghc-wasm/env && \ + cabal build $(CABAL_ARGS) + +install-wasm-via-ghcup: + curl $(WASM_BOOTSTRAP) | SKIP_GHC=1 sh + . ~/.ghc-wasm/env && \ + ghcup config add-release-channel $(RELEASE_CHANNEL) && \ + ghcup install ghc --set wasm32-wasi-9.15 -- $$CONFIGURE_ARGS + optim: wasm-opt -all -O2 public/app.wasm -o public/app.wasm wasm-tools strip -o public/app.wasm public/app.wasm @@ -28,6 +45,9 @@ optim: serve: http-server public +ghcup-serve: + cd public; php -S localhost:1234 + clean: rm -rf dist-newstyle public From 178fb696dcb32c821578ce20eb511f7264a6f414 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Thu, 12 Feb 2026 19:37:18 +0100 Subject: [PATCH 2/8] wip --- Makefile | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Makefile b/Makefile index dc44345..50966c6 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ watch: ghciwatch --after-startup-ghci :main --after-reload-ghci :main --watch . --debounce 50ms --command 'wasm32-wasi-cabal repl app -finteractive --repl-options="-fghci-browser -fghci-browser-port=8080"' build: - wasm32-wasi-cabal build + wasm32-wasi-cabal build rm -rf public cp -r static public $(eval my_wasm=$(shell wasm32-wasi-cabal list-bin app | tail -n 1)) @@ -45,9 +45,6 @@ optim: serve: http-server public -ghcup-serve: - cd public; php -S localhost:1234 - clean: rm -rf dist-newstyle public From 2d8dc0f101d19ff6c7e3d7c4001526357032e9ac Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Fri, 13 Feb 2026 20:49:12 +0100 Subject: [PATCH 3/8] wip --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c093b16..73b380c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -40,7 +40,7 @@ jobs: with: cabal: latest - - name: Build using GHC + - name: Build using GHCup WASM run: | make ghcup-build From e003cb0b5863b12b037da556b096a7cfdf5dd363 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Fri, 13 Feb 2026 20:53:49 +0100 Subject: [PATCH 4/8] wip --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 73b380c..de1dc6d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,10 @@ jobs: runs-on: ubuntu-latest steps: + - uses: ners/simply-nix@main + with: + reclaim_space: true + - uses: actions/checkout@v4 - uses: cachix/install-nix-action@v31 From 3b9839a90de48ad7d2862d9b959e482987f48281 Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Wed, 18 Feb 2026 16:11:32 +0100 Subject: [PATCH 5/8] wip --- .github/workflows/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index de1dc6d..6a0c6e5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,7 +34,9 @@ jobs: run: nix develop .#wasm --command bash -c "make" - name: Clean and GC - run: nix develop .#wasm --command bash -c "make" && nix-collect-garbage -d + run: | + nix develop .#wasm --command bash -c "make" && nix-collect-garbage -d + make clean - name: Build JS using Nix run: nix develop .#ghcjs --command bash -c "make js" From c9867bf920cd5381863490da7c8aa8c7ce53456c Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Wed, 18 Feb 2026 16:28:11 +0100 Subject: [PATCH 6/8] wip --- .github/workflows/main.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6a0c6e5..1ad4396 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,9 +38,6 @@ jobs: nix develop .#wasm --command bash -c "make" && nix-collect-garbage -d make clean - - name: Build JS using Nix - run: nix develop .#ghcjs --command bash -c "make js" - - name: Install GHCup uses: haskell/ghcup-setup@v1 with: From 8d1d83366a9eae2943c703121ec65369379724be Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Wed, 18 Feb 2026 16:30:28 +0100 Subject: [PATCH 7/8] wip --- .github/workflows/main.yml | 3 +++ Makefile | 1 + 2 files changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1ad4396..6a0c6e5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -38,6 +38,9 @@ jobs: nix develop .#wasm --command bash -c "make" && nix-collect-garbage -d make clean + - name: Build JS using Nix + run: nix develop .#ghcjs --command bash -c "make js" + - name: Install GHCup uses: haskell/ghcup-setup@v1 with: diff --git a/Makefile b/Makefile index 50966c6..ba156a8 100644 --- a/Makefile +++ b/Makefile @@ -47,6 +47,7 @@ serve: clean: rm -rf dist-newstyle public + cabal clean update-js: cabal update --with-ghc=javascript-unknown-ghcjs-ghc --with-hc-pkg=javascript-unknown-ghcjs-ghc-pkg From 55206b48a20ce634873ccfb455e21a08537c0cab Mon Sep 17 00:00:00 2001 From: Enrico Maria De Angelis Date: Wed, 18 Feb 2026 16:39:17 +0100 Subject: [PATCH 8/8] wip --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ba156a8..67e8152 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ serve: clean: rm -rf dist-newstyle public - cabal clean + . ~/.ghc-wasm/env && cabal clean update-js: cabal update --with-ghc=javascript-unknown-ghcjs-ghc --with-hc-pkg=javascript-unknown-ghcjs-ghc-pkg