summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2018-12-16 08:58:41 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2019-01-09 14:32:21 +0000
commit6486c6e49c53e75f37ed732b38c5be7ae64785e8 (patch)
tree187785dd532474cd34aa4e66846b12f28f09f8b9 /hadrian/src/Settings
parent6b70cf611e5ddc475edaa54b893d20990699ddb8 (diff)
downloadhaskell-6486c6e49c53e75f37ed732b38c5be7ae64785e8.tar.gz
Hadrian: Add support for building stage3
This ticket enables the building of a `stage3` compiler by making the build logic more consistent and predictable in Hadrian. Two of the main changes are: 1. In order to build anything at stageN we use the package database present at stageN. Fixing #16069 2. `haddock` and `ghc-tags` are built as stage1 executables (with the stage1 compiler) rather than as stage2 compiler. Fixing [hadrian#661](https://github.com/snowleopard/hadrian/issues/661) In order to build a stage3 compiler, you have to set the new `finalStage` hadrian option to `Stage3`.
Diffstat (limited to 'hadrian/src/Settings')
-rw-r--r--hadrian/src/Settings/Builders/Common.hs3
-rw-r--r--hadrian/src/Settings/Builders/Configure.hs3
-rw-r--r--hadrian/src/Settings/Builders/Make.hs9
-rw-r--r--hadrian/src/Settings/Default.hs9
4 files changed, 12 insertions, 12 deletions
diff --git a/hadrian/src/Settings/Builders/Common.hs b/hadrian/src/Settings/Builders/Common.hs
index 6846c4bc8d..cfe0911292 100644
--- a/hadrian/src/Settings/Builders/Common.hs
+++ b/hadrian/src/Settings/Builders/Common.hs
@@ -61,9 +61,8 @@ packageDatabaseArgs = do
stage <- getStage
dbPath <- expr (packageDbPath stage)
expr (need [dbPath -/- packageDbStamp])
- root <- getBuildRoot
prefix <- ifM (builder Ghc) (return "-package-db ") (return "--package-db=")
- arg $ prefix ++ root -/- relativePackageDbPath stage
+ arg $ prefix ++ dbPath
bootPackageDatabaseArgs :: Args
bootPackageDatabaseArgs = do
diff --git a/hadrian/src/Settings/Builders/Configure.hs b/hadrian/src/Settings/Builders/Configure.hs
index 068591dfbb..214aed6c27 100644
--- a/hadrian/src/Settings/Builders/Configure.hs
+++ b/hadrian/src/Settings/Builders/Configure.hs
@@ -7,7 +7,8 @@ import Settings.Builders.Common
configureBuilderArgs :: Args
configureBuilderArgs = do
gmpPath <- expr gmpBuildPath
- libffiPath <- expr libffiBuildPath
+ stage <- getStage
+ libffiPath <- expr (libffiBuildPath stage)
mconcat [ builder (Configure gmpPath) ? do
hostPlatform <- getSetting HostPlatform
buildPlatform <- getSetting BuildPlatform
diff --git a/hadrian/src/Settings/Builders/Make.hs b/hadrian/src/Settings/Builders/Make.hs
index 102ba54845..0433888279 100644
--- a/hadrian/src/Settings/Builders/Make.hs
+++ b/hadrian/src/Settings/Builders/Make.hs
@@ -10,11 +10,12 @@ makeBuilderArgs :: Args
makeBuilderArgs = do
threads <- shakeThreads <$> expr getShakeOptions
gmpPath <- expr gmpBuildPath
- libffiPath <- expr libffiBuildPath
+ libffiPaths <- forM [Stage1 ..] $ \s -> expr (libffiBuildPath s)
let t = show $ max 4 (threads - 2) -- Don't use all Shake's threads
- mconcat
- [ builder (Make gmpPath ) ? pure ["MAKEFLAGS=-j" ++ t]
- , builder (Make libffiPath) ? pure ["MAKEFLAGS=-j" ++ t, "install"] ]
+ mconcat $
+ (builder (Make gmpPath ) ? pure ["MAKEFLAGS=-j" ++ t]) :
+ [ builder (Make libffiPath) ? pure ["MAKEFLAGS=-j" ++ t, "install"]
+ | libffiPath <- libffiPaths ]
validateBuilderArgs :: Args
validateBuilderArgs = builder (Make "testsuite/tests") ? do
diff --git a/hadrian/src/Settings/Default.hs b/hadrian/src/Settings/Default.hs
index b0e269ce1b..2cadc4fc79 100644
--- a/hadrian/src/Settings/Default.hs
+++ b/hadrian/src/Settings/Default.hs
@@ -108,7 +108,9 @@ stage1Packages = do
, stm
, time
, unlit
- , xhtml ]
+ , xhtml
+ , ghcTags ]
+ ++ [ haddock | not cross ]
++ [ hpcBin | not cross ]
++ [ iserv | not win, not cross ]
++ [ libiserv | not win, not cross ]
@@ -119,10 +121,7 @@ stage1Packages = do
-- | Packages built in 'Stage2' by default. You can change this in "UserSettings".
stage2Packages :: Action [Package]
-stage2Packages = do
- cross <- flag CrossCompiling
- return $ [ ghcTags ]
- ++ [ haddock | not cross ]
+stage2Packages = stage1Packages
-- | Packages that are built only for the testsuite.
testsuitePackages :: Action [Package]