Skip to content

Commit 03f0dbc

Browse files
ghc-9.12.1-release (#575)
1 parent 0300c19 commit 03f0dbc

File tree

4 files changed

+106
-28
lines changed

4 files changed

+106
-28
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: ghc-lib-ghc-9.12.1-ghc-9.10.1
2+
on:
3+
push:
4+
pull_request:
5+
jobs:
6+
runhaskell:
7+
name: ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}-latest
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os: [ubuntu, macos, windows]
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: haskell-actions/setup@v2
16+
id: setup-haskell
17+
with:
18+
ghc-version: 9.10.1
19+
cabal-version: 'latest'
20+
- name: Install build tools (macOS)
21+
run: brew install automake
22+
if: matrix.os == 'macos'
23+
- name: Configure msys2 (windows)
24+
shell: bash
25+
run: |-
26+
echo "MSYSTEM=CLANG64" >> $GITHUB_ENV
27+
echo "/c/mingw64/usr/bin" >> $GITHUB_PATH
28+
echo "/c/msys64/usr/bin" >> $GITHUB_PATH
29+
if: matrix.os == 'windows'
30+
- name: Run CI.hs (windows)
31+
shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}'
32+
run: |-
33+
pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm
34+
cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-9.12.1
35+
if: matrix.os == 'windows'
36+
- name: Run CI.hs (unix)
37+
shell: bash
38+
run: cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-9.12.1
39+
if: matrix.os == 'ubuntu' || matrix.os == 'macos'

