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