Commit 3f74e8bf authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Move GMP build to Stage1.

Should make AppVeyor CI fit in 1 hr.
parent cf5d3387
......@@ -43,11 +43,12 @@ includesDependencies = ("includes" -/-) <$>
, "ghcplatform.h"
, "ghcversion.h" ]
defaultDependencies :: [FilePath]
defaultDependencies = concat
defaultDependencies :: Stage -> [FilePath]
defaultDependencies stage = concat
[ includesDependencies
, libffiDependencies
, gmpDependencies ]
, libffiDependencies ]
++
[ gmpLibraryH | stage > Stage0 ]
ghcPrimDependencies :: Stage -> [FilePath]
ghcPrimDependencies stage = ((targetPath stage ghcPrim -/- "build") -/-) <$>
......@@ -67,7 +68,7 @@ derivedConstantsDependencies = installTargets ++ fmap (derivedConstantsPath -/-)
compilerDependencies :: Stage -> [FilePath]
compilerDependencies stage =
[ platformH stage ]
++ defaultDependencies ++ derivedConstantsDependencies
++ defaultDependencies stage ++ derivedConstantsDependencies
++ fmap ((targetPath stage compiler -/- "build") -/-)
[ "primop-vector-uniques.hs-incl"
, "primop-data-decl.hs-incl"
......@@ -91,7 +92,7 @@ generatedDependencies stage pkg
| pkg == ghcPrim = ghcPrimDependencies stage
| pkg == rts = libffiDependencies ++ includesDependencies
++ derivedConstantsDependencies
| stage == Stage0 = defaultDependencies
| stage == Stage0 = defaultDependencies Stage0
| otherwise = []
-- The following generators and corresponding source extensions are supported:
......
module Rules.Gmp (
gmpRules, gmpBuildPath, gmpObjects, gmpLibraryH, gmpDependencies
) where
module Rules.Gmp (gmpRules, gmpBuildPath, gmpObjects, gmpLibraryH) where
import qualified System.Directory as IO
......@@ -17,7 +15,7 @@ gmpBase :: FilePath
gmpBase = "libraries/integer-gmp/gmp"
gmpTarget :: PartialTarget
gmpTarget = PartialTarget Stage0 integerGmp
gmpTarget = PartialTarget Stage1 integerGmp
gmpObjects :: FilePath
gmpObjects = gmpBuildPath -/- "objs"
......@@ -34,9 +32,6 @@ gmpLibraryH = gmpBuildPath -/- "include/ghc-gmp.h"
gmpLibraryFakeH :: FilePath
gmpLibraryFakeH = gmpBase -/- "ghc-gmp.h"
gmpDependencies :: [FilePath]
gmpDependencies = [gmpLibraryH]
gmpPatches :: [FilePath]
gmpPatches = (gmpBase -/-) <$> ["gmpsrc.patch", "tarball/gmp-5.0.4.patch"]
......@@ -77,11 +72,11 @@ gmpRules = do
liftIO $ removeFiles gmpBuildPath ["//*"]
envs <- configureEnvironment
-- TODO: without the optimisation below we configure integerGmp package
-- twice -- think how this can be optimised (shall we solve #18 first?)
-- TODO: this is a hacky optimisation: we do not rerun configure of
-- integerGmp package if we detect the results of the previous run
envs <- configureEnvironment
unlessM (liftIO . IO.doesFileExist $ gmpBase -/- "config.mk") $ do
args <- configureIntGmpArguments
runConfigure (pkgPath integerGmp) envs args
......@@ -148,6 +143,4 @@ gmpRules = do
runBuilder Ranlib [gmpLibrary]
putSuccess "| Successfully built custom library 'integer-gmp'"
-- gmpLibraryInTreeH %> \_ -> need [gmpLibraryH]
putSuccess "| Successfully built custom library 'gmp'"
......@@ -19,12 +19,15 @@ import Settings.Builders.Common (cIncludeArgs)
ghcBuilderArgs :: Args
ghcBuilderArgs = stagedBuilder Ghc ? do
output <- getOutput
stage <- getStage
way <- getWay
let buildObj = ("//*." ++ osuf way) ?== output || ("//*." ++ obootsuf way) ?== output
buildHi = ("//*." ++ hisuf way) ?== output || ("//*." ++ hibootsuf way) ?== output
buildProg = not (buildObj || buildHi)
libs <- getPkgDataList DepExtraLibs
gmpLibs <- lift $ readFileLines gmpLibNameCache
gmpLibs <- if stage > Stage0 && buildProg
then lift $ readFileLines gmpLibNameCache -- TODO: use oracles
else return []
libDirs <- getPkgDataList DepLibDirs
mconcat [ commonGhcArgs
, arg "-H32m"
......
......@@ -16,7 +16,7 @@ integerGmpPackageArgs :: Args
integerGmpPackageArgs = package integerGmp ? do
let includeGmp = "-I" ++ gmpBuildPath -/- "include"
gmpIncludeDir <- getSetting GmpIncludeDir
gmpLibDir <- getSetting GmpLibDir
gmpLibDir <- getSetting GmpLibDir
mconcat [ builder GhcCabal ? mconcat
[ (null gmpIncludeDir && null gmpLibDir) ?
......
......@@ -39,7 +39,7 @@ pkgGhciLibraryFile stage pkg componentId =
-- This is the build directory for in-tree GMP library
gmpBuildPath :: FilePath
gmpBuildPath = buildRootPath -/- "stage0/gmp"
gmpBuildPath = buildRootPath -/- "stage1/gmp"
-- GMP library names extracted from integer-gmp.buildinfo
gmpLibNameCache :: FilePath
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment