Commit 44601468 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add full support for --configure command line flag.

parent e874fed8
......@@ -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 #-}
......
......@@ -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.
......
......@@ -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"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment