Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ghc-9.12.1-release #575

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/ghc-9.12.1-ghc-9.10.1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: ghc-lib-ghc-9.12.1-ghc-9.10.1
on:
push:
pull_request:
jobs:
runhaskell:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, macos, windows]
steps:
- uses: actions/checkout@v4
- uses: haskell-actions/setup@v2
id: setup-haskell
with:
ghc-version: 9.10.1
cabal-version: 'latest'
- name: Install build tools (macOS)
run: brew install automake
if: matrix.os == 'macos'
- name: Configure msys2 (windows)
shell: bash
run: |-
echo "MSYSTEM=CLANG64" >> $GITHUB_ENV
echo "/c/mingw64/usr/bin" >> $GITHUB_PATH
echo "/c/msys64/usr/bin" >> $GITHUB_PATH
if: matrix.os == 'windows'
- name: Run CI.hs (windows)
shell: C:\msys64\usr\bin\bash.exe --noprofile --norc -e -o pipefail '{0}'
run: |-
pacman -S autoconf automake-wrapper make patch python tar mintty --noconfirm
cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-9.12.1
if: matrix.os == 'windows'
- name: Run CI.hs (unix)
shell: bash
run: cabal run exe:ghc-lib-build-tool -- --ghc-flavor ghc-9.12.1
if: matrix.os == 'ubuntu' || matrix.os == 'macos'
4 changes: 2 additions & 2 deletions .github/workflows/ormolu-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- uses: haskell-actions/run-ormolu@v16
with:
pattern: |
CI.hs
ghc-lib-gen/src/*.hs
# CI.hs
# ghc-lib-gen/src/*.hs
examples/ghc-lib-test-utils/src/*.hs
mode: check
31 changes: 23 additions & 8 deletions CI.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

-- Copyright (c) 2019-2024 Digital Asset (Switzerland) GmbH and/or
-- its affiliates. All rights reserved. SPDX-License-Identifier:
-- (Apache-2.0 OR BSD-3-Clause)
Expand Down Expand Up @@ -99,7 +100,7 @@ data DaFlavor = DaFlavor

-- Last tested gitlab.haskell.org/ghc/ghc.git at
current :: String
current = "caaf53881d5cc82ebff617f39ad5363429d2eccf" -- 2024-11-25
current = "bfacc086604c18e30758772a05a8c81e3a4e01bc" -- 2024-12-16

Choose a reason for hiding this comment

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

Is there a reason we use bfacc086604c18e30758772a05a8c81e3a4e01bc instead of https://gitlab.haskell.org/ghc/ghc/-/commit/daf659b6e3c8f2a84100fbee797cd9d457c00df5 from https://gitlab.haskell.org/ghc/ghc/-/tags/ghc-9.12.1-release ? Is it a question of what's furthest along on master?

Copy link
Contributor Author

@shayne-fletcher shayne-fletcher Dec 19, 2024

Choose a reason for hiding this comment

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

i tend to put here whatever the prevailing up to the minute SHA (https://gitlab.haskell.org/ghc/ghc/-/commits/master) is on the day that i prepare the PR.


ghcFlavorOpt :: GhcFlavor -> String
ghcFlavorOpt = \case
Expand Down Expand Up @@ -344,18 +345,32 @@ buildDists ghcFlavor noGhcCheckout noBuilds versionSuffix = do
gitCheckout ghcFlavor
system_ "cd ghc && git checkout ."

-- Move this directory so that we can include/exclude it from
-- hs-source-dirs conditionally depdending on the build compiler
-- version.
ghcBootThGHCInternalDirExists <- doesDirectoryExist "ghc/libraries/ghc-boot-th/GHC/Internal"
when ghcBootThGHCInternalDirExists $ do
system_ "bash -c \"mkdir -p ghc/libraries/ghc-boot-th-internal/GHC\""
system_ "bash -c \"mv ghc/libraries/ghc-boot-th/GHC/Internal ghc/libraries/ghc-boot-th-internal/GHC\""

version <- tag
let pkg_ghclib = "ghc-lib-" ++ version
pkg_ghclib_parser = "ghc-lib-parser-" ++ version
ghcFlavorArg = ghcFlavorOpt ghcFlavor

system_ "cabal build exe:ghc-lib-gen"
system_ $ "cabal run exe:ghc-lib-gen -- ghc ../patches --ghc-lib-parser " ++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor
#if __GLASGOW_HASKELL__ < 912
let extraCabalFlags = ""
#else
let extraCabalFlags = "--allow-newer=\"hashable:base,unordered-containers:template-haskell\" "
#endif

system_ $ "cabal build " ++ extraCabalFlags ++ "exe:ghc-lib-gen"
system_ $ "cabal run " ++ extraCabalFlags ++ "exe:ghc-lib-gen -- ghc ../patches --ghc-lib-parser " ++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor
patchVersion version "ghc/ghc-lib-parser.cabal"
mkTarball pkg_ghclib_parser
renameDirectory pkg_ghclib_parser "ghc-lib-parser"
removeFile "ghc/ghc-lib-parser.cabal"
system_ $ "cabal run exe:ghc-lib-gen -- ghc ../patches --ghc-lib " ++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor ++ " --skip-init"
system_ $ "cabal run " ++ extraCabalFlags ++ "exe:ghc-lib-gen -- ghc ../patches --ghc-lib " ++ ghcFlavorArg ++ " " ++ cppOpts ghcFlavor ++ " --skip-init"
patchVersion version "ghc/ghc-lib.cabal"
patchConstraints version "ghc/ghc-lib.cabal"
mkTarball pkg_ghclib
Expand Down Expand Up @@ -413,16 +428,16 @@ buildDists ghcFlavor noGhcCheckout noBuilds versionSuffix = do

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 ++ "\""
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 ++ "\""
system_ "cabal exec -- ghc -ignore-dot-ghci -package=ghc-lib-parser -e \"print 1\""
system_ "cabal exec -- ghc -ignore-dot-ghci -package=ghc-lib -e \"print 1\""
system_ "cabal -v0 exec -- ghc -ignore-dot-ghci -package=ghc-lib-parser -e \"print 1\""
system_ "cabal -v0 exec -- ghc -ignore-dot-ghci -package=ghc-lib -e \"print 1\""
dylant-da marked this conversation as resolved.
Show resolved Hide resolved

-- Something like, "8.8.1.20190828".
tag -- The return value of type 'IO string'.
where
writeCabalCmdFile :: String -> IO ()
writeCabalCmdFile exe = do
let filename = exe
cmd = "cabal run exe:" ++ exe ++ " --project-dir ../.. -- "
cmd = "cabal -v0 run exe:" ++ exe ++ " --project-dir ../.. -- "
dylant-da marked this conversation as resolved.
Show resolved Hide resolved
writeFile filename cmd

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

branch :: GhcFlavor -> String
branch = \case
Ghc9121 -> "ghc-9.12"
Ghc9121 -> "ghc-9.12.1-release"
Ghc9101 -> "ghc-9.10.1-release"
Ghc984 -> "ghc-9.8.4-release"
Ghc983 -> "ghc-9.8.3-release"
Expand Down
60 changes: 42 additions & 18 deletions ghc-lib-gen/src/Ghclibgen.hs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ allHsSrcDirs forDepends ghcFlavor lib =
[dir | forDepends, dir <- [stage0Ghci, stage0GhcHeap]],
[stage0GhcBoot | ghcSeries ghcFlavor >= GHC_8_10],
map takeDirectory (cabalFileLibraries ghcFlavor),
map (dropTrailingPathSeparator . normalise) (askFiles lib "hs-source-dirs:")
map (dropTrailingPathSeparator . normalise) (askFiles lib "hs-source-dirs:"),
["libraries/ghc-boot-th-internal"]
]

-- The "hs-source-dirs" for 'ghc-lib-parser'.
Expand Down Expand Up @@ -141,8 +142,8 @@ ghcLibHsSrcDirs forDepends ghcFlavor lib =
GHC_9_6 -> ["libraries/template-haskell", "libraries/ghc-boot-th", "libraries/ghc-boot", "libraries/ghc-heap", "libraries/ghci"]
GHC_9_8 -> ["libraries/template-haskell", "libraries/ghc-boot-th", "libraries/ghc-boot", "libraries/ghc-heap", "libraries/ghc-platform/src", "libraries/ghc-platform"]
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"]
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"]
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"]
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"]
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"]
in sortDiffListByLength all $ Set.fromList [dir | not forDepends, dir <- exclusions]

-- File path constants.
Expand Down Expand Up @@ -279,7 +280,7 @@ ghcNumericVersion = do

cabalPackageDb :: String -> IO String
cabalPackageDb ghcNumericVersion = do
cabalStoreDir <- replace "\\" "\\\\" <$> systemOutput_ "cabal path --store-dir"
cabalStoreDir <- replace "\\" "\\\\" <$> systemOutput_ "cabal -v0 path --store-dir"
dylant-da marked this conversation as resolved.
Show resolved Hide resolved
ghcInfo <- getGhcInfo
let ghcInfoMap = Map.fromList ghcInfo
let ghcDir =
Expand Down Expand Up @@ -1198,12 +1199,12 @@ baseBounds = \case
Ghc984 -> "base >= 4.17 && < 4.20" -- [ghc-9.4.1, ghc-9.10.1)
-- base-4.20.0.0
Ghc9101 -> "base >= 4.18 && < 4.21" -- [ghc-9.6.1, ghc-9.12.1)
-- base-4.20.0.0 TODO bump
Ghc9121 -> "base >= 4.18 && < 4.21" -- [ghc-9.6.1, ghc-9.12.1)
-- base-4.21.0.0
Ghc9121 -> "base >= 4.19 && < 4.22" -- [ghc-9.8.1, ghc-9.14.1)
GhcMaster ->
-- e.g. "9.11.20230119"
-- (c.f. 'rts/include/ghcversion.h')
"base >= 4.18 && < 4.21" -- [ghc-9.6.1, ghc-9.12.1)
"base >= 4.19 && < 4.22" -- [ghc-9.8.1, ghc-9.14.1)

-- Common build dependencies.
commonBuildDepends :: GhcFlavor -> Data.List.NonEmpty.NonEmpty String
Expand All @@ -1214,7 +1215,7 @@ commonBuildDepends ghcFlavor =
base = [baseBounds ghcFlavor]
specific
| ghcSeries ghcFlavor >= GHC_9_12 =
[ "ghc-prim > 0.2 && < 0.12",
[ "ghc-prim > 0.2 && < 0.14",
"containers >= 0.6.2.1 && < 0.8",
"bytestring >= 0.11.4 && < 0.13",
"time >= 1.4 && < 1.15",
Expand Down Expand Up @@ -1307,12 +1308,8 @@ libBinParserLibModules ghcFlavor = do
libModules <- filterGhcInternalModules <$> calcLibModules ghcFlavor
return (lib, [bin], parserModules, libModules)
where
keptGhcInternalModules :: [String]
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"]

filterGhcInternalModules :: [String] -> [String]
filterGhcInternalModules mods =
[f | f <- mods, not ("GHC.Internal" `isPrefixOf` f) || (f `elem` keptGhcInternalModules)]
filterGhcInternalModules = filter (not . isInfixOf "GHC.Internal")

happyBounds :: GhcFlavor -> String
happyBounds ghcFlavor
Expand Down Expand Up @@ -1407,6 +1404,13 @@ generateGhcLibCabal ghcFlavor customCppOpts = do
],
[" reexported-modules:"],
indent2 (Data.List.NonEmpty.toList (withCommas (Data.List.NonEmpty.fromList $ nubSort parserModules))),
if ghcSeries ghcFlavor > GHC_9_10 then
join [
[" if impl(ghc < 9.12.1)"],
[" reexported-modules:"],
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"])))
]
else [],
[ " exposed-modules:",
" Paths_ghc_lib"
],
Expand Down Expand Up @@ -1446,8 +1450,10 @@ performExtraFilesSubstitutions ghcFlavor files =
generateGhcLibParserCabal :: GhcFlavor -> [String] -> IO ()
generateGhcLibParserCabal ghcFlavor customCppOpts = do
(lib, _bin, parserModules, _) <- libBinParserLibModules ghcFlavor
let hsSrcDirs = replace ["libraries/ghc-boot-th/../ghc-internal/src"] ["libraries/ghc-internal/src"] (ghcLibParserHsSrcDirs False ghcFlavor lib)
let includeDirs = replace ["libraries/ghc-internal/include"] [] (ghcLibParserIncludeDirs ghcFlavor)
-- Remove 'ghc-interal/src', 'ghc-boot-th/internal' etc. They are
-- dealt with later explicitly.
let hsSrcDirs = filter (not . isInfixOf "internal") $ ghcLibParserHsSrcDirs False ghcFlavor lib
let includeDirs = filter (/= "libraries/ghc-internal/include") $ ghcLibParserIncludeDirs ghcFlavor
keepCAFsForCHCiExists <- doesFileExist "compiler/cbits/keepCAFsForGHCi.c"
writeFile "ghc-lib-parser.cabal" . unlines . map trimEnd . join $
[ [ "cabal-version: 3.0",
Expand Down Expand Up @@ -1528,7 +1534,17 @@ generateGhcLibParserCabal ghcFlavor customCppOpts = do
indent2 [x | ghcSeries ghcFlavor >= GHC_9_0, x <- ["GHC.Parser.Lexer", "GHC.Parser"]],
indent2 [x | ghcSeries ghcFlavor < GHC_9_0, x <- ["Lexer", "Parser"]],
[" exposed-modules:"],
indent2 parserModules
indent2 parserModules,
if ghcSeries ghcFlavor > GHC_9_10 then
join [
[" if impl(ghc < 9.12.1)"],
[" hs-source-dirs:"],
[" libraries/ghc-internal/src"],
[" libraries/ghc-boot-th-internal"],
[" exposed-modules:"],
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"]
]
else []
]
putStrLn "# Generating 'ghc-lib-parser.cabal'... Done!"

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

-- When there is a new GHC release it takes time for package bounds
-- to get updated.
#if __GLASGOW_HASKELL__ == 912
let hadrianExtraCabalFlags = "--allow-newer "
#else
let hadrianExtraCabalFlags = ""
#endif

system_ "bash -c ./boot"
system_ "bash -c \"./configure --enable-tarballs-autodownload\""
withCurrentDirectory "hadrian" $ do
system_ "cabal build exe:hadrian --ghc-options=-j"
system_ $ "cabal build " ++ hadrianExtraCabalFlags ++ "exe:hadrian --ghc-options=-j"
system_ . unwords . join $
[ [ "cabal run exe:hadrian --",
[ [ "cabal run " ++ hadrianExtraCabalFlags ++ "exe:hadrian --",
"--directory=..",
"--build-root=ghc-lib"
],
Expand Down
Loading