Skip to content

Commit 23f5b95

Browse files
fixes for GHC head (#627)
1 parent d18b818 commit 23f5b95

File tree

4 files changed

+33
-4
lines changed

4 files changed

+33
-4
lines changed

.github/workflows/ghc-lib-ghc-HEAD-ghc-9.12.1.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@ jobs:
2020
- name: Install build tools (macOS)
2121
run: brew install automake
2222
if: matrix.os == 'macos'
23+
- name: Install build tools (ubuntu)
24+
run: sudo apt-get update && sudo apt-get install -y libffi-dev
25+
if: matrix.os == 'ubuntu'
2326
- name: Configure msys2 (windows)
2427
shell: bash
2528
run: |-
2629
echo "MSYSTEM=CLANG64" >> $GITHUB_ENV
30+
echo "/c/msys64/clang64/bin" >> $GITHUB_PATH
2731
echo "/c/mingw64/usr/bin" >> $GITHUB_PATH
2832
echo "/c/msys64/usr/bin" >> $GITHUB_PATH
2933
if: matrix.os == 'windows'
3034
- name: Run CI.hs (windows)
3135
shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}'
3236
run: |-
33-
pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm
37+
pacman -S autoconf automake-wrapper make patch python tar mintty mingw-w64-clang-x86_64-libffi mingw-w64-clang-x86_64-pkgconf --noconfirm
3438
cabal run exe:ghc-lib-build-tool -- --ghc-flavor ""
3539
if: matrix.os == 'windows'
3640
- name: Run CI.hs (unix)

.github/workflows/ghc-lib-ghc-master-ghc-9.12.1.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,21 @@ jobs:
2020
- name: Install build tools (macOS)
2121
run: brew install automake
2222
if: matrix.os == 'macos'
23+
- name: Install build tools (ubuntu)
24+
run: sudo apt-get update && sudo apt-get install -y libffi-dev
25+
if: matrix.os == 'ubuntu'
2326
- name: Configure msys2 (windows)
2427
shell: bash
2528
run: |-
2629
echo "MSYSTEM=CLANG64" >> $GITHUB_ENV
30+
echo "/c/msys64/clang64/bin" >> $GITHUB_PATH
2731
echo "/c/mingw64/usr/bin" >> $GITHUB_PATH
2832
echo "/c/msys64/usr/bin" >> $GITHUB_PATH
2933
if: matrix.os == 'windows'
3034
- name: Run CI.hs (windows)
3135
shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}'
3236
run: |-
33-
pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm
37+
pacman -S autoconf automake-wrapper make patch python tar mintty mingw-w64-clang-x86_64-libffi mingw-w64-clang-x86_64-pkgconf --noconfirm
3438
cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-master
3539
if: matrix.os == 'windows'
3640
- name: Run CI.hs (unix)

CI.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ data DaFlavor = DaFlavor
110110

111111
-- Last tested gitlab.haskell.org/ghc/ghc.git at
112112
current :: String
113-
current = "7b9c20f4c3c82a534d22bb56e6bebf2ec0491a82" -- 2025-12-28
113+
current = "b18b2c42c32488ad6d3480a56a1fcd753cad2023" -- 2026-01-17
114114

115115
ghcFlavorOpt :: GhcFlavor -> String
116116
ghcFlavorOpt = \case

ghc-lib-gen/src/Ghclibgen.hs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import System.Directory
6565
import System.Directory.Extra
6666
import System.FilePath hiding (dropTrailingPathSeparator, normalise, (</>))
6767
import System.FilePath.Posix (dropTrailingPathSeparator, normalise, (</>))
68+
import System.Info (os)
6869
import System.IO.Error (isEOFError)
6970
import System.IO.Extra
7071
import System.Process.Extra
@@ -1785,7 +1786,27 @@ generatePrerequisites ghcFlavor allowNewerSpecs = do
17851786
)
17861787

17871788
system_ "bash -c ./boot"
1788-
system_ "bash -c \"./configure --enable-tarballs-autodownload\""
1789+
ffiArgs <- if ghcSeries ghcFlavor >= GHC_9_16
1790+
then do
1791+
-- GHC 9.16+ bundles libffi-clib by default; we need to use
1792+
-- system libffi instead. On macOS, use xcrun to find the SDK
1793+
-- path (pkg-config often has stale paths). On other platforms,
1794+
-- use pkg-config.
1795+
(ffiIncludeDir, ffiLibDir) <-
1796+
if os == "darwin"
1797+
then do
1798+
-- macOS: use xcrun to find the SDK path (pkg-config often has stale paths)
1799+
sdkPath <- trim <$> systemOutput_ "xcrun --show-sdk-path"
1800+
pure (sdkPath ++ "/usr/include/ffi", "/usr/lib")
1801+
else do
1802+
-- Linux/Windows: use pkg-config
1803+
inc <- trim <$> systemOutput_ "pkg-config --variable=includedir libffi"
1804+
lib <- trim <$> systemOutput_ "pkg-config --variable=libdir libffi"
1805+
pure (inc, lib)
1806+
pure ["--with-system-libffi", "--with-ffi-includes=" ++ ffiIncludeDir, "--with-ffi-libraries=" ++ ffiLibDir]
1807+
else pure []
1808+
let configureArgs = unwords $ ["--enable-tarballs-autodownload"] ++ ffiArgs
1809+
system_ $ "bash -c \"./configure " ++ configureArgs ++ "\""
17891810
withCurrentDirectory "hadrian" $ do
17901811

17911812
let allowNewerArgs = mkAllowNewerFlagsList allowNewerSpecs

0 commit comments

Comments
 (0)