.github/workflows/ormolu-check.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
- uses: haskell-actions/run-ormolu@v16
1111
with:
1212
pattern: |
13-
CI.hs
14-
ghc-lib-gen/src/*.hs
13+
# CI.hs
14+
# ghc-lib-gen/src/*.hs
1515
examples/ghc-lib-test-utils/src/*.hs
1616
mode: check

CI.hs

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
-- Copyright (c) 2019-2024 Digital Asset (Switzerland) GmbH and/or
23
-- its affiliates. All rights reserved. SPDX-License-Identifier:
34
-- (Apache-2.0 OR BSD-3-Clause)
@@ -99,7 +100,7 @@ data DaFlavor = DaFlavor
99100

100101
-- Last tested gitlab.haskell.org/ghc/ghc.git at
101102
current :: String
102-
current = "caaf53881d5cc82ebff617f39ad5363429d2eccf" -- 2024-11-25
103+
current = "bfacc086604c18e30758772a05a8c81e3a4e01bc" -- 2024-12-16
103104

104105
ghcFlavorOpt :: GhcFlavor -> String
105106
ghcFlavorOpt = \case
@@ -344,18 +345,32 @@ buildDists ghcFlavor noGhcCheckout noBuilds versionSuffix = do
344345
gitCheckout ghcFlavor
345346
system_ "cd ghc && git checkout ."
346347

348+
-- Move this directory so that we can include/exclude it from
349+
-- hs-source-dirs conditionally depdending on the build compiler
350+
-- version.
351+
ghcBootThGHCInternalDirExists <- doesDirectoryExist "ghc/libraries/ghc-boot-th/GHC/Internal"
352+
when ghcBootThGHCInternalDirExists $ do
353+
system_ "bash -c \"mkdir -p ghc/libraries/ghc-boot-th-internal/GHC\""
354+
system_ "bash -c \"mv ghc/libraries/ghc-boot-th/GHC/Internal ghc/libraries/ghc-boot-th-internal/GHC\""
355+
347356
version <- tag
348357
let pkg_ghclib = "ghc-lib-" ++ version
349358
pkg_ghclib_parser = "ghc-lib-parser-" ++ version
350359
ghcFlavorArg = ghcFlavorOpt ghcFlavor
351360

352-
system_ "cabal build exe:ghc-lib-gen"
353-
system_ $ "cabal run exe:ghc-lib-gen -- ghc ../patches --ghc-lib-parser " ++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor
361+
#if __GLASGOW_HASKELL__ < 912
362+
let extraCabalFlags = ""
363+
#else
364+
let extraCabalFlags = "--allow-newer=\"hashable:base,unordered-containers:template-haskell\" "
365+
#endif
366+
367+
system_ $ "cabal build " ++ extraCabalFlags ++ "exe:ghc-lib-gen"
368+
system_ $ "cabal run " ++ extraCabalFlags ++ "exe:ghc-lib-gen -- ghc ../patches --ghc-lib-parser " ++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor
354369
patchVersion version "ghc/ghc-lib-parser.cabal"
355370
mkTarball pkg_ghclib_parser
356371
renameDirectory pkg_ghclib_parser "ghc-lib-parser"
357372
removeFile "ghc/ghc-lib-parser.cabal"
358-
system_ $ "cabal run exe:ghc-lib-gen -- ghc ../patches --ghc-lib " ++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor ++ " --skip-init"
373+
system_ $ "cabal run " ++ extraCabalFlags ++ "exe:ghc-lib-gen -- ghc ../patches --ghc-lib " ++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor ++ " --skip-init"
359374
patchVersion version "ghc/ghc-lib.cabal"
360375
patchConstraints version "ghc/ghc-lib.cabal"
361376
mkTarball pkg_ghclib
@@ -413,16 +428,16 @@ buildDists ghcFlavor noGhcCheckout noBuilds versionSuffix = do
413428

414429
system_ $ "cd examples/ghc-lib-test-mini-hlint && cabal test --project-dir ../.. --test-show-details direct --test-options \"--color always --test-command ../../ghc-lib-test-mini-hlint " ++ ghcFlavorArg ++ "\""
415430
system_ $ "cd examples/ghc-lib-test-mini-compile && cabal test --project-dir ../.. --test-show-details direct --test-options \"--color always --test-command ../../ghc-lib-test-mini-compile " ++ ghcFlavorArg ++ "\""
416-
system_ "cabal exec -- ghc -ignore-dot-ghci -package=ghc-lib-parser -e \"print 1\""
417-
system_ "cabal exec -- ghc -ignore-dot-ghci -package=ghc-lib -e \"print 1\""
431+
system_ "cabal -v0 exec -- ghc -ignore-dot-ghci -package=ghc-lib-parser -e \"print 1\""
432+
system_ "cabal -v0 exec -- ghc -ignore-dot-ghci -package=ghc-lib -e \"print 1\""
418433

419434
-- Something like, "8.8.1.20190828".
420435
tag -- The return value of type 'IO string'.
421436
where
422437
writeCabalCmdFile :: String -> IO ()
423438
writeCabalCmdFile exe = do
424439
let filename = exe
425-
cmd = "cabal run exe:" ++ exe ++ " --project-dir ../.. -- "
440+
cmd = "cabal -v0 run exe:" ++ exe ++ " --project-dir ../.. -- "
426441
writeFile filename cmd
427442

428443
cmd :: String -> IO ()
@@ -498,7 +513,7 @@ buildDists ghcFlavor noGhcCheckout noBuilds versionSuffix = do
498513

499514
branch :: GhcFlavor -> String
500515
branch = \case
501-
Ghc9121 -> "ghc-9.12"
516+
Ghc9121 -> "ghc-9.12.1-release"
502517
Ghc9101 -> "ghc-9.10.1-release"
503518
Ghc984 -> "ghc-9.8.4-release"
504519
Ghc983 -> "ghc-9.8.3-release"

ghc-lib-gen/src/Ghclibgen.hs

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ allHsSrcDirs forDepends ghcFlavor lib =
113113
[dir | forDepends, dir <- [stage0Ghci, stage0GhcHeap]],
114114
[stage0GhcBoot | ghcSeries ghcFlavor >= GHC_8_10],
115115
map takeDirectory (cabalFileLibraries ghcFlavor),
116-
map (dropTrailingPathSeparator . normalise) (askFiles lib "hs-source-dirs:")
116+
map (dropTrailingPathSeparator . normalise) (askFiles lib "hs-source-dirs:"),
117+
["libraries/ghc-boot-th-internal"]
117118
]
118119

119120
-- The "hs-source-dirs" for 'ghc-lib-parser'.
@@ -141,8 +142,8 @@ ghcLibHsSrcDirs forDepends ghcFlavor lib =
141142
GHC_9_6 -> ["libraries/template-haskell", "libraries/ghc-boot-th", "libraries/ghc-boot", "libraries/ghc-heap", "libraries/ghci"]
142143
GHC_9_8 -> ["libraries/template-haskell", "libraries/ghc-boot-th", "libraries/ghc-boot", "libraries/ghc-heap", "libraries/ghc-platform/src", "libraries/ghc-platform"]
143144
GHC_9_10 -> ["libraries/template-haskell", "libraries/ghc-boot-th", "libraries/ghc-boot", "libraries/ghc-heap", "libraries/ghc-platform/src", "libraries/ghc-platform", "libraries/ghci"]
144-
GHC_9_12 -> ["libraries/template-haskell", "libraries/ghc-boot-th", "libraries/ghc-boot", "libraries/ghc-heap", "libraries/ghc-platform/src", "libraries/ghc-platform", "libraries/ghci", "libraries/ghc-internal/src"]
145-
GHC_9_14 -> ["libraries/template-haskell", "libraries/ghc-boot-th", "libraries/ghc-boot", "libraries/ghc-heap", "libraries/ghc-platform/src", "libraries/ghc-platform", "libraries/ghci", "libraries/ghc-internal/src"]
145+
GHC_9_12 -> ["libraries/template-haskell", "libraries/ghc-boot-th", "libraries/ghc-boot-th-internal", "libraries/ghc-boot", "libraries/ghc-heap", "libraries/ghc-platform/src", "libraries/ghc-platform", "libraries/ghci", "libraries/ghc-internal/src"]
146+
GHC_9_14 -> ["libraries/template-haskell", "libraries/ghc-boot-th", "libraries/ghc-boot-th-internal", "libraries/ghc-boot", "", "libraries/ghc-heap", "libraries/ghc-platform/src", "libraries/ghc-platform", "libraries/ghci", "libraries/ghc-internal/src"]
146147
in sortDiffListByLength all $ Set.fromList [dir | not forDepends, dir <- exclusions]
147148

148149
-- File path constants.
@@ -279,7 +280,7 @@ ghcNumericVersion = do
279280

280281
cabalPackageDb :: String -> IO String
281282
cabalPackageDb ghcNumericVersion = do
282-
cabalStoreDir <- replace "\\" "\\\\" <$> systemOutput_ "cabal path --store-dir"
283+
cabalStoreDir <- replace "\\" "\\\\" <$> systemOutput_ "cabal -v0 path --store-dir"
283284
ghcInfo <- getGhcInfo
284285
let ghcInfoMap = Map.fromList ghcInfo
285286
let ghcDir =
@@ -1198,12 +1199,12 @@ baseBounds = \case
11981199
Ghc984 -> "base >= 4.17 && < 4.20" -- [ghc-9.4.1, ghc-9.10.1)
11991200
-- base-4.20.0.0
12001201
Ghc9101 -> "base >= 4.18 && < 4.21" -- [ghc-9.6.1, ghc-9.12.1)
1201-
-- base-4.20.0.0 TODO bump
1202-
Ghc9121 -> "base >= 4.18 && < 4.21" -- [ghc-9.6.1, ghc-9.12.1)
1202+
-- base-4.21.0.0
1203+
Ghc9121 -> "base >= 4.19 && < 4.22" -- [ghc-9.8.1, ghc-9.14.1)
12031204
GhcMaster ->
12041205
-- e.g. "9.11.20230119"
12051206
-- (c.f. 'rts/include/ghcversion.h')
1206-
"base >= 4.18 && < 4.21" -- [ghc-9.6.1, ghc-9.12.1)
1207+
"base >= 4.19 && < 4.22" -- [ghc-9.8.1, ghc-9.14.1)
12071208

12081209
-- Common build dependencies.
12091210
commonBuildDepends :: GhcFlavor -> Data.List.NonEmpty.NonEmpty String
@@ -1214,7 +1215,7 @@ commonBuildDepends ghcFlavor =
12141215
base = [baseBounds ghcFlavor]
12151216
specific
12161217
| ghcSeries ghcFlavor >= GHC_9_12 =
1217-
[ "ghc-prim > 0.2 && < 0.12",
1218+
[ "ghc-prim > 0.2 && < 0.14",
12181219
"containers >= 0.6.2.1 && < 0.8",
12191220
"bytestring >= 0.11.4 && < 0.13",
12201221
"time >= 1.4 && < 1.15",
@@ -1307,12 +1308,8 @@ libBinParserLibModules ghcFlavor = do
13071308
libModules <- filterGhcInternalModules <$> calcLibModules ghcFlavor
13081309
return (lib, [bin], parserModules, libModules)
13091310
where
1310-
keptGhcInternalModules :: [String]
1311-
keptGhcInternalModules = ["GHC.Internal.ForeignSrcLang", "GHC.Internal.LanguageExtensions", "GHC.Internal.Lexeme", "GHC.Internal.TH.Syntax", "GHC.Internal.TH.Ppr", "GHC.Internal.TH.PprLib", "GHC.Internal.TH.Lib.Map"]
1312-
13131311
filterGhcInternalModules :: [String] -> [String]
1314-
filterGhcInternalModules mods =
1315-
[f | f <- mods, not ("GHC.Internal" `isPrefixOf` f) || (f `elem` keptGhcInternalModules)]
1312+
filterGhcInternalModules = filter (not . isInfixOf "GHC.Internal")
13161313

13171314
happyBounds :: GhcFlavor -> String
13181315
happyBounds ghcFlavor
@@ -1407,6 +1404,13 @@ generateGhcLibCabal ghcFlavor customCppOpts = do
14071404
],
14081405
[" reexported-modules:"],
14091406
indent2 (Data.List.NonEmpty.toList (withCommas (Data.List.NonEmpty.fromList $ nubSort parserModules))),
1407+
if ghcSeries ghcFlavor > GHC_9_10 then
1408+
join [
1409+
[" if impl(ghc < 9.12.1)"],
1410+
[" reexported-modules:"],
1411+
indent3 (Data.List.NonEmpty.toList (withCommas (Data.List.NonEmpty.fromList [ "GHC.Internal.ForeignSrcLang", "GHC.Internal.LanguageExtensions", "GHC.Internal.Lexeme", "GHC.Internal.TH.Syntax", "GHC.Internal.TH.Ppr", "GHC.Internal.TH.PprLib", "GHC.Internal.TH.Lib.Map"])))
1412+
]
1413+
else [],
14101414
[ " exposed-modules:",
14111415
" Paths_ghc_lib"
14121416
],
@@ -1446,8 +1450,10 @@ performExtraFilesSubstitutions ghcFlavor files =
14461450
generateGhcLibParserCabal :: GhcFlavor -> [String] -> IO ()
14471451
generateGhcLibParserCabal ghcFlavor customCppOpts = do
14481452
(lib, _bin, parserModules, _) <- libBinParserLibModules ghcFlavor
1449-
let hsSrcDirs = replace ["libraries/ghc-boot-th/../ghc-internal/src"] ["libraries/ghc-internal/src"] (ghcLibParserHsSrcDirs False ghcFlavor lib)
1450-
let includeDirs = replace ["libraries/ghc-internal/include"] [] (ghcLibParserIncludeDirs ghcFlavor)
1453+
-- Remove 'ghc-interal/src', 'ghc-boot-th/internal' etc. They are
1454+
-- dealt with later explicitly.
1455+
let hsSrcDirs = filter (not . isInfixOf "internal") $ ghcLibParserHsSrcDirs False ghcFlavor lib
1456+
let includeDirs = filter (/= "libraries/ghc-internal/include") $ ghcLibParserIncludeDirs ghcFlavor
14511457
keepCAFsForCHCiExists <- doesFileExist "compiler/cbits/keepCAFsForGHCi.c"
14521458
writeFile "ghc-lib-parser.cabal" . unlines . map trimEnd . join $
14531459
[ [ "cabal-version: 3.0",
@@ -1528,7 +1534,17 @@ generateGhcLibParserCabal ghcFlavor customCppOpts = do
15281534
indent2 [x | ghcSeries ghcFlavor >= GHC_9_0, x <- ["GHC.Parser.Lexer", "GHC.Parser"]],
15291535
indent2 [x | ghcSeries ghcFlavor < GHC_9_0, x <- ["Lexer", "Parser"]],
15301536
[" exposed-modules:"],
1531-
indent2 parserModules
1537+
indent2 parserModules,
1538+
if ghcSeries ghcFlavor > GHC_9_10 then
1539+
join [
1540+
[" if impl(ghc < 9.12.1)"],
1541+
[" hs-source-dirs:"],
1542+
[" libraries/ghc-internal/src"],
1543+
[" libraries/ghc-boot-th-internal"],
1544+
[" exposed-modules:"],
1545+
indent3 [ "GHC.Internal.ForeignSrcLang", "GHC.Internal.LanguageExtensions", "GHC.Internal.Lexeme", "GHC.Internal.TH.Syntax", "GHC.Internal.TH.Ppr", "GHC.Internal.TH.PprLib", "GHC.Internal.TH.Lib.Map"]
1546+
]
1547+
else []
15321548
]
15331549
putStrLn "# Generating 'ghc-lib-parser.cabal'... Done!"
15341550

@@ -1546,12 +1562,20 @@ generatePrerequisites ghcFlavor = do
15461562
=<< readFile' "./mk/get-win32-tarballs.sh"
15471563
)
15481564

1565+
-- When there is a new GHC release it takes time for package bounds
1566+
-- to get updated.
1567+
#if __GLASGOW_HASKELL__ == 912
1568+
let hadrianExtraCabalFlags = "--allow-newer "
1569+
#else
1570+
let hadrianExtraCabalFlags = ""
1571+
#endif
1572+
15491573
system_ "bash -c ./boot"
15501574
system_ "bash -c \"./configure --enable-tarballs-autodownload\""
15511575
withCurrentDirectory "hadrian" $ do
1552-
system_ "cabal build exe:hadrian --ghc-options=-j"
1576+
system_ $ "cabal build " ++ hadrianExtraCabalFlags ++ "exe:hadrian --ghc-options=-j"
15531577
system_ . unwords . join $
1554-
[ [ "cabal run exe:hadrian --",
1578+
[ [ "cabal run " ++ hadrianExtraCabalFlags ++ "exe:hadrian --",
15551579
"--directory=..",
15561580
"--build-root=ghc-lib"
15571581
],

0 commit comments

Comments
 (0)