summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Builders
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-02-07 17:37:26 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-02-18 20:15:30 -0500
commitd7029cc09edc052c2f97effe33233c53340fcce0 (patch)
tree798f98d3bf72a096efe4577815915b9fdec1a034 /hadrian/src/Settings/Builders
parentb4a8ce525fce56eca18358820c0ec35fec8982de (diff)
downloadhaskell-d7029cc09edc052c2f97effe33233c53340fcce0.tar.gz
Hadrian: refactor GMP in-tree build support (#17756)
* Hadrian doesn't use integer-gmp/config.mk file anymore to determine if building GMP in-tree is required. "config.mk" is created by Cabal when the integer-gmp package is configured and this file is still untracked by Hadrian. This led to a tricky configure "race" because "config.mk" is built by the "setup-config" rule, but this rule is also used to find dependencies, in particular the "ghc-gmp.h" header, but the creation of this file was depending (without being tracked) on "config.mk". Now Hadrian only builds in-tree GMP if `--with-intree-gmp` is passed to the top-level configure script. * in-tree GMP isn't built once for all in a fixed stage (Stage1) anymore. It is built per stage which is required if we build a cross-compiler * switching between in-tree and external GMP is now supported without having to clean the build directory first. * "wrappers.c" now includes "ghc-gmp.h" instead of "ghc.h". It helps ensuring that the build system generates "ghc-gmp.h". * build in-tree GMP in "<root>/stageN/gmp/gmpbuild" and produce useful artefacts (libgmp.a, gmp.h, objs/*.o) in "<root>/stageN/gmp"
Diffstat (limited to 'hadrian/src/Settings/Builders')
-rw-r--r--hadrian/src/Settings/Builders/Configure.hs2
-rw-r--r--hadrian/src/Settings/Builders/Make.hs3
2 files changed, 3 insertions, 2 deletions
diff --git a/hadrian/src/Settings/Builders/Configure.hs b/hadrian/src/Settings/Builders/Configure.hs
index e8384e28d9..885f6a3f1f 100644
--- a/hadrian/src/Settings/Builders/Configure.hs
+++ b/hadrian/src/Settings/Builders/Configure.hs
@@ -6,8 +6,8 @@ import Settings.Builders.Common
configureBuilderArgs :: Args
configureBuilderArgs = do
- gmpPath <- expr gmpBuildPath
stage <- getStage
+ gmpPath <- expr (gmpBuildPath stage)
libffiPath <- expr (libffiBuildPath stage)
mconcat [ builder (Configure gmpPath) ? do
targetPlatform <- getSetting TargetPlatform
diff --git a/hadrian/src/Settings/Builders/Make.hs b/hadrian/src/Settings/Builders/Make.hs
index 431c2cb22e..12f01e7774 100644
--- a/hadrian/src/Settings/Builders/Make.hs
+++ b/hadrian/src/Settings/Builders/Make.hs
@@ -10,7 +10,8 @@ import CommandLine
makeBuilderArgs :: Args
makeBuilderArgs = do
threads <- shakeThreads <$> expr getShakeOptions
- gmpPath <- expr gmpBuildPath
+ stage <- getStage
+ gmpPath <- expr (gmpBuildPath stage)
libffiPaths <- forM [Stage1 ..] $ \s -> expr (libffiBuildPath s)
let t = show $ max 4 (threads - 2) -- Don't use all Shake's threads
mconcat $