Skip to content

Adding GHCup targets for build, update, serve#11

Closed
Aster89 wants to merge 8 commits into
haskell-miso:mainfrom
Aster89:main
Closed

Adding GHCup targets for build, update, serve#11
Aster89 wants to merge 8 commits into
haskell-miso:mainfrom
Aster89:main

Conversation

@Aster89
Copy link
Copy Markdown
Collaborator

@Aster89 Aster89 commented Feb 3, 2026

I'm not using Nix, but GHCup, and I had to adapt the Makefile a bit to make this project work.

These are the 2 targets I've used (ghcup-build/ghcup-serve corresponding to build/serve), plus another one (ghcup-update corresponding to update) which seemed easy to adapt.

@dmjio
Copy link
Copy Markdown
Member

dmjio commented Feb 3, 2026

This looks good, but can we also update the github CI workflow action to include the ghcup github action - should install it automatically in CI.

Can we also install and select the cross compilers we need (JS / WASM), and then make sections in the workflow file.

- name: Build JS using GHCUp
  run: -- command goes here
  
- name: Build WASM using GHCUp
  run: -- command goes here

@Aster89 Aster89 force-pushed the main branch 3 times, most recently from c679d4c to 3ddcf62 Compare February 6, 2026 13:58
Comment thread .github/workflows/main.yml Outdated
- name: Install GHCup
uses: haskell/ghcup-setup@v1

- name: Install GHC-wasm
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this should have a better name?

Should it be Build WASM using GHCup in alignment with the existing Build WASM using Nix?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I meant to comment line 41 only :|

Comment thread .github/workflows/main.yml
@hasufell hasufell mentioned this pull request Feb 11, 2026
@hasufell
Copy link
Copy Markdown

I fixed the issues here: #15

@Aster89
Copy link
Copy Markdown
Collaborator Author

Aster89 commented Feb 11, 2026

Thanks @hasufell for fixing this in #15.

@Aster89 Aster89 closed this Feb 11, 2026
@Aster89
Copy link
Copy Markdown
Collaborator Author

Aster89 commented Feb 11, 2026

Reopening to submit on behalf of @hasufell.

Regarding Julian's change, I'm copying here a piece of our conversation for my own memory as regards the reasons for the changes:

Me:

Other than the cosmetic/readability changes (e.g. using variables in the Makefile), I seem to understand that these are the actual changes you've made to fix my broken pr:

  1. not passing any version to the various --with-* cabal flags
    • is this fundamental to the fix?
  2. sourcing ~/.ghc-wasm/env before cabal build
    • why is this necessary, given that install-wasm-via-ghcup runs before cabal build anyway?
  3. joining some commands via &&
    • is this just to, say, avoid running ghcup config add-release-channel $(RELEASE_CHANNEL) if . ~/.ghc-wasm/env fails before it, i.e. just to save time in case of failure?
  4. changing $CONFIGURE_ARGS to $$CONFIGURE_ARGS
    • I suppose this is my gross mistake of not remembering the distinction between make-specific and shell-specific variables. Is by any means this the fundamental mistake I made?
  5. changing ghcup install ghc wasm32-wasi-9.14 to ghcup install ghc --set wasm32-wasi-9.15
    • is --set necessary?
    • I suppose the change in version is just incidental?

@hasufell:

  1. no, it just makes it easier to update the GHC version
  2. yes, I think this is the main issue... you're executing the sourcing and the build in separate steps... every step in a github job is a separate script, so the sourcing of the previous step has no effect
  3. in the Makefile, every line in a rule is a separate command as well, similar to point 2... if you want the subsequent commands to see the sourced environment, you have to combine them like that
  4. $CONFIGURE will expand to the Makefile variable, not the enviromnent variable... so double $$ escapes it for shell variables
  5. --set just makes it so that we can later say cabal build -w wasm32-wasi-ghc without the version, it simplifies the makefile

Copy link
Copy Markdown
Member

@dmjio dmjio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, should we also add a JS backend build w/ GHCUp as well? Or can do that in a follow up PR.

Comment thread .github/workflows/main.yml Outdated
Comment thread Makefile Outdated
Comment thread Makefile

clean:
rm -rf dist-newstyle public
. ~/.ghc-wasm/env && cabal clean
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why have . ~/.ghc-wasm/env here?

@dmjio
Copy link
Copy Markdown
Member

dmjio commented Apr 4, 2026

#19

@dmjio dmjio closed this Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants