@@ -27,6 +27,7 @@ module Ghclibgen
2727 applyPatchStage ,
2828 applyPatchNoMonoLocalBinds ,
2929 applyPatchCmmParseNoImplicitPrelude ,
30+ applyPatchCompilerGHCParserLexer ,
3031 applyPatchCompilerGHCUnitTypes ,
3132 applyPatchHadrianCabalProject ,
3233 applyPatchGhcInternalEventWindowsHsc ,
@@ -141,7 +142,7 @@ ghcLibHsSrcDirs forDepends ghcFlavor lib =
141142 GHC_9_4 -> [" ghc-lib/stage0/libraries/ghc-boot/build" , " libraries/template-haskell" , " libraries/ghc-boot-th" , " libraries/ghc-heap" , " libraries/ghci" ]
142143 GHC_9_6 -> [" libraries/template-haskell" , " libraries/ghc-boot-th" , " libraries/ghc-boot" , " libraries/ghc-heap" , " libraries/ghci" ]
143144 GHC_9_8 -> [" libraries/template-haskell" , " libraries/ghc-boot-th" , " libraries/ghc-boot" , " libraries/ghc-heap" , " libraries/ghc-platform/src" , " libraries/ghc-platform" ]
144- 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" ]
145+ GHC_9_10 -> [" 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" ]
145146 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" ]
146147 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" ]
147148 in sortDiffListByLength all $ Set. fromList [dir | not forDepends, dir <- exclusions]
@@ -320,6 +321,9 @@ calcModuleDeps includeDirs _hsSrcDirs hsSrcIncludes ghcFlavor cabalPackageDb ghc
320321 [ [" ghc -M -dep-suffix '' -dep-makefile " ++ ghcMakeModeOutputFile],
321322 [" -clear-package-db -global-package-db -user-package-db -package-db " ++ cabalPackageDb],
322323 [" -package semaphore-compat" | series >= GHC_9_8 ],
324+ #if __GLASGOW_HASKELL__ == 908 && __GLASGOW_HASKELL_PATCHLEVEL1__ == 4
325+ [" -hide-package os-string" ], -- avoid System.OsString ambiguity with filepath-1.4.301.0
326+ #endif
323327 [" -fno-safe-haskell" | series >= GHC_9_0 ], -- avoid warning: [GHC-98887] -XGeneralizedNewtypeDeriving is not allowed in Safe Haskell; ignoring -XGeneralizedNewtypeDeriving
324328 [" -DBIGNUM_NATIVE" | series > GHC_9_12 ],
325329 includeDirs,
@@ -938,6 +942,7 @@ mangleCSymbols ghcFlavor = do
938942 in writeFile file
939943 . prefixSymbol genSym
940944 . prefixSymbol initGenSym
945+ . replace " #if !MIN_VERSION_GLASGOW_HASKELL(9,9,0,0)" " #if !MIN_VERSION_GLASGOW_HASKELL(9,8,4,0)"
941946 =<< readFile' file
942947 when (ghcFlavor == Ghc984 ) $
943948 let file = " compiler/cbits/genSym.c"
@@ -1070,6 +1075,13 @@ applyPatchHadrianCabalProject _ = do
10701075 cabalProject = " hadrian" </> " cabal.project"
10711076 cabalProjectFreeze = cabalProject ++ " .freeze"
10721077
1078+ applyPatchCompilerGHCParserLexer :: GhcFlavor -> IO ()
1079+ applyPatchCompilerGHCParserLexer ghcFlavor = do
1080+ when (ghcSeries ghcFlavor >= GHC_9_12 ) $ do
1081+ writeFile " compiler/GHC/Parser/Lexer.x"
1082+ . replace " {-# INLINE alexScanUser #-}" " "
1083+ =<< readFile' " compiler/GHC/Parser/Lexer.x"
1084+
10731085applyPatchCompilerGHCUnitTypes :: GhcFlavor -> IO ()
10741086applyPatchCompilerGHCUnitTypes ghcFlavor = do
10751087 when (ghcFlavor == Ghc9101 ) $ do
@@ -1314,7 +1326,7 @@ libBinParserLibModules ghcFlavor = do
13141326
13151327happyBounds :: GhcFlavor -> String
13161328happyBounds ghcFlavor
1317- | series < GHC_9_8 = " == 1.20.* "
1329+ | series < GHC_9_8 = " < 1.21 "
13181330 | otherwise = " == 1.20.* || == 2.0.2 || >= 2.1.2 && < 2.2" -- c.f. m4/fptools_happy.m4
13191331 where
13201332 series = ghcSeries ghcFlavor
@@ -1563,20 +1575,12 @@ generatePrerequisites ghcFlavor = do
15631575 =<< readFile' " ./mk/get-win32-tarballs.sh"
15641576 )
15651577
1566- -- When there is a new GHC release it takes time for package bounds
1567- -- to get updated.
1568- #if __GLASGOW_HASKELL__ == 912
1569- let hadrianExtraCabalFlags = " --allow-newer "
1570- #else
1571- let hadrianExtraCabalFlags = " "
1572- #endif
1573-
15741578 system_ " bash -c ./boot"
15751579 system_ " bash -c \" ./configure --enable-tarballs-autodownload\" "
15761580 withCurrentDirectory " hadrian" $ do
1577- system_ $ " cabal build " ++ hadrianExtraCabalFlags ++ " exe:hadrian --ghc-options=-j"
1581+ system_ " cabal build exe:hadrian --ghc-options=-j"
15781582 system_ . unwords . join $
1579- [ [ " cabal run " ++ hadrianExtraCabalFlags ++ " exe:hadrian --" ,
1583+ [ [ " cabal run exe:hadrian --" ,
15801584 " --directory=.." ,
15811585 " --build-root=ghc-lib"
15821586 ],
0 commit comments