[commit: ghc] wip/nfs-locking: Build genprimopcode utility. (6f2b78b)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:11:05 UTC 2017


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

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

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

commit 6f2b78bb0f063be5ff5a8abc346f765c6729621e
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sun Dec 13 19:25:30 2015 +0000

    Build genprimopcode utility.


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

6f2b78bb0f063be5ff5a8abc346f765c6729621e
 src/GHC.hs                   | 10 ++++++----
 src/Rules/Data.hs            | 12 +++++++++++-
 src/Settings/Builders/Ghc.hs |  4 ++--
 src/Settings/Packages.hs     |  3 ++-
 4 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/GHC.hs b/src/GHC.hs
index 3821518..ff5a106 100644
--- a/src/GHC.hs
+++ b/src/GHC.hs
@@ -1,7 +1,7 @@
 module GHC (
     array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
     compareSizes, deepseq, deriveConstants, directory, dllSplit, filepath,
-    genapply, ghc, ghcCabal, ghcPkg, ghcPrim,
+    genapply, genprimopcode, ghc, ghcCabal, ghcPkg, ghcPrim,
     ghcPwd, ghcTags, haddock, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple,
     mkUserGuidePart, parallel, pretty,
     primitive, process, runghc, stm, templateHaskell, terminfo, time, transformers,
@@ -23,7 +23,7 @@ defaultKnownPackages :: [Package]
 defaultKnownPackages =
     [ array, base, binPackageDb, binary, bytestring, cabal, compiler
     , containers, compareSizes, deepseq, deriveConstants, directory, dllSplit
-    , filepath, genapply, ghc, ghcCabal, ghcPkg, ghcPrim
+    , filepath, genapply, genprimopcode, ghc, ghcCabal, ghcPkg, ghcPrim
     , ghcPwd, ghcTags, haddock, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple
     , mkUserGuidePart, parallel, pretty, primitive, process, runghc, stm, templateHaskell, terminfo
     , time, transformers, unix, win32, xhtml ]
@@ -31,7 +31,7 @@ defaultKnownPackages =
 -- Package definitions
 array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
     compareSizes, deepseq, deriveConstants, directory, dllSplit, filepath,
-    genapply, ghc, ghcCabal, ghcPkg, ghcPrim, ghcPwd,
+    genapply, genprimopcode, ghc, ghcCabal, ghcPkg, ghcPrim, ghcPwd,
     ghcTags, haddock, haskeline, hsc2hs, hoopl, hpc, hpcBin, integerGmp, integerSimple,
     mkUserGuidePart, parallel, pretty,
     primitive, process, runghc, stm, templateHaskell, terminfo, time, transformers,
@@ -52,6 +52,7 @@ directory       = library  "directory"
 dllSplit        = utility  "dll-split"
 filepath        = library  "filepath"
 genapply        = utility  "genapply"
+genprimopcode   = utility  "genprimopcode"
 ghc             = topLevel "ghc-bin"        `setPath` "ghc"
 ghcCabal        = utility  "ghc-cabal"
 ghcPkg          = utility  "ghc-pkg"
@@ -81,7 +82,7 @@ unix            = library  "unix"
 win32           = library  "Win32"
 xhtml           = library  "xhtml"
 
--- TODO: genprimocode, hp2ps
+-- TODO: hp2ps
 
 -- TODO: The following utils are not included into the build system because
 -- they seem to be unused or unrelated to the build process: chechUniques,
@@ -110,6 +111,7 @@ defaultProgramPath stage pkg
     | pkg == deriveConstants = program $ pkgName pkg
     | pkg == dllSplit        = program $ pkgName pkg
     | pkg == genapply        = program $ pkgName pkg
+    | pkg == genprimopcode   = program $ pkgName pkg
     | pkg == ghc             = program $ "ghc-stage" ++ show (fromEnum stage + 1)
     | pkg == ghcCabal        = program $ pkgName pkg
     | pkg == ghcPkg          = program $ pkgName pkg
diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index 9fbc6ec..c47c6a3 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -1,7 +1,7 @@
 module Rules.Data (buildPackageData) where
 
 import Expression
-import GHC (deriveConstants, genapply)
+import GHC (deriveConstants, genapply, genprimopcode)
 import Oracles
 import Predicates (registerPackage)
 import Rules.Actions
@@ -70,6 +70,16 @@ buildPackageData rs target @ (PartialTarget stage pkg) = do
                 , "utils_genapply_dist-boot_HC_OPTS = " ++ hcOpts ]
         writeFileChanged mk contents
 
