summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hadrian/.travis.yml12
-rw-r--r--hadrian/README.md28
-rw-r--r--hadrian/appveyor.yml28
-rw-r--r--hadrian/cabal.project8
-rw-r--r--hadrian/circle.yml7
-rw-r--r--hadrian/doc/cross-compile.md4
-rw-r--r--hadrian/hadrian.cabal2
-rw-r--r--hadrian/src/CommandLine.hs32
-rw-r--r--hadrian/src/Rules/Configure.hs15
-rw-r--r--hadrian/src/Settings/Packages/GhcCabal.hs11
-rw-r--r--hadrian/src/Settings/Packages/Rts.hs8
-rw-r--r--hadrian/stack.yaml4
12 files changed, 93 insertions, 66 deletions
diff --git a/hadrian/.travis.yml b/hadrian/.travis.yml
index e2455b2da3..b89f42b60e 100644
--- a/hadrian/.travis.yml
+++ b/hadrian/.travis.yml
@@ -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
@@ -76,10 +76,12 @@ install:
- cabal update
- cabal install alex happy
+ # GHC comes with an older version of Hadrian, so we delete it
+ - rm -r ghc/hadrian/*
+
# Travis has already cloned Hadrian into ./ and we need to move it
# to ./ghc/hadrian -- one way to do it is to move the .git directory
# and perform a hard reset in order to regenerate Hadrian files
- - mkdir ghc/hadrian
- mv .git ghc/hadrian
- cd ghc/hadrian
- git reset --hard HEAD
diff --git a/hadrian/README.md b/hadrian/README.md
index eb3dd86be6..916edc21a1 100644
--- a/hadrian/README.md
+++ b/hadrian/README.md
@@ -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.
diff --git a/hadrian/appveyor.yml b/hadrian/appveyor.yml
index fbedf8f179..32fc436763 100644
--- a/hadrian/appveyor.yml
+++ b/hadrian/appveyor.yml
@@ -1,4 +1,4 @@
-clone_folder: "c:\\ghc\\hadrian"
+clone_folder: "c:\\new-hadrian"
environment:
global:
STACK_ROOT: "c:\\sr"
@@ -11,28 +11,30 @@ install:
- curl -ostack.zip -LsS --insecure https://www.stackage.org/stack/windows-x86_64
- 7z x stack.zip stack.exe
+ # Note: AppVeyor has already cloned Hadrian into c:\new-hadrian
# Fetch GHC sources into c:\ghc
- # Note: AppVeyor has already cloned Hadrian into c:\ghc\hadrian, so it's tricky
- cd ..
- - git init
- - git remote add origin git://git.haskell.org/ghc.git
- - git pull --recurse-submodules origin master
- - git submodule update --init --recursive --quiet
+ - git clone --recursive git://git.haskell.org/ghc.git
+ # GHC comes with an older version of Hadrian, so we delete it
+ - rm -rf ghc\hadrian
+ # Copy new Hadrian into ./ghc/hadrian
+ - cp -r new-hadrian ghc\hadrian
+
+ # Install Alex and Happy
+ - set PATH=C:\Users\appveyor\AppData\Roaming\local\bin;%PATH%
+ - ghc\hadrian\stack install --install-ghc alex happy > nul
# Install all Hadrian and GHC build dependencies
- - cd hadrian
+ - cd ghc\hadrian
- stack setup > nul
- appveyor-retry stack exec -- pacman -S autoconf automake-wrapper make patch python tar --noconfirm
build_script:
- # Build Hadrian
- - stack build alex happy # Otherwise 'build' fails on AppVeyor
-
- # Run internal Hadrian tests
- - build selftest
+ # Build Hadrian and run internal Hadrian tests
+ - 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 ..
diff --git a/hadrian/cabal.project b/hadrian/cabal.project
index 1ef81ca2d0..317094fb74 100644
--- a/hadrian/cabal.project
+++ b/hadrian/cabal.project
@@ -1,2 +1,6 @@
-packages: ../libraries/Cabal/Cabal/
- ./
+packages: ./
+ ../libraries/Cabal/Cabal/
+ ../libraries/filepath/
+ ../libraries/text/
+ ../libraries/hpc/
+ ../libraries/parsec/
diff --git a/hadrian/circle.yml b/hadrian/circle.yml
index a386d72da8..e9a4b6a09e 100644
--- a/hadrian/circle.yml
+++ b/hadrian/circle.yml
@@ -21,7 +21,8 @@ compile:
- git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/
- git clone --depth 1 --recursive git://github.com/ghc/ghc
- - mkdir ghc/hadrian
+ # GHC comes with an older version of Hadrian, so we delete it
+ - rm -r ghc/hadrian/*
# move hadrian's .git into ./ghc/hadrian and perform a hard reset in order to regenerate Hadrian files
- mv .git ghc/hadrian
# NOTE: we must write them in the same line because each line
@@ -30,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:
diff --git a/hadrian/doc/cross-compile.md b/hadrian/doc/cross-compile.md
index 1bff4eceaa..5611d2a8bb 100644
--- a/hadrian/doc/cross-compile.md
+++ b/hadrian/doc/cross-compile.md
@@ -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.
diff --git a/hadrian/hadrian.cabal b/hadrian/hadrian.cabal
index 566437e561..389f5530c1 100644
--- a/hadrian/hadrian.cabal
+++ b/hadrian/hadrian.cabal
@@ -118,7 +118,7 @@ executable hadrian
, TypeFamilies
build-depends: base >= 4.8 && < 5
, ansi-terminal == 0.6.*
- , Cabal == 2.0.0.2
+ , Cabal >= 2.0.0.2 && < 2.2
, containers == 0.5.*
, directory >= 1.2 && < 1.4
, extra >= 1.4.7
diff --git a/hadrian/src/CommandLine.hs b/hadrian/src/CommandLine.hs
index 1ba38c4850..2344dcc99c 100644
--- a/hadrian/src/CommandLine.hs
+++ b/hadrian/src/CommandLine.hs
@@ -1,6 +1,6 @@
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
diff --git a/hadrian/src/Rules/Configure.hs b/hadrian/src/Rules/Configure.hs
index dd016c149f..9de31e2bbc 100644
--- a/hadrian/src/Rules/Configure.hs
+++ b/hadrian/src/Rules/Configure.hs
@@ -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..."
diff --git a/hadrian/src/Settings/Packages/GhcCabal.hs b/hadrian/src/Settings/Packages/GhcCabal.hs
index 7d2e99e536..0e915b3ea6 100644
--- a/hadrian/src/Settings/Packages/GhcCabal.hs
+++ b/hadrian/src/Settings/Packages/GhcCabal.hs
@@ -11,14 +11,21 @@ ghcCabalPackageArgs = stage0 ? package ghcCabal ? builder Ghc ? do
cabalDeps <- expr $ stage1Dependencies cabal
cabalVersion <- expr $ pkgVersion (unsafePkgCabalFile cabal) -- TODO: improve
mconcat
- [ pure [ "-package " ++ pkgName pkg | pkg <- cabalDeps, pkg /= parsec ]
+ [ pure [ "-package " ++ pkgName pkg | pkg <- cabalDeps \\ [parsec, mtl] ]
, arg "--make"
, arg "-j"
, pure ["-Wall", "-fno-warn-unused-imports", "-fno-warn-warnings-deprecations"]
, arg ("-DCABAL_VERSION=" ++ replace "." "," cabalVersion)
+ , arg "-DCABAL_PARSEC"
, arg "-DBOOTSTRAPPING"
, arg "-DMIN_VERSION_binary_0_8_0"
+ , arg "libraries/text/cbits/cbits.c"
, arg "-ilibraries/Cabal/Cabal"
, arg "-ilibraries/binary/src"
, arg "-ilibraries/filepath"
- , arg "-ilibraries/hpc" ]
+ , arg "-ilibraries/hpc"
+ , arg "-ilibraries/mtl"
+ , arg "-ilibraries/text"
+ , arg "-Ilibraries/text/include"
+ , arg "-ilibraries/parsec" ]
+
diff --git a/hadrian/src/Settings/Packages/Rts.hs b/hadrian/src/Settings/Packages/Rts.hs
index b15bb6af8a..cdc89dae56 100644
--- a/hadrian/src/Settings/Packages/Rts.hs
+++ b/hadrian/src/Settings/Packages/Rts.hs
@@ -177,9 +177,15 @@ rtsPackageArgs = package rts ? do
, input "//StgCRun.c" ? windowsHost ? arg "-Wno-return-local-addr"
, input "//RetainerProfile.c" ? flag GccIsClang ?
arg "-Wno-incompatible-pointer-types"
+ , windowsHost ? arg ("-DWINVER=" ++ windowsVersion)
+
+ -- libffi's ffi.h triggers various warnings
, inputs [ "//Interpreter.c", "//Storage.c", "//Adjustor.c" ] ?
arg "-Wno-strict-prototypes"
- , windowsHost ? arg ("-DWINVER=" ++ windowsVersion) ]
+ , inputs ["//Interpreter.c", "//Adjustor.c", "//sm/Storage.c"] ?
+ anyTargetArch ["powerpc"] ? arg "-Wno-undef"
+ ]
+
mconcat
[ builder (Cc FindCDependencies) ? cArgs
, builder (Ghc CompileCWithGhc) ? map ("-optc" ++) <$> cArgs
diff --git a/hadrian/stack.yaml b/hadrian/stack.yaml
index da037630ab..a1b7413474 100644
--- a/hadrian/stack.yaml
+++ b/hadrian/stack.yaml
@@ -7,6 +7,10 @@ resolver: lts-9.0
packages:
- '.'
- '../libraries/Cabal/Cabal'
+- '../libraries/filepath/'
+- '../libraries/text/'
+- '../libraries/hpc/'
+- '../libraries/parsec/'
extra-deps:
- shake-0.16