[commit: ghc] wip/nfs-locking: Add full support for --configure command line flag. (4460146)
git at git.haskell.org
git at git.haskell.org
Thu Oct 26 23:55:28 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/446014681874982a340c245d3c279229eeb6f121/ghc
>---------------------------------------------------------------
commit 446014681874982a340c245d3c279229eeb6f121
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Thu Jan 21 17:36:50 2016 +0000
Add full support for --configure command line flag.
>---------------------------------------------------------------
446014681874982a340c245d3c279229eeb6f121
src/CmdLineFlag.hs | 2 +-
src/Rules/Actions.hs | 5 +++--
src/Rules/Config.hs | 31 ++++++++++++++++++++++---------
3 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/src/CmdLineFlag.hs b/src/CmdLineFlag.hs
index 9e33397..249070a 100644
--- a/src/CmdLineFlag.hs
+++ b/src/CmdLineFlag.hs
@@ -61,7 +61,7 @@ flags = [ Option [] ["progress-info"] (OptArg readProgressInfo "STYLE")
, Option [] ["split-objects"] (NoArg readSplitObjects)
"Generate split objects (requires a full clean rebuild)."
, Option [] ["configure"] (OptArg readConfigure "ARGS")
- "Run boot and configure scripts (passing ARGS to the latter)." ]
+ "Run configure with ARGS (also run boot if necessary)." ]
-- TODO: Avoid unsafePerformIO by using shakeExtra (awaiting Shake's release)
{-# NOINLINE cmdLineFlags #-}
diff --git a/src/Rules/Actions.hs b/src/Rules/Actions.hs
index 2b05207..0e4961f 100644
--- a/src/Rules/Actions.hs
+++ b/src/Rules/Actions.hs
@@ -97,12 +97,13 @@ fixFile file f = do
runConfigure :: FilePath -> [CmdOption] -> [String] -> Action ()
runConfigure dir opts args = do
need [dir -/- "configure"]
+ let note = if null args || args == [""] then "" else " (" ++ intercalate ", " args ++ ")"
if dir == "."
then do
- putBuild $ "| Run configure..."
+ putBuild $ "| Run configure" ++ note ++ "..."
quietly $ cmd Shell (EchoStdout False) "bash configure" opts' args
else do
- putBuild $ "| Run configure in " ++ dir ++ "..."
+ putBuild $ "| Run configure" ++ note ++ " in " ++ dir ++ "..."
quietly $ cmd Shell (EchoStdout False) [Cwd dir] "bash configure" opts' args
where
-- Always configure with bash.
diff --git a/src/Rules/Config.hs b/src/Rules/Config.hs
index 6f0447f..77ac1ac 100644
--- a/src/Rules/Config.hs
+++ b/src/Rules/Config.hs
@@ -5,13 +5,26 @@ import CmdLineFlag
import Rules.Actions
configRules :: Rules ()
-configRules = case cmdConfigure of
- SkipConfigure -> mempty
- RunConfigure args -> do
- configPath -/- "system.config" %> \_ -> do
- need [configPath -/- "system.config.in"]
- runConfigure "." [] [args]
+configRules = do
+ -- We always rerun the configure script in this mode, because the flags
+ -- passed to it can affect the contents of system.config file.
+ configPath -/- "system.config" %> \out -> do
+ alwaysRerun
+ case cmdConfigure of
+ RunConfigure args -> runConfigure "." [] [args]
+ SkipConfigure -> unlessM (doesFileExist out) $
+ putError $ "Configuration file " ++ out ++ " is missing.\n"
+ ++ "Run the configure script either manually or via the "
+ ++ "build system by passing --configure[=ARGS] flag."
- "configure" %> \_ -> do
- putBuild "| Running boot..."
- unit $ cmd "perl boot"
+ -- When we detect Windows paths in ACLOCAL_PATH we reset it.
+ -- TODO: Handle Windows paths in ACLOCAL_PATH more gracefully.
+ "configure" %> \_ -> do
+ putBuild "| Running boot..."
+ aclocal <- getEnv "ACLOCAL_PATH"
+ let env = case aclocal of
+ Nothing -> []
+ Just s -> if ":\\" `isPrefixOf` (drop 1 s)
+ then [AddEnv "ACLOCAL_PATH" ""]
+ else []
+ quietly $ cmd (EchoStdout False) env "perl boot"
More information about the ghc-commits
mailing list