+    priority 2.0 $
+        when (pkg == genprimopcode) $ path -/- "package-data.mk" %> \mk -> do
+        let contents = unlines
+                [ "utils_genprimopcode_dist-boot_MODULES = Lexer Main ParserM Parser Syntax"
+                , "utils_genprimopcode_dist-boot_PROGNAME = genprimopcode"
+                , "utils_genprimopcode_dist-boot_HS_SRC_DIRS = ."
+                , "utils_genprimopcode_dist-boot_INSTALL_INPLACE = YES"
+                , "utils_genprimopcode_dist-boot_HC_OPTS = -package array" ]
+        writeFileChanged mk contents
+
 -- Prepare a given 'packaga-data.mk' file for parsing by readConfigFile:
 -- 1) Drop lines containing '$'
 -- For example, get rid of
diff --git a/src/Settings/Builders/Ghc.hs b/src/Settings/Builders/Ghc.hs
index a22bee5..3d3e224 100644
--- a/src/Settings/Builders/Ghc.hs
+++ b/src/Settings/Builders/Ghc.hs
@@ -96,7 +96,7 @@ packageGhcArgs = do
     pkgKey             <- getPkgData PackageKey
     pkgDepIds          <- getPkgDataList DepIds
     mconcat
-        [ not (pkg == deriveConstants || pkg == genapply) ?
+        [ not (pkg == deriveConstants || pkg == genapply || pkg == genprimopcode) ?
           arg "-hide-all-packages"
         , arg "-no-user-package-db"
         , stage0 ? arg "-package-db libraries/bootstrapping.conf"
@@ -122,7 +122,7 @@ includeGhcArgs = do
             , arg $ "-I" ++ autogenPath
             , append [ "-i" ++ pkgPath pkg -/- dir | dir <- srcDirs ]
             , append [ "-I" ++ pkgPath pkg -/- dir | dir <- incDirs ]
-            , not (pkg == deriveConstants || pkg == genapply) ?
+            , not (pkg == deriveConstants || pkg == genapply || pkg == genprimopcode) ?
               append [ "-optP-include"
                      , "-optP" ++ autogenPath -/- "cabal_macros.h" ] ]
 
diff --git a/src/Settings/Packages.hs b/src/Settings/Packages.hs
index 1475e40..5f1e55e 100644
--- a/src/Settings/Packages.hs
+++ b/src/Settings/Packages.hs
@@ -9,6 +9,7 @@ getPackages :: Expr [Package]
 getPackages = fromDiffExpr $ defaultPackages <> userPackages
 
 -- These are the packages we build by default
+-- TODO: simplify
 defaultPackages :: Packages
 defaultPackages = mconcat
     [ stage0 ? packagesStage0
@@ -19,7 +20,7 @@ packagesStage0 :: Packages
 packagesStage0 = mconcat
     [ append [ binPackageDb, binary, cabal, compiler, ghc, ghcCabal, ghcPkg
              , hsc2hs, hoopl, hpc, templateHaskell, transformers ]
-    , stage0 ? append [deriveConstants, genapply] -- TODO: simplify
+    , stage0 ? append [deriveConstants, genapply, genprimopcode]
     , notM windowsHost ? notM (anyHostOs ["ios"]) ? append [terminfo] ]
 
 -- TODO: what do we do with parallel, stm, random, primitive, vector and dph?



More information about the ghc-commits mailing list