[commit: ghc] wip/nfs-locking: Add comments. (b2b7c5c)
git at git.haskell.org
git at git.haskell.org
Thu Oct 26 23:58:27 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/b2b7c5c53ed5369249ebff39aa8735a897ad86a9/ghc
>---------------------------------------------------------------
commit b2b7c5c53ed5369249ebff39aa8735a897ad86a9
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Tue Jun 16 09:54:10 2015 +0100
Add comments.
>---------------------------------------------------------------
b2b7c5c53ed5369249ebff39aa8735a897ad86a9
src/Expression.hs | 2 +-
src/Rules/Data.hs | 70 ++++++++++++++----------------------------------
src/Settings/GhcCabal.hs | 3 +++
3 files changed, 24 insertions(+), 51 deletions(-)
diff --git a/src/Expression.hs b/src/Expression.hs
index 9232aed..4809324 100644
--- a/src/Expression.hs
+++ b/src/Expression.hs
@@ -24,7 +24,7 @@ data Environment = Environment
getStage :: Stage,
getPackage :: Package,
getBuilder :: Builder,
- getFile :: FilePath,
+ getFile :: FilePath, -- TODO: handle multple files?
getWay :: Way
}
diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index aa1ebab..3754cdc 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -13,29 +13,6 @@ import Settings.GhcPkg
import Settings.GhcCabal
import Util
--- Prepare a given 'packaga-data.mk' file for parsing by readConfigFile:
--- 1) Drop lines containing '$'
--- For example, get rid of
--- libraries/Win32_dist-install_CMM_SRCS := $(addprefix cbits/,$(notdir ...
--- Reason: we don't need them and we can't parse them.
--- 2) Replace '/' and '\' with '_' before '='
--- For example libraries/deepseq/dist-install_VERSION = 1.4.0.0
--- is replaced by libraries_deepseq_dist-install_VERSION = 1.4.0.0
--- Reason: Shake's built-in makefile parser doesn't recognise slashes
-
-postProcessPackageData :: FilePath -> Action ()
-postProcessPackageData file = do
- pkgData <- (filter ('$' `notElem`) . lines) <$> liftIO (readFile file)
- length pkgData `seq` writeFileLines file $ map processLine pkgData
- where
- processLine line = replaceSeparators '_' prefix ++ suffix
- where
- (prefix, suffix) = break (== '=') line
-
--- this is a positional argument, hence:
--- * if it is empty, we need to emit one empty string argument
--- * otherwise, we must collapse it into one space-separated string
-
-- Build package-data.mk by using GhcCabal to process pkgCabal file
buildPackageData :: Environment -> Rules ()
buildPackageData env =
@@ -53,6 +30,8 @@ buildPackageData env =
-- , "build" </> "autogen" </> ("Paths_" ++ name) <.> "hs"
] &%> \_ -> do
let configure = pkgPath pkg </> "configure"
+ -- TODO: 1) how to automate this? 2) handle multiple files?
+ newEnv = env { getFile = dir </> "package-data.mk" }
-- GhcCabal will run the configure script, so we depend on it
need [pkgPath pkg </> pkgCabal pkg]
-- We still don't know who built the configure script from configure.ac
@@ -62,37 +41,28 @@ buildPackageData env =
run' env (GhcPkg stage)
postProcessPackageData $ dir </> "package-data.mk"
+-- TODO: This should probably go to Oracles.Builder
run' :: Environment -> Builder -> Action ()
run' env builder = do
args <- interpret (env {getBuilder = builder}) $ fromDiff settings
putColoured Green (show args)
run builder args
---buildRule :: Package -> TodoItem -> Rules ()
---buildRule pkg @ (Package name path cabal _) todo @ (stage, dist, settings) =
--- let pathDist = path </> dist
--- cabalPath = path </> cabal
--- configure = path </> "configure"
--- in
--- -- All these files are produced by a single run of GhcCabal
--- (pathDist </>) <$>
--- [ "package-data.mk"
--- , "haddock-prologue.txt"
--- , "inplace-pkg-config"
--- , "setup-config"
--- , "build" </> "autogen" </> "cabal_macros.h"
--- -- TODO: Is this needed? Also check out Paths_cpsa.hs.
--- -- , "build" </> "autogen" </> ("Paths_" ++ name) <.> "hs"
--- ] &%> \_ -> do
--- need [cabalPath]
--- when (doesFileExist $ configure <.> "ac") $ need [configure]
--- -- GhcCabal will run the configure script, so we depend on it
--- -- We still don't know who build the configure script from configure.ac
--- run GhcCabal $ cabalArgs pkg todo
--- when (registerPackage settings) $
--- run (GhcPkg stage) $ ghcPkgArgs pkg todo
--- postProcessPackageData $ pathDist </> "package-data.mk"
-
--- buildSettings = + builder Gcc ? ccSettings
+-- Prepare a given 'packaga-data.mk' file for parsing by readConfigFile:
+-- 1) Drop lines containing '$'
+-- For example, get rid of
+-- libraries/Win32_dist-install_CMM_SRCS := $(addprefix cbits/,$(notdir ...
+-- Reason: we don't need them and we can't parse them.
+-- 2) Replace '/' and '\' with '_' before '='
+-- For example libraries/deepseq/dist-install_VERSION = 1.4.0.0
+-- is replaced by libraries_deepseq_dist-install_VERSION = 1.4.0.0
+-- Reason: Shake's built-in makefile parser doesn't recognise slashes
--- builder Gcc ? "-tricky-flag"
+postProcessPackageData :: FilePath -> Action ()
+postProcessPackageData file = do
+ pkgData <- (filter ('$' `notElem`) . lines) <$> liftIO (readFile file)
+ length pkgData `seq` writeFileLines file $ map processLine pkgData
+ where
+ processLine line = replaceSeparators '_' prefix ++ suffix
+ where
+ (prefix, suffix) = break (== '=') line
diff --git a/src/Settings/GhcCabal.hs b/src/Settings/GhcCabal.hs
index 4388b17..4cbb0a3 100644
--- a/src/Settings/GhcCabal.hs
+++ b/src/Settings/GhcCabal.hs
@@ -83,6 +83,9 @@ bootPackageDbSettings = do
sourcePath <- lift $ askConfig "ghc-source-path"
arg $ "--package-db=" ++ sourcePath </> "libraries/bootstrapping.conf"
+-- this is a positional argument, hence:
+-- * if it is empty, we need to emit one empty string argument
+-- * otherwise, we must collapse it into one space-separated string
dllSettings :: Settings
dllSettings = arg ""
More information about the ghc-commits
mailing list