Skip to content

Conversation

@liontiger23
Copy link
Contributor

@liontiger23 liontiger23 commented Nov 9, 2025

Note

This is independent of Upgrade of Haskell stack

Summary

Switched all remaining haskell packages that did not use %haskell_* macros to use them.

However, this highlighted some issues with expressiveness of current macros.
I had to use cabal directly for following tasks:

  • install build dependencies like alex, happy and hspec-discover,
    which runhaskell Setup.hs does not build due to issue
  • build dependent libraries with specific flags, because runhaskell Setup.hs apparently
    only supports version bounds in --constraint and not setting flags as well
    (needed for pandoc build with --constraint="pandoc +embed_data_files")

Below are summaries for each package:

  • ghcup
    • Update build recipe to use %haskell-* macros instead of raw cabal
      as discussed at ghcup: Add at v0.1.50.2 #6540 (comment)
    • Disable parallel build due to weird bug in cabal/ghc
    • Replace .cabal patch file with --constraint argument
    • Enable running tests by explicitly providing hspec-discover
  • pandoc
    • Update build recipe to use %haskell-* macros instead of raw cabal
      as discussed at ghcup: Add at v0.1.50.2 #6540 (comment)
    • Switch to hackage source for pandoc-cli specifically instead of whole pandoc repo
  • pandoc-crossref
    • Switch to hackage source for pandoc-crossref to avoid ugly hack with rm of cabal.project.freeze
  • sv2v

Checklist

  • Package was built and tested against unstable
  • This change could gainfully be listed in the weekly sync notes once merged

**Summary**

- Update build recipe to use `%haskell-*` macros instead of raw cabal
  as discussed at getsolus#6540 (comment)
- Disable parallel build due to weird bug in cabal/ghc
- Replace `.cabal` patch file with `--constraint` argument
- Enable running tests by explicitly providing `hspec-discover`
**Summary**

- Update build recipe to use `%haskell-*` macros instead of raw cabal
  as discussed at getsolus#6540 (comment)
- Switch to hackage source for `pandoc-cli` specifically instead of
  whole pandoc repo
**Summary**

- Switch to hackage source for `pandoc-crossref` to avoid ugly hack
  with rm of `cabal.project.freeze`
**Summary**

- Update build recipe to use `%haskell-*` macros instead of raw cabal
  as discussed at getsolus#6540 (comment)
- Tests are disabled because they require following dependencies
  - [Icarus Verilog](https://steveicarus.github.io/iverilog/) - for Verilog simulation
  - [shUnit2](https://github.com/kward/shunit2) - test framework
@github-project-automation github-project-automation bot moved this to Triage in Solus Nov 9, 2025
@liontiger23 liontiger23 marked this pull request as draft November 9, 2025 02:56
@liontiger23
Copy link
Contributor Author

liontiger23 commented Nov 9, 2025

@GZGavinZhao please take a look

I tried to switch remaining packages to %haskell_* macros, but in some places I did have to inline them.

I am thinking that we could introduce several more macros:

  • %cabal_install_build_tool (or something along those lines) that would do something like this:
    cabal update
    cabal install $@
    for exe in "$@"; do
      cp "$HOME/.cabal/bin/$exe" "/usr/bin/$exe"
    done
    
    We can use it install build-only executables:
    • in ghcup to install hspec-discover
      %cabal_install_build_tool hspec-discover
      
    • in sv2v to install alex and happy
      %cabal_install_build_tool alex happy
      
  • %cabal_build_dependencies and %haskell_configure_exe which are just outlined parts of existing
    %cabal_configure macro
    • %cabal_build_dependencies
      cabal update
      cabal build %JOBS% --only-dependencies --disable-tests -O2 --ghc-options="-H128m %JOBS%" "$@"
      
    • %haskell_configure_exe
      %haskell_configure --disable-executable-dynamic \
                         --package-db=$HOME/.cabal/store/ghc-$GHCV/package.db \
                         "$@"
      
    Then to solve passing flags to pandoc library we could do
    %cabal_build_dependencies --constraint="crypton-x509-store == 1.6.11" \
                              --constraint="pandoc +embed_data_files"
    %haskell_configure_exe
    

%cabal_configure -f+tar -f+tui --enable-tests
%cabal_configure -f+tar -f+tui --enable-tests \
--constraint='brick >=2.5 && <2.8'
cabal install hspec-discover
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could be %cabal_install_build_tool hspec-discover

mkdir -p $installdir/usr/bin
cabal install --installdir=$installdir/usr/bin --install-method=copy exe:ghcup
%haskell_install exe:ghcup
rm -rf $installdir/%libdir%
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we can also bundle this rm -rf somewhere into %haskell_install_exe or something like that?

setup : |
rm $workdir/cabal.project.freeze
%cabal_configure --enable-tests
%cabal_configure --constraint="crypton-x509-store == 1.6.11" --enable-tests
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Here %cabal_configure works because --constraint contains only version specification

--disable-executable-dynamic \
--ghc-options="-H512m %JOBS%" \
-f embed_data_files
cabal build %JOBS% --only-dependencies --disable-tests -O2 --ghc-options="-H128m %JOBS%" \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This could be

%cabal_build_dependencies --constraint="crypton-x509-store == 1.6.11" \
                          --constraint="pandoc +embed_data_files"
%haskell_configure_exe

export CABAL_DIR="$HOME/.cabal"
cabal update
cabal configure -O2 %JOBS% --disable-executable-dynamic
cabal install alex happy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could be %cabal_install_build_tool alex happy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant