diff options
author | John Ericson <git@JohnEricson.me> | 2019-05-08 02:52:35 -0400 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-04 21:44:29 -0400 |
commit | 05419e55cab272ed39790695f448b311f22669f7 (patch) | |
tree | b3f652d4eb27c0ad6108edd6bca5fc73e165981a /hadrian/src/Settings/Builders/Cabal.hs | |
parent | ec93d2a90a2d4f189feafd21575b9e9ba5ba9a5d (diff) | |
download | haskell-05419e55cab272ed39790695f448b311f22669f7.tar.gz |
Per stage headers, ghc_boot_platform.h -> stage 0 ghcplatform.h
The generated headers are now generated per stage, which means we can
skip hacks like `ghc_boot_platform.h` and just have that be the stage 0
header as proper. In general, stages are to be embraced: freely generate
everything in each stage but then just build what you depend on, and
everything is symmetrical and efficient. Trying to avoid stages because
bootstrapping is a mind bender just creates tons of bespoke
mini-mind-benders that add up to something far crazier.
Hadrian was pretty close to this "stage-major" approach already, and so
was fairly easy to fix. Make needed more work, however: it did know
about stages so at least there was a scaffold, but few packages except
for the compiler cared, and the compiler used its own counting system.
That said, make and Hadrian now work more similarly, which is good for
the transition to Hadrian. The merits of embracing stage aside, the
change may be worthy for easing that transition alone.
Diffstat (limited to 'hadrian/src/Settings/Builders/Cabal.hs')
-rw-r--r-- | hadrian/src/Settings/Builders/Cabal.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/hadrian/src/Settings/Builders/Cabal.hs b/hadrian/src/Settings/Builders/Cabal.hs index 96f67b4abf..763f51636b 100644 --- a/hadrian/src/Settings/Builders/Cabal.hs +++ b/hadrian/src/Settings/Builders/Cabal.hs @@ -99,15 +99,16 @@ libraryArgs = do configureArgs :: Args configureArgs = do top <- expr topDirectory - root <- getBuildRoot pkg <- getPackage + stage <- getStage + libPath <- expr $ stageLibPath stage let conf key expr = do values <- unwords <$> expr not (null values) ? arg ("--configure-option=" ++ key ++ "=" ++ values) cFlags = mconcat [ remove ["-Werror"] cArgs , getStagedSettingList ConfCcArgs - , arg $ "-I" ++ top -/- root -/- generatedDir + , arg $ "-I" ++ libPath -- See https://github.com/snowleopard/hadrian/issues/523 , arg $ "-iquote" , arg $ top -/- pkgPath pkg @@ -127,7 +128,7 @@ configureArgs = do , conf "--with-curses-libraries" $ arg =<< getSetting CursesLibDir , flag CrossCompiling ? (conf "--host" $ arg =<< getSetting TargetPlatformFull) , conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage - , notStage0 ? (arg =<< ("--ghc-option=-ghcversion-file=" ++) <$> expr ((-/-) <$> topDirectory <*> ghcVersionH))] + , notStage0 ? (arg =<< ("--ghc-option=-ghcversion-file=" ++) <$> expr ((-/-) <$> topDirectory <*> ghcVersionH stage))] bootPackageConstraints :: Args bootPackageConstraints = stage0 ? do @@ -140,8 +141,9 @@ bootPackageConstraints = stage0 ? do cppArgs :: Args cppArgs = do - root <- getBuildRoot - arg $ "-I" ++ root -/- generatedDir + stage <- getStage + libPath <- expr $ stageLibPath stage + arg $ "-I" ++ libPath withBuilderKey :: Builder -> String withBuilderKey b = case b of |