[commit: ghc] wip/nfs-locking: Add Stage.stageString, rename runghc -> runGhc. (9e2ddcb)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:49:55 UTC 2017


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

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

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

commit 9e2ddcb188ecf614edbaeca9404d0adb77f125b3
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Wed Dec 30 03:02:27 2015 +0000

    Add Stage.stageString, rename runghc -> runGhc.


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

9e2ddcb188ecf614edbaeca9404d0adb77f125b3
 src/GHC.hs                    | 14 +++++++-------
 src/Oracles/Config/Setting.hs |  8 ++++----
 src/Rules/Data.hs             |  2 +-
 src/Rules/Generate.hs         |  2 +-
 src/Settings/Packages.hs      |  2 +-
 src/Stage.hs                  |  5 ++++-
 6 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/GHC.hs b/src/GHC.hs
index 859bec4..f93d92a 100644
--- a/src/GHC.hs
+++ b/src/GHC.hs
@@ -5,7 +5,7 @@ module GHC (
     genprimopcode, ghc, ghcBoot, ghcCabal, ghci, ghcPkg, ghcPrim, ghcPwd, ghcTags,
     haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp,
     integerSimple, iservBin, mkUserGuidePart, parallel, pretty, primitive, process,
-    runghc, stm, templateHaskell, terminfo, time, transformers, unix, win32, xhtml,
+    runGhc, stm, templateHaskell, terminfo, time, transformers, unix, win32, xhtml,
 
     defaultKnownPackages, defaultTargetDirectory, defaultProgramPath
     ) where
@@ -26,7 +26,7 @@ defaultKnownPackages =
     , genprimopcode, ghc, ghcBoot, ghcCabal, ghci, ghcPkg, ghcPrim
     , ghcPwd, ghcTags, haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin
     , integerGmp, integerSimple, iservBin, mkUserGuidePart, parallel, pretty
-    , primitive , process, runghc, stm, templateHaskell, terminfo, time
+    , primitive , process, runGhc, stm, templateHaskell, terminfo, time
     , transformers, unix, win32, xhtml ]
 
 -- Package definitions (see Package.hs)
@@ -35,7 +35,7 @@ array, base, binary, bytestring, cabal, compiler, containers, compareSizes,
     genprimopcode, ghc, ghcBoot, ghcCabal, ghci, ghcPkg, ghcPrim, ghcPwd,
     ghcTags, haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp,
     integerSimple, iservBin, mkUserGuidePart, parallel, pretty, primitive, process,
-    runghc, stm, templateHaskell, terminfo, time, transformers, unix, win32, xhtml :: Package
+    runGhc, stm, templateHaskell, terminfo, time, transformers, unix, win32, xhtml :: Package
 
 array           = library  "array"
 base            = library  "base"
@@ -75,7 +75,7 @@ parallel        = library  "parallel"
 pretty          = library  "pretty"
 primitive       = library  "primitive"
 process         = library  "process"
-runghc          = utility  "runghc"
+runGhc          = utility  "runGhc"
 stm             = library  "stm"
 templateHaskell = library  "template-haskell"
 terminfo        = library  "terminfo"
@@ -97,17 +97,17 @@ xhtml           = library  "xhtml"
 -- * doc/            : produced by haddock
 -- * package-data.mk : contains output of ghc-cabal applied to pkgCabal
 defaultTargetDirectory :: Stage -> Package -> FilePath
-defaultTargetDirectory stage _ = "stage" ++ show (fromEnum stage)
+defaultTargetDirectory stage _ = stageString stage
 
 -- TODO: simplify
 -- | Returns a relative path to the program executable
 defaultProgramPath :: Stage -> Package -> Maybe FilePath
 defaultProgramPath stage pkg
-    | pkg == ghc     = Just . inplaceProgram $ "ghc-stage" ++ show (fromEnum stage + 1)
+    | pkg == ghc = Just . inplaceProgram $ "ghc-stage" ++ show (fromEnum stage + 1)
     | pkg == haddock || pkg == ghcTags = case stage of
         Stage2 -> Just . inplaceProgram $ pkgNameString pkg
         _      -> Nothing
-    | isProgram pkg  = case stage of
+    | isProgram pkg = case stage of
         Stage0 -> Just . inplaceProgram $ pkgNameString pkg
         _      -> Just . installProgram $ pkgNameString pkg
     | otherwise = Nothing
