Commit c1fcd9b3 authored by Andrey Mokhov's avatar Andrey Mokhov

Squashed 'hadrian/' changes from 5ebb69ae..fa3771fe

fa3771fe hadrian: Disable -Wno-undef in files which include ffi.h (#459)
f15e851c Do not run configure by default (#458)
5baa8db6 Fix AppVeyor cache failure (#456)
94dbe9d7 Fix ghc-cabal build (#455)
a6797641 Fix CI scripts (#454)
06ec241e Widen bounds on Cabal (#452)

git-subtree-dir: hadrian
git-subtree-split: fa3771fe
parent 5229c43c
......@@ -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
......
......@@ -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.
......
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 ..
......
packages: ../libraries/Cabal/Cabal/
./
packages: ./
../libraries/Cabal/Cabal/
../libraries/filepath/
../libraries/text/
../libraries/hpc/
../libraries/parsec/
......@@ -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:
......
......@@ -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.
......
......@@ -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
......
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..."
......
......@@ -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" ]
......@@ -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
......
......@@ -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
......
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