Commit 7166d12e authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Run boot and configure by default.

See #234.
parent 00159421
......@@ -62,7 +62,7 @@ install:
script:
- ( cd ghc/hadrian && cabal haddock --internal )
- ./ghc/hadrian/build.sh selftest
- ./ghc/hadrian/build.sh -j --no-progress --profile=- --flavour=quick $TARGET
- ./ghc/hadrian/build.sh -j --skip-configure --no-progress --profile=- --flavour=quick $TARGET
cache:
directories:
......
......@@ -40,4 +40,4 @@ install:
build_script:
- cd C:\msys64\home\ghc\hadrian
- echo "" | stack --no-terminal exec -- build.bat selftest
- echo "" | stack --no-terminal exec -- build.bat -j --no-progress --profile=- --flavour=quick inplace/bin/ghc-stage1.exe
- echo "" | stack --no-terminal exec -- build.bat -j --skip-configure --no-progress --profile=- --flavour=quick inplace/bin/ghc-stage1.exe
......@@ -42,6 +42,7 @@ executable hadrian
, Rules.Cabal
, Rules.Clean
, Rules.Compile
, Rules.Configure
, Rules.Data
, Rules.Dependencies
, Rules.Documentation
......@@ -62,7 +63,6 @@ executable hadrian
, Rules.Program
, Rules.Register
, Rules.Selftest
, Rules.Setup
, Rules.Test
, Rules.Wrappers.Ghc
, Rules.Wrappers.GhcPkg
......
module CmdLineFlag (
putCmdLineFlags, cmdFlags, cmdBuildHaddock, cmdSetup, Setup (..),
cmdFlavour, Flavour (..), cmdProgressInfo, ProgressInfo (..), cmdSplitObjects
putCmdLineFlags, cmdFlags, cmdBuildHaddock, cmdFlavour, Flavour (..),
cmdProgressInfo, ProgressInfo (..), cmdSkipConfigure, cmdSplitObjects
) where
import Data.List.Extra
......@@ -11,28 +11,27 @@ import System.IO.Unsafe (unsafePerformIO)
-- Command line flags
data ProgressInfo = None | Brief | Normal | Unicorn deriving (Eq, Show)
data Setup = SkipSetup | RunSetup String deriving (Eq, Show)
data Flavour = Default | Quick deriving (Eq, Show)
-- | 'CmdLineFlag.Untracked' is a collection of flags that can be passed via the
-- command line. These flags are not tracked, that is they do not force any
-- build rules to be rurun.
data Untracked = Untracked
{ buildHaddock :: Bool
, flavour :: Flavour
, progressInfo :: ProgressInfo
, setup :: Setup
, splitObjects :: Bool }
{ buildHaddock :: Bool
, flavour :: Flavour
, progressInfo :: ProgressInfo
, skipConfigure :: Bool
, splitObjects :: Bool }
deriving (Eq, Show)
-- | Default values for 'CmdLineFlag.Untracked'.
defaultUntracked :: Untracked
defaultUntracked = Untracked
{ buildHaddock = False
, flavour = Default
, progressInfo = Normal
, setup = SkipSetup
, splitObjects = False }
{ buildHaddock = False
, flavour = Default
, progressInfo = Normal
, skipConfigure = False
, splitObjects = False }
readBuildHaddock :: Either String (Untracked -> Untracked)
readBuildHaddock = Right $ \flags -> flags { buildHaddock = True }
......@@ -61,15 +60,8 @@ readProgressInfo ms =
set :: ProgressInfo -> Untracked -> Untracked
set flag flags = flags { progressInfo = flag }
readSetup :: Maybe String -> Either String (Untracked -> Untracked)
readSetup ms =
maybe (Left "Cannot parse setup") (Right . set) (go $ lower <$> ms)
where
go :: Maybe String -> Maybe Setup
go (Just args) = Just $ RunSetup args
go Nothing = Just $ RunSetup ""
set :: Setup -> Untracked -> Untracked
set flag flags = flags { setup = flag }
readSkipConfigure :: Either String (Untracked -> Untracked)
readSkipConfigure = Right $ \flags -> flags { skipConfigure = True }
readSplitObjects :: Either String (Untracked -> Untracked)
readSplitObjects = Right $ \flags -> flags { splitObjects = True }
......@@ -82,8 +74,8 @@ cmdFlags =
"Generate Haddock documentation."
, Option [] ["progress-info"] (OptArg readProgressInfo "STYLE")
"Progress info style (None, Brief, Normal, or Unicorn)."
, Option [] ["setup"] (OptArg readSetup "CONFIGURE_ARGS")
"Setup the build system, pass CONFIGURE_ARGS to ./configure."
, Option [] ["skip-configure"] (NoArg readSkipConfigure)
"Skip the boot and configure scripts (if you want to run them manually)."
, Option [] ["split-objects"] (NoArg readSplitObjects)
"Generate split objects (requires a full clean rebuild)." ]
......@@ -109,8 +101,8 @@ cmdFlavour = flavour getCmdLineFlags
cmdProgressInfo :: ProgressInfo
cmdProgressInfo = progressInfo getCmdLineFlags
cmdSetup :: Setup
cmdSetup = setup getCmdLineFlags
cmdSplitObjects :: Bool
cmdSplitObjects = splitObjects getCmdLineFlags
cmdSkipConfigure :: Bool
cmdSkipConfigure = skipConfigure getCmdLineFlags
......@@ -12,13 +12,13 @@ import Rules.Dependencies
import Rules.Documentation
import Rules.Generate
import Rules.Cabal
import Rules.Configure
import Rules.Gmp
import Rules.Libffi
import Rules.Library
import Rules.Perl
import Rules.Program
import Rules.Register
import Rules.Setup
import Settings
allStages :: [Stage]
......@@ -81,10 +81,10 @@ packageRules = do
buildRules :: Rules ()
buildRules = do
cabalRules
configureRules
generateRules
copyRules
gmpRules
libffiRules
perlScriptRules
setupRules
packageRules
module Rules.Configure (configureRules) where
import qualified System.Info
import Base
import Builder
import CmdLineFlag (cmdSkipConfigure)
import Context
import GHC (compiler)
import Rules.Actions
import Rules.Generators.GhcAutoconfH
import Stage
import Target
configureRules :: Rules ()
configureRules = do
[configFile, "settings", configH] &%> \outs -> do
if cmdSkipConfigure
then unlessM (doesFileExist configFile) $
putError $ "Configuration file " ++ configFile ++ " is missing."
++ "\nRun the configure script manually or do not use the "
++ "--skip-configure flag."
else do
-- We cannot use windowsHost here due to a cyclic dependency.
when (System.Info.os == "mingw32") $ do
putBuild "| Checking for Windows tarballs..."
quietly $ cmd [ "bash"
, "mk/get-win32-tarballs.sh"
, "download"
, System.Info.arch ]
let srcs = map (<.> "in") outs
context = vanillaContext Stage0 compiler
need srcs
build $ Target context (Configure ".") srcs outs
["configure", configH <.> "in"] &%> \_ -> do
if cmdSkipConfigure
then unlessM (doesFileExist "configure") $
putError $ "The configure script is missing.\nRun the boot script"
++ " manually or do not use the --skip-configure flag."
else do
need ["configure.ac"]
putBuild "| Running boot..."
quietly $ cmd (EchoStdout False) "perl boot"
module Rules.Setup (setupRules) where
import qualified System.Info
import Base
import Builder
import CmdLineFlag
import Context
import GHC (compiler)
import Rules.Actions
import Rules.Generators.GhcAutoconfH
import Stage
import Target
setupRules :: Rules ()
setupRules = do
[configFile, "settings", configH] &%> \outs -> do
case cmdSetup of
RunSetup _ -> do
-- We cannot use windowsHost here due to a cyclic dependency
when (System.Info.os == "mingw32") $ do
putBuild "| Checking for Windows tarballs..."
quietly $ cmd [ "bash"
, "mk/get-win32-tarballs.sh"
, "download"
, System.Info.arch ]
let srcs = map (<.> "in") outs
context = vanillaContext Stage0 compiler
need srcs
build $ Target context (Configure ".") srcs outs
SkipSetup -> unlessM (doesFileExist configFile) $
putError $ "Configuration file " ++ configFile ++ " is missing."
++ "\nRun the configure script either manually or via the "
++ "build system by passing --setup[=CONFIGURE_ARGS] flag."
["configure", configH <.> "in"] &%> \_ -> do
need ["configure.ac"]
case cmdSetup of
RunSetup _ -> do
putBuild "| Running boot..."
quietly $ cmd (EchoStdout False) "perl boot"
SkipSetup -> unlessM (doesFileExist "configure") $
putError $ "The configure script is missing."
++ "\nRun the boot script either manually or via the "
++ "build system by passing --setup[=CONFIGURE_ARGS] flag."
module Settings.Builders.Configure (configureArgs) where
import Base
import CmdLineFlag
import Expression
import Oracles.Config.Setting
import Predicates (builder)
......@@ -9,11 +8,7 @@ import Settings
configureArgs :: Args
configureArgs = mconcat
[ builder (Configure ".") ? case cmdSetup of
RunSetup setup -> arg setup
_ -> mempty
, builder (Configure libffiBuildPath) ? do
[ builder (Configure libffiBuildPath) ? do
top <- getTopDirectory
targetPlatform <- getSetting TargetPlatform
mconcat [ arg $ "--prefix=" ++ top -/- libffiBuildPath -/- "inst"
......
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