diff --git a/src/Oracles/Config/Setting.hs b/src/Oracles/Config/Setting.hs
index b0c6da3..ace9158 100644
--- a/src/Oracles/Config/Setting.hs
+++ b/src/Oracles/Config/Setting.hs
@@ -91,10 +91,10 @@ setting key = askConfig $ case key of
 
 settingList :: SettingList -> Action [String]
 settingList key = fmap words $ askConfig $ case key of
-    ConfCcArgs        stage -> "conf-cc-args-stage"         ++ show (fromEnum stage)
-    ConfCppArgs       stage -> "conf-cpp-args-stage"        ++ show (fromEnum stage)
-    ConfGccLinkerArgs stage -> "conf-gcc-linker-args-stage" ++ show (fromEnum stage)
-    ConfLdLinkerArgs  stage -> "conf-ld-linker-args-stage"  ++ show (fromEnum stage)
+    ConfCcArgs        stage -> "conf-cc-args-"         ++ stageString stage
+    ConfCppArgs       stage -> "conf-cpp-args-"        ++ stageString stage
+    ConfGccLinkerArgs stage -> "conf-gcc-linker-args-" ++ stageString stage
+    ConfLdLinkerArgs  stage -> "conf-ld-linker-args-"  ++ stageString stage
     GmpIncludeDirs          -> "gmp-include-dirs"
     GmpLibDirs              -> "gmp-lib-dirs"
     HsCppArgs               -> "hs-cpp-args"
diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index 70c8e8a..a863968 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -45,7 +45,7 @@ buildPackageData rs target @ (PartialTarget stage pkg) = do
     priority 2.0 $ do
         when (pkg == hp2ps) $ dataFile %> \mk -> do
             includes <- interpretPartial target $ fromDiffExpr includesArgs
-            let prefix = "utils_hp2ps_stage" ++ show (fromEnum stage) ++ "_"
+            let prefix = "utils_hp2ps_" ++ stageString stage ++ "_"
                 cSrcs  = [ "AreaBelow.c", "Curves.c", "Error.c", "Main.c"
                          , "Reorder.c", "TopTwenty.c", "AuxFile.c"
                          , "Deviation.c", "HpFile.c", "Marks.c", "Scale.c"
diff --git a/src/Rules/Generate.hs b/src/Rules/Generate.hs
index ea5ed63..fd101a1 100644
--- a/src/Rules/Generate.hs
+++ b/src/Rules/Generate.hs
@@ -127,7 +127,7 @@ generatePackageCode _ target @ (PartialTarget stage pkg) =
             when (pkg == ghcPkg) $ buildPath -/- "Version.hs" %> \file -> do
                 file <~ generateVersionHs
 
-            when (pkg == runghc) $ buildPath -/- "Main.hs" %> \file -> do
+            when (pkg == runGhc) $ buildPath -/- "Main.hs" %> \file -> do
                 copyFileChanged (pkgPath pkg -/- "runghc.hs") file
                 putSuccess $ "| Successfully generated '" ++ file ++ "'."
 
diff --git a/src/Settings/Packages.hs b/src/Settings/Packages.hs
index 61457cb..308fb8c 100644
--- a/src/Settings/Packages.hs
+++ b/src/Settings/Packages.hs
@@ -32,7 +32,7 @@ packagesStage1 = mconcat
     [ packagesStage0
     , append [ array, base, bytestring, containers, compareSizes, deepseq
              , directory, filepath, ghci, ghcPrim, ghcPwd, haskeline, hpcBin
-             , integerLibrary, mkUserGuidePart, pretty, process, runghc, time ]
+             , integerLibrary, mkUserGuidePart, pretty, process, runGhc, time ]
     , windowsHost      ? append [win32]
     , notM windowsHost ? append [unix]
     , notM windowsHost ? append [iservBin]
diff --git a/src/Stage.hs b/src/Stage.hs
index d474557..70fe6ba 100644
--- a/src/Stage.hs
+++ b/src/Stage.hs
@@ -1,5 +1,5 @@
 {-# LANGUAGE DeriveGeneric #-}
-module Stage (Stage (..)) where
+module Stage (Stage (..), stageString) where
 
 import Base
 import GHC.Generics (Generic)
@@ -8,6 +8,9 @@ import GHC.Generics (Generic)
 data Stage = Stage0 | Stage1 | Stage2 | Stage3
            deriving (Show, Eq, Ord, Enum, Generic)
 
+stageString :: Stage -> String
+stageString stage = "stage" ++ show (fromEnum stage)
+
 -- Instances for storing in the Shake database
 instance Binary Stage
 instance Hashable Stage



More information about the ghc-commits mailing list