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