Commit f15e851c authored by Andrey Mokhov's avatar Andrey Mokhov Committed by GitHub

Do not run configure by default (#458)

See #457

* Do not run configure by default

* Enable automated configure on CI

* Update docs
parent 5baa8db6
......@@ -18,10 +18,10 @@ matrix:
script:
# Run internal Hadrian tests
- ./build.sh selftest
- ./build.sh -c selftest
# Build GHC
- ./build.sh -j $MODE --no-progress --progress-colour=never --profile=-
- ./build.sh -j -c $MODE --no-progress --progress-colour=never --profile=-
- os: linux
env: MODE="--flavour=quickest --integer-simple"
......@@ -40,7 +40,7 @@ matrix:
script:
# Build GHC
- ./build.sh -j $MODE --no-progress --progress-colour=never --profile=-
- ./build.sh -j -c $MODE --no-progress --progress-colour=never --profile=-
# Test GHC binary
- cd ..
......@@ -56,7 +56,7 @@ matrix:
script:
# Due to timeout limit of OS X build on Travis CI,
# we will ignore selftest and build only stage1
- ./build.sh -j $MODE --no-progress --progress-colour=never --profile=-
- ./build.sh -j -c $MODE --no-progress --progress-colour=never --profile=-
install:
# Add Cabal to PATH
......
......@@ -31,9 +31,9 @@ hadrian/build.bat -j
```
Here flag `-j` enables parallelism and is optional. We will further refer to the build script
simply as `build`. Note that Hadrian runs the `boot` and `configure` scripts automatically when
needed. Use `--skip-configure` to suppress this behaviour (see the overview of command line
flags below).
simply as `build`. Note that Hadrian can also run the `boot` and `configure` scripts
automatically if you pass the flag `--configure`, or simply `-c`. See the overview of
command line flags below.
Notes:
......@@ -55,6 +55,17 @@ are placed into `_build` and `inplace` directories.
In addition to standard Shake flags (try `--help`), the build system
currently supports several others:
* `--configure` or `-c`: use this flag to run the `boot` and `configure` scripts
automatically, so that you don't have to remember to run them manually as you normally
do when using Make (typically only in the first build):
```bash
./boot
./configure # On Windows run ./configure --enable-tarballs-autodownload
```
Beware that with this flag Hadrian may do network I/O on Windows to download necessary
tarballs, which may sometimes be undesirable.
* `--flavour=FLAVOUR`: choose a build flavour. The following settings are currently supported:
`default`, `quick`, `quickest`, `perf`, `prof`, `devel1` and `devel2`. As an example, the
`quickest` flavour adds `-O0` flag to all GHC invocations and builds libraries only in the
......@@ -79,17 +90,6 @@ colours).
settings: `none`, `brief` (one line per build command; this is the default setting),
`normal` (typically a box per build command), and `unicorn` (when `normal` just won't do).
* `--skip-configure`: use this flag to suppress the default behaviour of Hadrian that
runs the `boot` and `configure` scripts automatically when needed, so that you don't have
to remember to run them manually. With `--skip-configure` you will need to manually run:
```bash
./boot
./configure # On Windows run ./configure --enable-tarballs-autodownload
```
as you normally do when using `make`. Beware, by default Hadrian may do network I/O on
Windows to download necessary tarballs, which may sometimes be undesirable; `--skip-configure`
is your friend in such cases.
* `--split-objects`: generate split objects, which are switched off by default. Due to
a GHC [bug][ghc-split-objs-bug], you need a full clean rebuild when using this flag.
......
......@@ -31,10 +31,10 @@ install:
build_script:
# Build Hadrian and run internal Hadrian tests
- build selftest
- build -c selftest
# Build GHC
- build -j --flavour=quickest --no-progress --progress-colour=never --profile=-
- build -j -c --flavour=quickest --no-progress --progress-colour=never --profile=-
# Test GHC binary
- cd ..
......
......@@ -31,10 +31,10 @@ compile:
# XXX: export PATH doesn't work well either, so we use inline env
# Self test
- PATH=$HOME/.cabal/bin:$PATH ghc/hadrian/build.sh selftest
- PATH=$HOME/.cabal/bin:$PATH ghc/hadrian/build.sh -c selftest
# Build GHC
- PATH=$HOME/.cabal/bin:$PATH ghc/hadrian/build.sh -j $MODE --no-progress --progress-colour=never --profile=-
- PATH=$HOME/.cabal/bin:$PATH ghc/hadrian/build.sh -j -c $MODE --no-progress --progress-colour=never --profile=-
test:
override:
......
......@@ -16,8 +16,8 @@ After all the dependencies are in place:
- `git submodule update --init`
- `./configure --target=arm-linux-gnueabihf`
- `cd hadrian`
- Modify `src/Settings.hs`, set `stage1Only` and `crossCompiling` to `True`.
- Build the compiler by e.g. `./build.sh --flavour=quickest --integer-simple --skip-configure -V -j`
- Modify `src/UserSettings.hs`, set `stage1Only` and `crossCompiling` to `True`.
- Build the compiler by e.g. `./build.sh --flavour=quickest --integer-simple -V -j`
After that, you should have built `inplace/bin/ghc-stage1` cross compiler. We will go to the next section to validate this.
......
module CommandLine (
optDescrs, cmdLineArgsMap, cmdFlavour, lookupFreeze1, cmdIntegerSimple,
cmdProgressColour, cmdProgressInfo, cmdSkipConfigure, cmdSplitObjects,
cmdProgressColour, cmdProgressInfo, cmdConfigure, cmdSplitObjects,
cmdInstallDestDir
) where
......@@ -14,34 +14,37 @@ import System.Environment
-- | All arguments that can be passed to Hadrian via the command line.
data CommandLineArgs = CommandLineArgs
{ flavour :: Maybe String
{ configure :: Bool
, flavour :: Maybe String
, freeze1 :: Bool
, installDestDir :: Maybe String
, integerSimple :: Bool
, progressColour :: UseColour
, progressInfo :: ProgressInfo
, skipConfigure :: Bool
, splitObjects :: Bool }
deriving (Eq, Show)
-- | Default values for 'CommandLineArgs'.
defaultCommandLineArgs :: CommandLineArgs
defaultCommandLineArgs = CommandLineArgs
{ flavour = Nothing
{ configure = False
, flavour = Nothing
, freeze1 = False
, installDestDir = Nothing
, integerSimple = False
, progressColour = Auto
, progressInfo = Brief
, skipConfigure = False
, splitObjects = False }
readFreeze1 :: Either String (CommandLineArgs -> CommandLineArgs)
readFreeze1 = Right $ \flags -> flags { freeze1 = True }
readConfigure :: Either String (CommandLineArgs -> CommandLineArgs)
readConfigure = Right $ \flags -> flags { configure = True }
readFlavour :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
readFlavour ms = Right $ \flags -> flags { flavour = lower <$> ms }
readFreeze1 :: Either String (CommandLineArgs -> CommandLineArgs)
readFreeze1 = Right $ \flags -> flags { freeze1 = True }
readInstallDestDir :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
readInstallDestDir ms = Right $ \flags -> flags { installDestDir = ms }
......@@ -73,16 +76,15 @@ readProgressInfo ms =
set :: ProgressInfo -> CommandLineArgs -> CommandLineArgs
set flag flags = flags { progressInfo = flag }
readSkipConfigure :: Either String (CommandLineArgs -> CommandLineArgs)
readSkipConfigure = Right $ \flags -> flags { skipConfigure = True }
readSplitObjects :: Either String (CommandLineArgs -> CommandLineArgs)
readSplitObjects = Right $ \flags -> flags { splitObjects = True }
-- | Standard 'OptDescr' descriptions of Hadrian's command line arguments.
optDescrs :: [OptDescr (Either String (CommandLineArgs -> CommandLineArgs))]
optDescrs =
[ Option [] ["flavour"] (OptArg readFlavour "FLAVOUR")
[ Option ['c'] ["configure"] (NoArg readConfigure)
"Run the boot and configure scripts (if you do not want to run them manually)."
, Option [] ["flavour"] (OptArg readFlavour "FLAVOUR")
"Build flavour (Default, Devel1, Devel2, Perf, Prof, Quick or Quickest)."
, Option [] ["freeze1"] (NoArg readFreeze1)
"Freeze Stage1 GHC."
......@@ -94,8 +96,6 @@ optDescrs =
"Use colours in progress info (Never, Auto or Always)."
, Option [] ["progress-info"] (OptArg readProgressInfo "STYLE")
"Progress info style (None, Brief, Normal or Unicorn)."
, 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)." ]
......@@ -112,6 +112,9 @@ cmdLineArgsMap = do
cmdLineArgs :: Action CommandLineArgs
cmdLineArgs = userSetting defaultCommandLineArgs
cmdConfigure :: Action Bool
cmdConfigure = configure <$> cmdLineArgs
cmdFlavour :: Action (Maybe String)
cmdFlavour = flavour <$> cmdLineArgs
......@@ -130,8 +133,5 @@ cmdProgressColour = progressColour <$> cmdLineArgs
cmdProgressInfo :: Action ProgressInfo
cmdProgressInfo = progressInfo <$> cmdLineArgs
cmdSkipConfigure :: Action Bool
cmdSkipConfigure = skipConfigure <$> cmdLineArgs
cmdSplitObjects :: Action Bool
cmdSplitObjects = splitObjects <$> cmdLineArgs
......@@ -13,12 +13,12 @@ import Utilities
configureRules :: Rules ()
configureRules = do
[configFile, "settings", configH] &%> \outs -> do
skip <- cmdSkipConfigure
skip <- not <$> cmdConfigure
if skip
then unlessM (doesFileExist configFile) $
error $ "Configuration file " ++ configFile ++ " is missing."
++ "\nRun the configure script manually or do not use the "
++ "--skip-configure flag."
error $ "Configuration file " ++ configFile ++ " is missing.\n"
++ "Run the configure script manually or let Hadrian run it "
++ "automatically by passing the flag --configure."
else do
-- We cannot use windowsHost here due to a cyclic dependency.
when System.isWindows $ do
......@@ -30,11 +30,12 @@ configureRules = do
build $ target context (Configure ".") srcs outs
["configure", configH <.> "in"] &%> \_ -> do
skip <- cmdSkipConfigure
skip <- not <$> cmdConfigure
if skip
then unlessM (doesFileExist "configure") $
error $ "The configure script is missing.\nRun the boot script"
++ " manually or do not use the --skip-configure flag."
error $ "The configure script is missing.\nRun the boot script "
++ "manually let Hadrian run it automatically by passing the "
++ "flag --configure."
else do
need ["configure.ac"]
putBuild "| Running 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