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/Base.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/Base.hs')
-rw-r--r-- | hadrian/src/Base.hs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/hadrian/src/Base.hs b/hadrian/src/Base.hs index bc4eab354e..f7f1029d4e 100644 --- a/hadrian/src/Base.hs +++ b/hadrian/src/Base.hs @@ -23,7 +23,7 @@ module Base ( -- * Paths hadrianPath, configPath, configFile, sourcePath, shakeFilesDir, - generatedDir, generatedPath, stageBinPath, stageLibPath, templateHscPath, + stageBinPath, stageLibPath, templateHscPath, ghcBinDeps, ghcLibDeps, includesDependencies, haddockDeps, relativePackageDbPath, packageDbPath, packageDbStamp, mingwStamp, ) where @@ -68,22 +68,14 @@ sourcePath = hadrianPath -/- "src" configH :: FilePath configH = "mk/config.h" -ghcVersionH :: Action FilePath -ghcVersionH = generatedPath <&> (-/- "ghcversion.h") +ghcVersionH :: Stage -> Action FilePath +ghcVersionH stage = stageLibPath stage <&> (-/- "ghcversion.h") -- | The directory in 'buildRoot' containing the Shake database and other -- auxiliary files generated by Hadrian. shakeFilesDir :: FilePath shakeFilesDir = "hadrian" --- | The directory in 'buildRoot' containing generated source files that are not --- package-specific, e.g. @ghcplatform.h@. -generatedDir :: FilePath -generatedDir = "generated" - -generatedPath :: Action FilePath -generatedPath = buildRoot <&> (-/- generatedDir) - -- | Path to the package database for a given build stage, relative to the build -- root. relativePackageDbPath :: Stage -> FilePath @@ -122,10 +114,11 @@ ghcBinDeps stage = mapM (\f -> stageLibPath stage <&> (-/- f)) , "ghci-usage.txt" ] -includesDependencies :: Action [FilePath] -includesDependencies = do - path <- generatedPath - return $ (path -/-) <$> [ "ghcautoconf.h", "ghcplatform.h", "ghcversion.h" ] +includesDependencies :: Stage -> Action [FilePath] +includesDependencies stage = do + p <- stageLibPath stage + pure $ (p -/-) <$> + [ "ghcautoconf.h", "ghcplatform.h", "ghcversion.h" ] -- | Files the `haddock` binary depends on haddockDeps :: Stage -> Action [FilePath] |