aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testing/ghc-bootstrap/APKBUILD22
-rw-r--r--testing/ghc-bootstrap/Dockerfile.armhf151
-rw-r--r--testing/ghc-bootstrap/Dockerfile.x86_6417
-rw-r--r--testing/ghc-bootstrap/build-hp2ps-twice.patch25
-rw-r--r--testing/ghc-bootstrap/build-unlit-twice.patch58
5 files changed, 100 insertions, 173 deletions
diff --git a/testing/ghc-bootstrap/APKBUILD b/testing/ghc-bootstrap/APKBUILD
index 85d2a8c271..3cd647697e 100644
--- a/testing/ghc-bootstrap/APKBUILD
+++ b/testing/ghc-bootstrap/APKBUILD
@@ -9,36 +9,32 @@
# in the native compiler.
pkgname=ghc-bootstrap
pkgver=8.0.2
-pkgrel=0
+pkgrel=1
pkgdesc="The Glasgow haskell compiler (bootstrapped)"
-#arch="x86_64"
license="custom:bsd3"
url="https://haskell.org"
depends="bash libffi musl zlib gcc binutils-gold llvm3.7"
install=""
subpackages=""
makedepends=""
-source="http://dev.alpinelinux.org/archive/ghc-bootstrap/ghc-$pkgver-x86_64.tar.xz
- "
+source="http://dev.alpinelinux.org/archive/ghc-bootstrap/ghc-$pkgver-x86_64.tar.xz"
# The bootstrap process uses docker to build ghc from a debian glibc host
# then upload the bootstrap compiler to where that source url is.
#
# Ensure that docker is running prior to calling this.
#
-# Note, these docker images are large, ~10G the dockerfiles weren't built
-# to be small. Once built the containers should likely be removed.
+# Note, this docker image is large, ~10G the dockerfile wasn't built
+# to be small. Once built the container should likely be removed.
snapshot() {
- for x in $(echo ${arch}); do
- docker build -t alpine-ghc-bootstrap:${x} \
- -f Dockerfile.${x} . || return 1
- docker run -a stdout alpine-ghc-bootstrap:${x} \
- /bin/cat "/tmp/ghc-${pkgver}-${x}.tar.xz" > ghc-${pkgver}-${x}.tar.xz || return 1
- done
+ docker build -t alpine-ghc-bootstrap:x86_64 -f Dockerfile.x86_64 . \
+ || return 1
+ docker run -a stdout alpine-ghc-bootstrap:x86_64 \
+ /bin/cat "/tmp/ghc-${pkgver}-x86_64.tar.xz" > ghc-${pkgver}-x86_64.tar.xz || return 1
}
package() {
- cd "$srcdir/$CARCH"
+ cd "$srcdir/x86_64"
install -d "$pkgdir" || return 1
mv usr "$pkgdir" || return 1
local settings="$(find $pkgdir -name settings -type f)"
diff --git a/testing/ghc-bootstrap/Dockerfile.armhf b/testing/ghc-bootstrap/Dockerfile.armhf
deleted file mode 100644
index 9111bb72e3..0000000000
--- a/testing/ghc-bootstrap/Dockerfile.armhf
+++ /dev/null
@@ -1,151 +0,0 @@
-# Mostly self contained setup to build a stage2 ghc for musl
-from debian:8.0
-
-# Install stock bindist for cross compile
-env ghc 8.0.2
-env arch x86_64
-env llvm 3.7.1
-env cabal 1.24.0.2
-
-env destarch armhf
-env tardir /tmp/root
-env destdir /tmp/root/$destarch
-env triple arm-unknown-linux-musleabihf
-env target arm-linux-musleabihf
-env crosscc $triple-gcc
-
-# add cross toolchain to PATH
-env PATH /usr/$triple/bin:$PATH
-
-# all needed packages for compiling
-run apt-get clean && \
- apt-get update && \
- apt-get install -y \
- binutils-gold \
- musl-tools \
- build-essential \
- wget \
- curl \
- libncurses-dev \
- autoconf \
- elfutils \
- libgmp-dev \
- zlib1g-dev \
- git \
- libtool \
- pkg-config \
- libffi-dev \
- cmake \
- g++ \
- python \
- pixz \
- openssl \
- bison \
- git \
- flex
-
-add http://llvm.org/releases/$llvm/llvm-$llvm.src.tar.xz /tmp/
-add http://llvm.org/releases/$llvm/polly-$llvm.src.tar.xz /tmp/
-
-# Install a non ancient version of llvm on debian, I'm purposefully ignoring
-# debian repos in favor of compiling to not have to deal with
-# "what debian upstream has a current version of llvm" nonsense, takes more
-# time to do that than just build the right llvm from source.
-workdir /tmp
-copy llvm-$llvm.sh /tmp/llvm.sh
-run openssl sha1 llvm-$llvm.src.tar.xz | grep "SHA1(llvm-3.7.1.src.tar.xz)= 5dbdcafac105273dcbff94c68837a66c6dd78cef" && \
- openssl sha1 polly-$llvm.src.tar.xz | grep "SHA1(polly-3.7.1.src.tar.xz)= 0e3a461907cde7505fbdb44bf61ff318aa9254f7" && \
- tar xJpf /tmp/llvm-$llvm.src.tar.xz && \
- tar xJpf /tmp/polly-$llvm.src.tar.xz && \
- /tmp/llvm.sh && \
- rm -fr /tmp/llvm-$llvm.src /tmp/build
-
-add https://downloads.haskell.org/~ghc/$ghc/ghc-$ghc-$arch-deb8-linux.tar.xz /tmp/
-
-# Install debian ghc binary from upstream.
-workdir /tmp
-run openssl sha1 ghc-$ghc-$arch-deb8-linux.tar.xz | grep "SHA1(ghc-$ghc-x86_64-deb8-linux.tar.xz)= f298b7d0f37cc9ded7ac66b2662b0fa5ac6d0809" && \
- tar xJpf /tmp/ghc-$ghc-$arch-deb8-linux.tar.xz
-workdir /tmp/ghc-$ghc
-run ./configure --prefix=/usr && \
- make -j1 install && \
- rm -fr /tmp/ghc-$ghc
-
-run curl -kL https://www.haskell.org/cabal/release/cabal-install-$cabal/cabal-install-$cabal.tar.gz -o /tmp/cabal-install-$cabal.tar.gz
-
-# Install cabal so we can install alex/happy to pull off of git
-# bootstrap cabal and install alex/happy the same way apks are built
-# only globally
-workdir /tmp
-run openssl sha1 cabal-install-$cabal.tar.gz | grep "SHA1(cabal-install-$cabal.tar.gz)= ca019360c45be32e224b6582ab46b420fb070417" && \
- tar xzpf /tmp/cabal-install-$cabal.tar.gz
-workdir /tmp/cabal-install-$cabal
-run ./bootstrap.sh --global --no-doc && \
- cabal update && \
- cabal install --global alex happy && \
- rm -fr /tmp/cabal-install-$cabal
-
-workdir /tmp
-run git clone --depth 1 https://github.com/GregorR/musl-cross.git musl-cross
-workdir /tmp/musl-cross
-run echo GCC_BUILTIN_PREREQS=yes >> config.sh && \
- echo TRIPLE=${triple} >> config.sh && \
- echo ARCH=arm >> config.sh && \
- echo GCC_BOOTSTRAP_CONFFLAGS=\"--with-arch=armv6 --with-float=hard --with-fpu=vfp\" >> config.sh && \
- echo GCC_CONFFLAGS=\"--with-arch=armv6 --with-float=hard --with-fpu=vfp\" >> config.sh && \
- echo GCC_STAGE1_NOOPT=1 >> config.sh && \
- echo CC_BASE_PREFIX=/usr >> config.sh && \
- echo MAKEFLAGS=-j$(grep -c processor /proc/cpuinfo) >> config.sh && \
- echo "BINUTILS_CONFFLAGS='CXXFLAGS=-fpermissive --enable-gold --enable-plugins --disable-werror'" >> config.sh && \
- echo "CFLAGS='-g -O2 -fPIC -DPIC'" >> config.sh && \
- echo "CPPFLAGS='-fPIC -DPIC'" >> config.sh && \
- echo "LDFLAGS='-fPIC -DPIC'" >> config.sh
-copy gmpurl.patch gmpurl.patch
-run patch -p1 < gmpurl.patch && \
- ./build.sh && \
- rm -fr /tmp/musl-cross
-
-add http://downloads.haskell.org/~ghc/$ghc/ghc-$ghc-src.tar.xz /tmp/
-
-workdir /tmp
-run openssl sha1 ghc-$ghc-src.tar.xz | grep "SHA1(ghc-$ghc-src.tar.xz)= 0e0ae6d5ba119c10f3c7b807d35166e7c06b9b35" && \
- tar xJpf /tmp/ghc-$ghc-src.tar.xz
-workdir /tmp/ghc-$ghc
-copy bootstrap.patch bootstrap.patch
-copy rm-ghc-pwd.patch rm-ghc-pwd.patch
-run patch -p1 < bootstrap.patch && \
- patch -p1 < rm-ghc-pwd.patch
-run cp mk/build.mk.sample mk/build.mk && \
- ./boot && \
- echo "BuildFlavour = perf-llvm" >> mk/build.mk && \
- echo "BeConservative = YES" >> mk/build.mk && \
- echo "INTEGER_LIBRARY = integer-simple" >> mk/build.mk && \
- echo "HADDOCK_DOCS = NO" >> mk/build.mk && \
- echo "BUILD_SPHINX_HTML = NO" >> mk/build.mk && \
- echo "BUILD_SPHINX_PS = NO" >> mk/build.mk && \
- echo "BUILD_SPHINX_PDF = NO" >> mk/build.mk && \
- echo "SplitSections = YES" >> mk/build.mk && \
- echo "V = 0" >> mk/build.mk && \
- echo "SPLIT_CMD = :" >> mk/build.mk && \
- ./configure \
- --target=$triple \
- --prefix=/usr
-run make -j$(grep -c processor /proc/cpuinfo) || make -j1
-run make -j1 install DESTDIR=$destdir
-
-run find $destdir -name "*hp2ps" -exec rm {} \;
-
-# remove target prefix from stage2 binaries
-# HACK, just build unlit with the cross compiler and move it to /usr/bin in the install dir
-workdir /tmp/ghc-$ghc/utils/unlit
-run $crosscc unlit.c -o $(find $destdir -name unlit)
-
-# remove target prefix from stage2 binaries
-workdir $destdir/usr/bin
-run (for i in $triple-* ; do ln -s $i ${i#$triple-} || /bin/true; done ) && \
- rm -fr $destdir/usr/share/doc
-
-workdir $tardir
-# Compress to xz via pixz because xz is normally too
-# old for -TN multithreads
-run tar -I'pixz -9' -cf /tmp/ghc-$ghc-$destarch.tar.xz .
diff --git a/testing/ghc-bootstrap/Dockerfile.x86_64 b/testing/ghc-bootstrap/Dockerfile.x86_64
index 997bbd0fd3..7a99c60fdf 100644
--- a/testing/ghc-bootstrap/Dockerfile.x86_64
+++ b/testing/ghc-bootstrap/Dockerfile.x86_64
@@ -96,7 +96,9 @@ run echo GCC_BUILTIN_PREREQS=yes >> config.sh && \
echo MAKEFLAGS=-j$(grep -c processor /proc/cpuinfo) >> config.sh && \
echo "BINUTILS_CONFFLAGS='CXXFLAGS=-fpermissive --enable-gold --enable-plugins --disable-werror'" >> config.sh && \
echo "CFLAGS='-g -O3 -fno-pie -fno-pic'" >> config.sh
-run ./build.sh && \
+copy gmpurl.patch gmpurl.patch
+run patch -p1 < gmpurl.patch && \
+ ./build.sh && \
rm -fr /tmp/musl-cross
add http://downloads.haskell.org/~ghc/$ghc/ghc-$ghc-src.tar.xz /tmp/
@@ -107,8 +109,12 @@ run openssl sha1 ghc-$ghc-src.tar.xz | grep "SHA1(ghc-$ghc-src.tar.xz)= 0e0ae6d5
workdir /tmp/ghc-$ghc
copy bootstrap.patch bootstrap.patch
copy rm-ghc-pwd.patch rm-ghc-pwd.patch
+copy build-unlit-twice.patch build-unlit-twice.patch
+copy build-hp2ps-twice.patch build-hp2ps-twice.patch
run patch -p1 < bootstrap.patch && \
- patch -p1 < rm-ghc-pwd.patch
+ patch -p1 < rm-ghc-pwd.patch && \
+ patch -p1 < build-unlit-twice.patch && \
+ patch -p1 < build-hp2ps-twice.patch
run cp mk/build.mk.sample mk/build.mk && \
./boot && \
echo "BuildFlavour = perf-llvm" >> mk/build.mk && \
@@ -127,13 +133,6 @@ run cp mk/build.mk.sample mk/build.mk && \
run make -j$(grep -c processor /proc/cpuinfo) || make -j1
run make -j1 install DESTDIR=$destdir
-run find $destdir -name "*hp2ps" -exec rm {} \;
-
-# remove target prefix from stage2 binaries
-# HACK, just build unlit with the cross compiler and move it to /usr/bin in the install dir
-workdir /tmp/ghc-$ghc/utils/unlit
-run $crosscc unlit.c -o $(find $destdir -name unlit)
-
# remove target prefix from stage2 binaries
workdir $destdir/usr/bin
run (for i in $triple-* ; do ln -s $i ${i#$triple-} || /bin/true; done ) && \
diff --git a/testing/ghc-bootstrap/build-hp2ps-twice.patch b/testing/ghc-bootstrap/build-hp2ps-twice.patch
new file mode 100644
index 0000000000..47e8a8f266
--- /dev/null
+++ b/testing/ghc-bootstrap/build-hp2ps-twice.patch
@@ -0,0 +1,25 @@
+--- a/utils/hp2ps/ghc.mk 2017-02-25 22:37:12.000000000 -0600
++++ b/utils/hp2ps/ghc.mk 2017-02-25 23:21:33.000000000 -0600
+@@ -17,10 +17,21 @@
+ Utilities.c
+ utils/hp2ps_dist_EXTRA_LIBRARIES = m
+ utils/hp2ps_dist_PROGNAME = $(CrossCompilePrefix)hp2ps
+-utils/hp2ps_dist_INSTALL = YES
++utils/hp2ps_dist_INSTALL = NO
+ utils/hp2ps_dist_INSTALL_INPLACE = YES
+
+ utils/hp2ps_CC_OPTS += $(addprefix -I,$(GHC_INCLUDE_DIRS))
+
+ $(eval $(call build-prog,utils/hp2ps,dist,0))
+
++utils/hp2ps_dist-install_C_SRCS = AreaBelow.c Curves.c Error.c Main.c \
++ Reorder.c TopTwenty.c AuxFile.c Deviation.c \
++ HpFile.c Marks.c Scale.c TraceElement.c \
++ Axes.c Dimensions.c Key.c PsFile.c Shade.c \
++ Utilities.c
++utils/hp2ps_dist-install_PROGNAME = hp2ps
++utils/hp2ps_dist-install_TOPDIR = YES
++utils/hp2ps_dist-install_INSTALL = YES
++utils/hp2ps_dist-install_INSTALL_INPLACE = NO
++
++$(eval $(call build-prog,utils/hp2ps,dist-install,1))
diff --git a/testing/ghc-bootstrap/build-unlit-twice.patch b/testing/ghc-bootstrap/build-unlit-twice.patch
new file mode 100644
index 0000000000..91380a5c26
--- /dev/null
+++ b/testing/ghc-bootstrap/build-unlit-twice.patch
@@ -0,0 +1,58 @@
+From eba93774c3ce2f151e7c72f6d068b753f24dbcfa Mon Sep 17 00:00:00 2001
+From: Thomas Miedema <thomasmiedema@gmail.com>
+Date: Wed, 15 Jun 2016 14:56:46 +0200
+Subject: [PATCH] Build system: build unlit twice
+
+See Note [Why build certain utils twice?] in utils/ghc-pkg/ghc.mk
+---
+ utils/ghc-pkg/ghc.mk | 7 ++++++-
+ utils/unlit/ghc.mk | 10 +++++++++-
+ 2 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
+index f7d97de..410de72 100644
+--- a/utils/ghc-pkg/ghc.mk
++++ b/utils/ghc-pkg/ghc.mk
+@@ -27,7 +27,7 @@ utils/ghc-pkg_PACKAGE = ghc-pkg
+ # Note [Why build certain utils twice?]
+ #
+ # We build certain utils twice: once with stage0, and once with stage1.
+-# Examples are ghc-pkg and hsc2hs.
++# Examples are ghc-pkg, hsc2hs and unlit.
+ #
+ # These tools are needed during the bootstrapping process, so we have to use
+ # stage0 to build them at first (stage1 doesn't exist yet). (side note: they're
+@@ -38,6 +38,11 @@ utils/ghc-pkg_PACKAGE = ghc-pkg
+ # dynamically linked. But the stage0 copies are either statically linked, or
+ # linked against libraries on the build machine.
+ #
++# Another reason why we can't install the stage0 copies is that they are
++# built to run on the build(=host) platform, but when installing a
++# "cross-compiled stage2 compiler" we need copies that run on the target
++# platform.
++#
+ # Therefore we build fresh copies, using the stage1 compiler, and install them
+ # when you run 'make install'. They are not used for any other purpose.
+
+diff --git a/utils/unlit/ghc.mk b/utils/unlit/ghc.mk
+index e947989..6805c4e 100644
+--- a/utils/unlit/ghc.mk
++++ b/utils/unlit/ghc.mk
+@@ -13,8 +13,16 @@
+ utils/unlit_dist_C_SRCS = unlit.c
+ utils/unlit_dist_PROGNAME = unlit
+ utils/unlit_dist_TOPDIR = YES
+-utils/unlit_dist_INSTALL = YES
++utils/unlit_dist_INSTALL = NO
+ utils/unlit_dist_INSTALL_INPLACE = YES
+
+ $(eval $(call build-prog,utils/unlit,dist,0))
+
++utils/unlit_dist-install_C_SRCS = unlit.c
++utils/unlit_dist-install_PROGNAME = unlit
++utils/unlit_dist-install_TOPDIR = YES
++utils/unlit_dist-install_INSTALL = YES
++utils/unlit_dist-install_INSTALL_INPLACE = NO
++
++# See Note [Why build certain utils twice?].
++$(eval $(call build-prog,utils/unlit,dist-install,1))