diff options
author | Ben Gamari <ben@smart-cactus.org> | 2017-11-08 01:18:44 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-11-08 01:18:44 -0500 |
commit | 14d885e843f6907dbc5048ae66aca25d738e99f7 (patch) | |
tree | b67d99ccac2d6e43cdc740d335cd20575fbdf334 | |
parent | bf9ba7b43fc8c262f24ec3d1e6e13c9a7cad4b3b (diff) | |
parent | ed18f47f931361a9adbb109085c6feb432ec41aa (diff) | |
download | haskell-14d885e843f6907dbc5048ae66aca25d738e99f7.tar.gz |
Merge remote-tracking branch 'github/pr/83'
-rw-r--r-- | .circleci/config.yml | 151 | ||||
-rwxr-xr-x | .circleci/fetch-submodules.sh | 9 | ||||
-rw-r--r-- | .circleci/images/x86_64-freebsd/Dockerfile | 24 | ||||
-rwxr-xr-x | .circleci/images/x86_64-freebsd/build-toolchain.sh | 102 | ||||
-rwxr-xr-x | .circleci/prepare-system.sh | 64 | ||||
-rw-r--r-- | appveyor.yml | 43 |
6 files changed, 370 insertions, 23 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ee6c48b21..c35ac219ec 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,28 +1,133 @@ version: 2 -jobs: - build: + +aliases: + - &defaults working_directory: ~/ghc + + # Make sure we have proper openssh before checkout: CircleCI git + # does not check the repository out properly without it and also + # takes 20 times longer than it should be. + - &precheckout + run: + name: Install OpenSSH client + command: | + apt-get update -qq + apt-get install -qy openssh-client + - &prepare + run: + name: prepare-system + command: .circleci/prepare-system.sh + - &submodules + run: + name: submodules + command: .circleci/fetch-submodules.sh + - &buildenv + THREADS: 8 + SKIP_PERF_TESTS: YES + VERBOSE: 2 + - &boot + run: + name: Boot + command: ./boot + - &configure_unix + run: + name: Configure + command: ./configure + - &configure_bsd + run: + name: Configure + command: ./configure --target=x86_64-unknown-freebsd10 + - &make + run: + name: Build + command: "make -j$THREADS" + - &test + run: + name: Test + command: make test + - &bindist + run: + name: Create bindist + command: make binary-dist + # Building bindist takes ~15 minutes without output, account for + # that. + no_output_timeout: "30m" + - &collectartifacts + run: + name: Collect artifacts + # We need this because CircleCI expects a path without + # wildcards but bindist archive name is not static + command: | + mkdir -p /tmp/artifacts + pwd + find . + cp ghc*.tar.xz /tmp/artifacts + - &storeartifacts + store-artifacts: + path: /tmp/artifacts + +jobs: + "validate-x86_64-linux": + resource_class: xlarge docker: - - image: haskell:8 + - image: haskell:8.2 + environment: + <<: *buildenv + steps: + - *precheckout + - checkout + - *prepare + - *submodules + - *boot + - *configure_unix + - *make + - *test + - *bindist + - *collectartifacts + - *storeartifacts + + "validate-x86_64-freebsd": resource_class: xlarge + docker: + - image: tweag/toolchain-x86_64-freebsd + environment: + TARGET: FreeBSD + <<: *buildenv + steps: + - *precheckout + - checkout + - *prepare + - *submodules + - *boot + - *configure_bsd + - *make + - *test + - *bindist + - *collectartifacts + - *storeartifacts + + "validate-x86_64-darwin": + macos: + xcode: "9.0" + environment: + <<: *buildenv steps: - - run: - name: git - command: | - apt-get update - apt-get install -y git openssh-client make automake autoconf gcc perl python3 - - checkout - - run: - name: submodules - command: | - # Use github.com/ghc for those submodule repositories we couldn't connect to. - git config remote.origin.url git://github.com/ghc/ghc.git - git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/ - git submodule init # Don't be quiet, we want to show these urls. - git submodule --quiet update --recursive # Now we can be quiet again. - - run: - name: build - command: | - echo 'BUILD_SPHINX_HTML = NO' >> mk/validate.mk - echo 'BUILD_SPHINX_PDF = NO' >> mk/validate.mk - THREADS=8 SKIP_PERF_TESTS=YES VERBOSE=2 ./validate --fast --quiet + - checkout + - *prepare + - *submodules + - *boot + - *configure_unix + - *make + - *test + - *bindist + - *collectartifacts + - *storeartifacts + +workflows: + version: 2 + validate: + jobs: + - validate-x86_64-linux + # FreeBSD disabled: https://github.com/haskell/unix/issues/102 + # - validate-x86_64-freebsd + - validate-x86_64-darwin diff --git a/.circleci/fetch-submodules.sh b/.circleci/fetch-submodules.sh new file mode 100755 index 0000000000..7279d21fd4 --- /dev/null +++ b/.circleci/fetch-submodules.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -euo pipefail + +# Use github.com/ghc for those submodule repositories we couldn't connect to. +git config remote.origin.url git://github.com/ghc/ghc.git +git config --global url."git://github.com/ghc/packages-".insteadOf git://github.com/ghc/packages/ +git submodule init # Don't be quiet, we want to show these urls. +git submodule --quiet update --recursive # Now we can be quiet again. diff --git a/.circleci/images/x86_64-freebsd/Dockerfile b/.circleci/images/x86_64-freebsd/Dockerfile new file mode 100644 index 0000000000..9c51cc021c --- /dev/null +++ b/.circleci/images/x86_64-freebsd/Dockerfile @@ -0,0 +1,24 @@ +FROM ubuntu:16.04 + +RUN apt-get update && apt-get install -y --no-install-recommends \ + autoconf \ + automake \ + bzip2 \ + ca-certificates \ + curl \ + file \ + g++ \ + git \ + make \ + openssh-client \ + patch \ + perl \ + python2.7 \ + python3 \ + software-properties-common \ + sudo \ + wget \ + xz-utils + +COPY build-toolchain.sh /tmp/ +RUN /tmp/build-toolchain.sh x86_64 diff --git a/.circleci/images/x86_64-freebsd/build-toolchain.sh b/.circleci/images/x86_64-freebsd/build-toolchain.sh new file mode 100755 index 0000000000..56b8315afe --- /dev/null +++ b/.circleci/images/x86_64-freebsd/build-toolchain.sh @@ -0,0 +1,102 @@ +#!/usr/bin/env bash + +set -ex + +ARCH=$1 +BINUTILS=2.25.1 +GCC=6.4.0 +FREEBSD=10.4-RELEASE + +mkdir binutils +cd binutils + +# Build binutils for target platform. +curl https://ftp.gnu.org/gnu/binutils/binutils-$BINUTILS.tar.bz2 | tar xjf - + +mkdir binutils-build +cd binutils-build +../binutils-$BINUTILS/configure --target=$ARCH-unknown-freebsd10 +make -j$(nproc) +make install +cd .. + +cd .. +rm -rf binutils + +mkdir freebsd +case "$ARCH" in + x86_64) + FREEBSD_ARCH=amd64 + ;; + i686) + FREEBSD_ARCH=i386 + ;; +esac + +URL=ftp://ftp.freebsd.org/pub/FreeBSD/releases/$FREEBSD_ARCH/$FREEBSD/base.txz +curl $URL | tar xJf - -C freebsd ./usr/include ./usr/lib ./lib + +dst=/usr/local/$ARCH-unknown-freebsd10 + +cp -r freebsd/usr/include $dst/ +cp freebsd/usr/lib/crt1.o $dst/lib +cp freebsd/usr/lib/Scrt1.o $dst/lib +cp freebsd/usr/lib/crti.o $dst/lib +cp freebsd/usr/lib/crtn.o $dst/lib +cp freebsd/usr/lib/libc.a $dst/lib +cp freebsd/usr/lib/libutil.a $dst/lib +cp freebsd/usr/lib/libutil_p.a $dst/lib +cp freebsd/usr/lib/libm.a $dst/lib +cp freebsd/usr/lib/librt.so.1 $dst/lib +cp freebsd/usr/lib/libexecinfo.so.1 $dst/lib +cp freebsd/lib/libc.so.7 $dst/lib +cp freebsd/lib/libm.so.5 $dst/lib +cp freebsd/lib/libutil.so.9 $dst/lib +cp freebsd/lib/libthr.so.3 $dst/lib +cp freebsd/lib/libncurses.so.8 $dst/lib +cp freebsd/lib/libncursesw.so.8 $dst/lib + +# Install iconv port in target env. +URL_ICONV=http://pkg.freebsd.org/FreeBSD:11:$FREEBSD_ARCH/latest/All/libiconv-1.14_11.txz +curl $URL_ICONV | tar xJf - -C freebsd +cp -r freebsd/usr/local/include $dst/ +cp -d freebsd/usr/local/lib/* $dst/lib + +ln -s libc.so.7 $dst/lib/libc.so +ln -s libm.so.5 $dst/lib/libm.so +ln -s librt.so.1 $dst/lib/librt.so +ln -s libutil.so.9 $dst/lib/libutil.so +ln -s libexecinfo.so.1 $dst/lib/libexecinfo.so +ln -s libthr.so.3 $dst/lib/libpthread.so +ln -s libncurses.so.8 $dst/lib/libncurses.so +ln -s libncursesw.so.8 $dst/lib/libncursesw.so +rm -rf freebsd + +# Build gcc for target platform. +mkdir gcc +cd gcc +curl https://ftp.gnu.org/gnu/gcc/gcc-$GCC/gcc-$GCC.tar.gz | tar xzf - +cd gcc-$GCC +./contrib/download_prerequisites + +mkdir ../gcc-build +cd ../gcc-build +../gcc-$GCC/configure \ + --enable-languages=c \ + --target=$ARCH-unknown-freebsd10 \ + --disable-nls \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libssp \ + --disable-libvtv \ + --disable-libcilkrts \ + --disable-libada \ + --disable-libsanitizer \ + --disable-libquadmath-support \ + --disable-lto +make -j$(nproc) +make install +cd .. + +cd .. +rm -rf gcc diff --git a/.circleci/prepare-system.sh b/.circleci/prepare-system.sh new file mode 100755 index 0000000000..063c70a328 --- /dev/null +++ b/.circleci/prepare-system.sh @@ -0,0 +1,64 @@ +#!/usr/bin/env bash +# vim: sw=2 et +set -euo pipefail + +fail() { + echo "ERROR: $*" >&2 + exit 1 +} + +echo 'BUILD_SPHINX_HTML = NO' > mk/validate.mk +echo 'BUILD_SPHINX_PDF = NO' >> mk/validate.mk + +cat > mk/build.mk <<EOF +V=1 +HADDOCK_DOCS=YES +LATEX_DOCS=YES +HSCOLOUR_SRCS=YES +BUILD_DOCBOOK_HTML=YES +BeConservative=YES +EOF + +case "$(uname)" in + Linux) + if [[ -n ${TARGET:-} ]]; then + if [[ $TARGET = FreeBSD ]]; then + # cross-compiling to FreeBSD + add-apt-repository -y ppa:hvr/ghc + apt-get update -qq + apt-get install -qy ghc-8.0.2 cabal-install-1.24 alex happy \ + ncurses-dev git make automake autoconf gcc perl \ + python3 texinfo xz-utils + cabal update + cabal install --reinstall hscolour + ln -s $HOME/.cabal/bin/HsColour /usr/local/bin/HsColour + + echo 'HADDOCK_DOCS = NO' >> mk/build.mk + echo 'WERROR=' >> mk/build.mk + # https://circleci.com/docs/2.0/env-vars/#interpolating-environment-variables-to-set-other-environment-variables + echo 'export PATH=/opt/ghc/bin:$PATH' >> $BASH_ENV + else + fail "TARGET=$target not supported" + fi + else + # assuming Ubuntu + apt-get install -qy git make automake autoconf gcc perl python3 texinfo xz-utils + cabal update + cabal install --reinstall hscolour + fi + ;; + Darwin) + if [[ -n ${TARGET:-} ]]; then + fail "uname=$(uname) not supported for cross-compilation" + fi + brew install ghc cabal-install python3 ncurses + cabal update + cabal install --reinstall alex happy haddock hscolour + # put them on the $PATH, don't fail if already installed + ln -s $HOME/.cabal/bin/alex /usr/local/bin/alex || true + ln -s $HOME/.cabal/bin/happy /usr/local/bin/happy || true + ln -s $HOME/.cabal/bin/hscolour /usr/local/bin/hscolour || true + ;; + *) + fail "uname=$(uname) not supported" +esac diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000000..8ded95daa8 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,43 @@ +version: "{build}" + +build: + verbosity: normal + +environment: + matrix: + - COMPILER: msys2 + PLATFORM: x64 + MSYS2_ARCH: x86_64 + MSYS2_DIR: msys64 + MSYSTEM: MINGW64 + BIT: 64 + +os: Visual Studio 2015 +deploy: off + +install: + - cmd: | + SET "PATH=C:\%MSYS2_DIR%\%MSYSTEM%\bin;C:\%MSYS2_DIR%\usr\bin;%PATH%" + bash -lc "pacman --noconfirm -Syuu" + bash -lc "pacman --noconfirm -S --needed git tar bsdtar binutils autoconf make xz curl libtool automake python python2 p7zip patch mingw-w64-$(uname -m)-gcc mingw-w64-$(uname -m)-python3-sphinx mingw-w64-$(uname -m)-tools-git" + bash -lc "cd $APPVEYOR_BUILD_FOLDER; git config remote.origin.url git://github.com/ghc/ghc.git" + bash -lc "cd $APPVEYOR_BUILD_FOLDER; git config --global url.\"git://github.com/ghc/packages-\".insteadOf git://github.com/ghc/packages/" + bash -lc "cd $APPVEYOR_BUILD_FOLDER; git submodule init" + bash -lc "cd $APPVEYOR_BUILD_FOLDER; git submodule --quiet update --recursive" + bash -lc "curl -L https://downloads.haskell.org/~ghc/8.2.1/ghc-8.2.1-x86_64-unknown-mingw32.tar.xz | tar -xJ -C /mingw64 --strip-components=1" + bash -lc "mkdir -p /usr/local/bin" + bash -lc "curl -L https://www.haskell.org/cabal/release/cabal-install-1.24.0.0/cabal-install-1.24.0.0-x86_64-unknown-mingw32.zip | bsdtar -xzf- -C /usr/local/bin" + bash -lc "cabal update" + bash -lc "cabal install -j --prefix=/usr/local alex happy" + +build_script: + - bash -lc "cd $APPVEYOR_BUILD_FOLDER; ./boot" + - bash -lc "cd $APPVEYOR_BUILD_FOLDER; ./configure --enable-tarballs-autodownload" + - bash -lc "cd $APPVEYOR_BUILD_FOLDER; make -j2" + - bash -lc "cd $APPVEYOR_BUILD_FOLDER; make binary_dist" + bash -lc "cd $APPVEYOR_BUILD_FOLDER; 7z a ghc-windows.zip *.tar.xz" + +artifacts: + - path: C:\projects\ghc\ghc-windows.zip + name: GHC Windows bindist + type: zip |