[commit: ghc] wip/nfs-locking: Move GMP build to Stage1. (3f74e8b)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:56:30 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/3f74e8bf2c170740f46279b98659d57b47721afa/ghc

>---------------------------------------------------------------

commit 3f74e8bf2c170740f46279b98659d57b47721afa
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Jan 23 15:36:20 2016 +0000

    Move GMP build to Stage1.
    
    Should make AppVeyor CI fit in 1 hr.


>---------------------------------------------------------------

3f74e8bf2c170740f46279b98659d57b47721afa
 src/Rules/Generate.hs               | 13 +++++++------
 src/Rules/Gmp.hs                    | 15 ++++-----------
 src/Settings/Builders/Ghc.hs        |  5 ++++-
 src/Settings/Packages/IntegerGmp.hs |  2 +-
 src/Settings/Paths.hs               |  2 +-
 5 files changed, 17 insertions(+), 20 deletions(-)

diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index 73b160a..f329228 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -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:
diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs
index b6bfdf0..b384b68 100644
--- a/src/Rules/Gmp.hs
+++ b/src/Rules/Gmp.hs
@@ -1,6 +1,4 @@
-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'"
diff --git a/src/Settings/Builders/Ghc.hs b/src/Settings/Builders/Ghc.hs
index 3537aed..c79fc50 100644
--- a/src/Settings/Builders/Ghc.hs
+++ b/src/Settings/Builders/Ghc.hs
@@ -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"
diff --git a/src/Settings/Packages/IntegerGmp.hs b/src/Settings/Packages/IntegerGmp.hs
index 9ad160f..0640e52 100644
--- a/src/Settings/Packages/IntegerGmp.hs
+++ b/src/Settings/Packages/IntegerGmp.hs
@@ -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) ?
diff --git a/src/Settings/Paths.hs b/src/Settings/Paths.hs
index 3e9fec9..ed217a8 100644
--- a/src/Settings/Paths.hs
+++ b/src/Settings/Paths.hs
@@ -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



More information about the ghc-commits mailing list