@@ -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
280281cabalPackageDb :: String -> IO String
281282cabalPackageDb 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.
12091210commonBuildDepends :: 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
13171314happyBounds :: GhcFlavor -> String
13181315happyBounds 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 =
14461450generateGhcLibParserCabal :: GhcFlavor -> [String ] -> IO ()
14471451generateGhcLibParserCabal 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