Skip to content

Commit 46b9ac7

Browse files
committed
macros: prepare haskell macros for GHC 3.8 update
In newer [GHC 3.8.*](haskell/cabal#9326 (comment)) default directory for package DB storage has been changed to include "ABI tag". So instead of `~/.cabal/store/ghc-9.8.4` it is now located at `~/.cabal/store/ghc-9.8.4-inplace` (when built with our scripts) or may use any other suffix (`ghcup` version of ghc for example has tag `-c895`. This messes up `%cabal_configure` macro as we have to pass package DB location explicitly with `--package-db`. However, correct GHC id (including ABI tag) can be obtained with command `ghc-pkg field ghc id`, which works both for current GHC 9.4.8 in repos and for 9.8.4 as well. For GHC 9.4.8: ```bash $ ghc-pkg field ghc id id: ghc-9.4.8 ``` For GHC 9.8.4 (built with our scripts): ```bash $ ghc-pkg field ghc id id: ghc-9.8.4-inplace ```
1 parent 1c50377 commit 46b9ac7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

data/macros/actions/haskell.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ actions:
77
echo "import Distribution.Simple" > Setup.hs
88
echo "main = defaultMain" >> Setup.hs
99
fi
10-
export GHCV=$(ghc --numeric-version)
1110
runhaskell Setup configure --prefix=%PREFIX% \
1211
--libdir=%libdir% \
1312
--libsubdir="\$compiler/lib/\$abi/\$pkg-\$version" \
@@ -44,11 +43,11 @@ actions:
4443
- cabal_configure: |
4544
function cabal_configure() {
4645
export CABAL_DIR="$HOME/.cabal"
47-
export GHCV=$(ghc --numeric-version)
46+
export GHCV=$(ghc-pkg field ghc id | cut -d ' ' -f 2)
4847
cabal update
4948
cabal build %JOBS% --only-dependencies --disable-tests -O2 --ghc-options="-H128m %JOBS%" "$@"
5049
%haskell_configure --disable-executable-dynamic \
51-
--package-db=$HOME/.cabal/store/ghc-$GHCV/package.db \
50+
--package-db=$HOME/.cabal/store/$GHCV/package.db \
5251
"$@"
5352
}
5453
cabal_configure

0 commit comments

Comments
 (0)