aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ghc-bootstrap
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-02-10 11:54:21 +0000
committerTimo Teräs <timo.teras@iki.fi>2017-02-10 11:54:21 +0000
commitc300e67286337679a0a3e732204fcedd5b41b424 (patch)
tree638d072fcd972566357c836cc376bcdc3e2a812f /testing/ghc-bootstrap
parent972f99471c324a5d221030691344ed1f8f892972 (diff)
downloadaports-c300e67286337679a0a3e732204fcedd5b41b424.tar.bz2
aports-c300e67286337679a0a3e732204fcedd5b41b424.tar.xz
Revert "testing/ghc-bootstrap: simplify/unify aport"
Diffstat (limited to 'testing/ghc-bootstrap')
-rw-r--r--testing/ghc-bootstrap/APKBUILD46
-rw-r--r--testing/ghc-bootstrap/bootstrap/armhf/Dockerfile (renamed from testing/ghc-bootstrap/Dockerfile.armhf)101
-rw-r--r--testing/ghc-bootstrap/bootstrap/armhf/bootstrap.patch (renamed from testing/ghc-bootstrap/bootstrap.patch)0
-rw-r--r--testing/ghc-bootstrap/bootstrap/armhf/settings32
-rw-r--r--testing/ghc-bootstrap/bootstrap/gmpurl.patch22
-rwxr-xr-xtesting/ghc-bootstrap/bootstrap/llvm-3.7.1.sh (renamed from testing/ghc-bootstrap/llvm-3.7.1.sh)0
-rw-r--r--testing/ghc-bootstrap/bootstrap/x86_64/Dockerfile (renamed from testing/ghc-bootstrap/Dockerfile.x86_64)68
-rw-r--r--testing/ghc-bootstrap/bootstrap/x86_64/bootstrap.patch112
-rw-r--r--testing/ghc-bootstrap/bootstrap/x86_64/settings32
-rw-r--r--testing/ghc-bootstrap/gmpurl.patch12
-rw-r--r--testing/ghc-bootstrap/rm-ghc-pwd.patch184
11 files changed, 306 insertions, 303 deletions
diff --git a/testing/ghc-bootstrap/APKBUILD b/testing/ghc-bootstrap/APKBUILD
index 7642dfb600..8578ae579b 100644
--- a/testing/ghc-bootstrap/APKBUILD
+++ b/testing/ghc-bootstrap/APKBUILD
@@ -3,24 +3,20 @@
#
# Build/bootstrap ghc similarly to the go package.
# Caveat: bootstrapping isn't a commonly tested piece of ghc.
-#
-# Note: This only exists to build the native ghc. It is
-# huge in size and slow and also intentionally lacks modules
-# in the native compiler.
pkgname=ghc-bootstrap
-pkgver=8.0.2
+pkgver=8.0.1
pkgrel=0
pkgdesc="The Glasgow haskell compiler (bootstrapped)"
arch="x86_64 armhf"
license="custom:bsd3"
-url="https://haskell.org"
+url='https://github.com/mitchty/alpine-linux-ghc-bootstrap'
depends="bash libffi musl zlib gcc binutils-gold llvm3.7"
install=""
subpackages=""
makedepends=""
source="
- http://dev.alpinelinux.org/archive/ghc-bootstrap/ghc-$pkgver-armhf.tar.xz
- http://dev.alpinelinux.org/archive/ghc-bootstrap/ghc-$pkgver-x86_64.tar.xz
+ http://dev.alpinelinux.org/archive/ghc-bootstrap/ghc-$pkgver-x86_64-unknown-linux-musl.tar.xz
+ http://dev.alpinelinux.org/archive/ghc-bootstrap/ghc-$pkgver-arm-unknown-linux-musleabihf.tar.xz
"
# The bootstrap process uses docker to build ghc from a debian glibc host
@@ -31,24 +27,30 @@ source="
# Note, these docker images are large, ~10G the dockerfiles weren't built
# to be small. Once built the containers 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
+ local x86_64_tar="ghc-${pkgver}-x86_64-pc-linux-musl.tar.xz"
+ local arm_tar="ghc-${pkgver}-arm-unknown-linux-musleabihf.tar.xz"
+
+ docker build -t alpine-ghc-bootstrap:x86_64 \
+ -f bootstrap/x86_64/Dockerfile .
+ docker run -a stdout alpine-ghc-bootstrap:x86_64 \
+ /bin/cat "/tmp/$x86_64_tar" > $x86_64_tar
+
+ docker build -t alpine-ghc-bootstrap:armhf \
+ -f bootstrap/armhf/Dockerfile .
+ docker run -a stdout alpine-ghc-bootstrap:armhf \
+ /bin/cat "/tmp/$arm_tar" > $arm_tar
}
package() {
cd "$srcdir/$CARCH"
install -d "$pkgdir" || return 1
mv usr "$pkgdir" || return 1
- local settings="$(find $pkgdir -name settings -type f)"
- sed -i 's/C compiler supports -no-pie\"\, \"NO\"/C compiler supports -no-pie\"\, \"YES\"/' "$settings" || return 1
- sed -i 's|/usr/.*-gcc|gcc|' "$settings" || return 1
- sed -i 's|/usr/.*-ar|ar|' "$settings" || return 1
- sed -i 's|/usr/.*-ld.gold|ld.gold|' "$settings" || return 1
- sed -i 's|/usr/.*-ld|ld.gold|' "$settings" || return 1
- sed -i 's|/usr/.*/llc|llc-3.7|' "$settings" || return 1
- sed -i 's|/usr/.*/opt|opt-3.7|' "$settings" || return 1
+ settings=$(find "$pkgdir" -name settings -type f)
}
+
+md5sums="ec34cc6bebe490f765bc73961fd72460 ghc-8.0.1-x86_64-unknown-linux-musl.tar.xz
+b0901df3305b49b6044607b5ccde5f03 ghc-8.0.1-arm-unknown-linux-musleabihf.tar.xz"
+sha256sums="b917c130597ed7a5dcf2d387c1b598b088f644566fc47f95d859a03a55529bd2 ghc-8.0.1-x86_64-unknown-linux-musl.tar.xz
+54d5e8067b087b1d426e01469162749f1f2c417dc2b8b0f6577acbf0c19aba5e ghc-8.0.1-arm-unknown-linux-musleabihf.tar.xz"
+sha512sums="4214ab4b3431c695b91429de6a7359cd607c4ca2d04e51afa111757da41b97912d46d3b4b251b717e175baf11186023c133af1ce1d5b95299bd34a85dd9f40b3 ghc-8.0.1-x86_64-unknown-linux-musl.tar.xz
+ab920e198a2c779e8ad3f6e3f9e9485c8742254c5a914875a6cd106957bb6e0720e90707aabe822295535922d55fc66898660bf7cbf8a7c88c231eceafe358e4 ghc-8.0.1-arm-unknown-linux-musleabihf.tar.xz"
diff --git a/testing/ghc-bootstrap/Dockerfile.armhf b/testing/ghc-bootstrap/bootstrap/armhf/Dockerfile
index 9111bb72e3..2ef2572f89 100644
--- a/testing/ghc-bootstrap/Dockerfile.armhf
+++ b/testing/ghc-bootstrap/bootstrap/armhf/Dockerfile
@@ -2,20 +2,10 @@
from debian:8.0
# Install stock bindist for cross compile
-env ghc 8.0.2
+env ghc 7.10.3
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
+env cabal 1.22.9.0
# all needed packages for compiling
run apt-get clean && \
@@ -41,8 +31,8 @@ run apt-get clean && \
pixz \
openssl \
bison \
- git \
- flex
+ flex \
+ git
add http://llvm.org/releases/$llvm/llvm-$llvm.src.tar.xz /tmp/
add http://llvm.org/releases/$llvm/polly-$llvm.src.tar.xz /tmp/
@@ -52,32 +42,32 @@ add http://llvm.org/releases/$llvm/polly-$llvm.src.tar.xz /tmp/
# "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
+copy bootstrap/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
+ rm -fr /tmp/llvm-$llvm.src
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" && \
+run openssl sha1 ghc-$ghc-$arch-deb8-linux.tar.xz | grep "SHA1(ghc-7.10.3-x86_64-deb8-linux.tar.xz)= bab16f95ef4fe6b7cc2fb6b36a02dceeeb53faa4" && \
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
+add https://www.haskell.org/cabal/release/cabal-install-$cabal/cabal-install-$cabal.tar.gz /tmp/
# 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" && \
+run openssl sha1 cabal-install-$cabal.tar.gz | grep "SHA1(cabal-install-1.22.9.0.tar.gz)= f1375c928794f45f253b8ec92c2af4732fec597b" && \
tar xzpf /tmp/cabal-install-$cabal.tar.gz
workdir /tmp/cabal-install-$cabal
run ./bootstrap.sh --global --no-doc && \
@@ -85,12 +75,15 @@ run ./bootstrap.sh --global --no-doc && \
cabal install --global alex happy && \
rm -fr /tmp/cabal-install-$cabal
+# First up, install/compile the cross compiler with musl libc
+# armv7 hard float cross compiler, we basically rebuild ghc again here with
+# the cross compiler, and the llvm we built for x86_64 as well
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 TRIPLE=arm-linux-musleabihf >> 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 && \
@@ -100,40 +93,48 @@ run echo GCC_BUILTIN_PREREQS=yes >> 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
+copy bootstrap/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/
+add http://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-src.tar.xz /tmp/
+
+env tardir /tmp/root
+env destdir /tmp/root/armhf
+env crosscc arm-linux-musleabihf-gcc
+env target arm-linux-musleabihf
+env triple arm-unknown-linux-musleabihf
+env ghc 8.0.1
+
+# add cross toolchain to PATH
+env PATH /usr/$target/bin:$PATH
workdir /tmp
-run openssl sha1 ghc-$ghc-src.tar.xz | grep "SHA1(ghc-$ghc-src.tar.xz)= 0e0ae6d5ba119c10f3c7b807d35166e7c06b9b35" && \
+run openssl sha1 ghc-$ghc-src.tar.xz | grep "SHA1(ghc-8.0.1-src.tar.xz)= 585a2d34a17ce2452273147f2e3cef1a2efe1aa5" && \
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 {} \;
+env PATH $PATH:/usr/$triple/bin
+copy bootstrap/$arch/bootstrap.patch bootstrap.patch
+run patch -p1 < bootstrap.patch
+run cp mk/build.mk.sample mk/build.mk && \
+ ./boot && \
+ echo "BuildFlavour = quick-llvm" >> 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 && \
+ ./configure \
+ --target=$target \
+ --prefix=/usr
+run make -j$(grep -c processor /proc/cpuinfo) || make -j1
+run make -j1 install STRIP_CMD=$target-strip DESTDIR=$destdir
+
+# unlit and hp2ps both build using the stage0, not having luck
+# getting the build patched right so for now lets just
+# remove and rebuild these c helper programs
+run rm $(find $destdir -name "*-hp2ps")
# remove target prefix from stage2 binaries
# HACK, just build unlit with the cross compiler and move it to /usr/bin in the install dir
@@ -142,10 +143,12 @@ 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
+run (for i in $triple-* ; do ln -s $i ${i#$triple-} || /bin/true ; done )
+copy bootstrap/armhf/settings /tmp/settings
+run mv /tmp/settings $(find $destdir -name settings -type f)
+run 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 .
+run tar -I'pixz -9' -cf /tmp/ghc-$ghc-$triple.tar.xz .
diff --git a/testing/ghc-bootstrap/bootstrap.patch b/testing/ghc-bootstrap/bootstrap/armhf/bootstrap.patch
index 7e5fc95432..7e5fc95432 100644
--- a/testing/ghc-bootstrap/bootstrap.patch
+++ b/testing/ghc-bootstrap/bootstrap/armhf/bootstrap.patch
diff --git a/testing/ghc-bootstrap/bootstrap/armhf/settings b/testing/ghc-bootstrap/bootstrap/armhf/settings
new file mode 100644
index 0000000000..549d03dd64
--- /dev/null
+++ b/testing/ghc-bootstrap/bootstrap/armhf/settings
@@ -0,0 +1,32 @@
+[("GCC extra via C opts", " -fwrapv -fno-builtin"),
+ ("C compiler command", "gcc"),
+ ("C compiler flags", " -marm -fno-stack-protector"),
+ ("C compiler link flags", " --no-pie -fuse-ld=gold -Wl,-z,noexecstack"),
+ ("Haskell CPP command","gcc"),
+ ("Haskell CPP flags","-E -undef -traditional"),
+ ("ld command", "ld.gold"),
+ ("ld flags", " -z noexecstack"),
+ ("ld supports compact unwind", "YES"),
+ ("ld supports build-id", "YES"),
+ ("ld supports filelist", "NO"),
+ ("ld is GNU ld", "YES"),
+ ("ar command", "ar"),
+ ("ar flags", "q"),
+ ("ar supports at file", "YES"),
+ ("touch command", "touch"),
+ ("dllwrap command", "/bin/false"),
+ ("windres command", "/bin/false"),
+ ("libtool command", "libtool"),
+ ("perl command", "/usr/bin/perl"),
+ ("cross compiling", "YES"),
+ ("target os", "OSLinux"),
+ ("target arch", "ArchARM {armISA = ARMv6, armISAExt = [VFPv2], armABI = HARD}"),
+ ("target word size", "4"),
+ ("target has GNU nonexec stack", "False"),
+ ("target has .ident directive", "True"),
+ ("target has subsections via symbols", "False"),
+ ("Unregisterised", "NO"),
+ ("LLVM llc command", "llc-3.7"),
+ ("LLVM opt command", "opt-3.7")
+ ]
+
diff --git a/testing/ghc-bootstrap/bootstrap/gmpurl.patch b/testing/ghc-bootstrap/bootstrap/gmpurl.patch
new file mode 100644
index 0000000000..c919fa3946
--- /dev/null
+++ b/testing/ghc-bootstrap/bootstrap/gmpurl.patch
@@ -0,0 +1,22 @@
+diff -r d72695b410e3 defs.sh
+--- a/defs.sh Sun Jul 26 15:38:58 2015 -0400
++++ b/defs.sh Sun Jan 31 23:18:18 2016 +0000
+@@ -221,7 +221,7 @@
+ gccprereqs() {
+ if [ ! -e gcc-$GCC_VERSION/gmp ]
+ then
+- fetchextract http://gmplib.org/download/gmp/ gmp-$GMP_VERSION .tar.bz2
++ fetchextract http://gmplib.org/download/gmp/archive/ gmp-$GMP_VERSION .tar.bz2
+ mv gmp-$GMP_VERSION gcc-$GCC_VERSION/gmp
+ fi
+
+--- a/extra/build-gcc-deps.sh Sun Jul 26 15:38:58 2015 -0400
++++ b/extra/build-gcc-deps.sh Sun Jan 31 23:18:18 2016 +0000
+@@ -28,7 +28,7 @@
+ PREFIX="$CC_PREFIX/$TRIPLE"
+
+ # GMP
+-fetchextract ftp://ftp.gmplib.org/pub/gmp-$GMP_VERSION/ gmp-$GMP_VERSION .tar.bz2
++fetchextract ftp://ftp.gmplib.org/pub/archive/gmp-$GMP_VERSION/ gmp-$GMP_VERSION .tar.bz2
+ cp -f "$MUSL_CC_BASE/extra/config.sub" gmp-$GMP_VERSION/configfsf.sub
+ buildinstall '' gmp-$GMP_VERSION --host="$TRIPLE" --enable-static --disable-shared
diff --git a/testing/ghc-bootstrap/llvm-3.7.1.sh b/testing/ghc-bootstrap/bootstrap/llvm-3.7.1.sh
index 49e44dfc20..49e44dfc20 100755
--- a/testing/ghc-bootstrap/llvm-3.7.1.sh
+++ b/testing/ghc-bootstrap/bootstrap/llvm-3.7.1.sh
diff --git a/testing/ghc-bootstrap/Dockerfile.x86_64 b/testing/ghc-bootstrap/bootstrap/x86_64/Dockerfile
index b18ef92b47..9ca75c60ac 100644
--- a/testing/ghc-bootstrap/Dockerfile.x86_64
+++ b/testing/ghc-bootstrap/bootstrap/x86_64/Dockerfile
@@ -2,20 +2,10 @@
from debian:8.0
# Install stock bindist for cross compile
-env ghc 8.0.2
+env ghc 7.10.3
env arch x86_64
env llvm 3.7.1
-env cabal 1.24.0.2
-
-env destarch x86_64
-env tardir /tmp/root
-env destdir /tmp/root/$destarch
-env triple ${arch}-pc-linux-musl
-env target ${arch}-pc-linux-musl
-env crosscc $triple-gcc
-
-# add cross toolchain to PATH
-env PATH /usr/$triple/bin:$PATH
+env cabal 1.22.9.0
# all needed packages for compiling
run apt-get clean && \
@@ -40,8 +30,8 @@ run apt-get clean && \
python \
pixz \
openssl \
- bison \
git \
+ bison \
flex
add http://llvm.org/releases/$llvm/llvm-$llvm.src.tar.xz /tmp/
@@ -52,7 +42,7 @@ add http://llvm.org/releases/$llvm/polly-$llvm.src.tar.xz /tmp/
# "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
+copy bootstrap/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 && \
@@ -64,20 +54,20 @@ add https://downloads.haskell.org/~ghc/$ghc/ghc-$ghc-$arch-deb8-linux.tar.xz /tm
# 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" && \
+run openssl sha1 ghc-$ghc-$arch-deb8-linux.tar.xz | grep "SHA1(ghc-7.10.3-x86_64-deb8-linux.tar.xz)= bab16f95ef4fe6b7cc2fb6b36a02dceeeb53faa4" && \
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
+add https://www.haskell.org/cabal/release/cabal-install-$cabal/cabal-install-$cabal.tar.gz /tmp/
# 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" && \
+run openssl sha1 cabal-install-$cabal.tar.gz | grep "SHA1(cabal-install-1.22.9.0.tar.gz)= f1375c928794f45f253b8ec92c2af4732fec597b" && \
tar xzpf /tmp/cabal-install-$cabal.tar.gz
workdir /tmp/cabal-install-$cabal
run ./bootstrap.sh --global --no-doc && \
@@ -85,51 +75,55 @@ run ./bootstrap.sh --global --no-doc && \
cabal install --global alex happy && \
rm -fr /tmp/cabal-install-$cabal
+# Build our cross compiler with musl libc from the sabotage linux stuff
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=${destarch} >> config.sh && \
+ echo ARCH=x86_64 >> config.sh && \
+ echo TRIPLE=x86_64-pc-linux-musl >> 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 -O3 -fno-pie -fno-pic'" >> config.sh
-copy gmpurl.patch gmpurl.patch
+ echo "CFLAGS='-g -O2 -fPIC -DPIC'" >> config.sh && \
+ echo "CPPFLAGS='-fPIC -DPIC'" >> config.sh && \
+ echo "LDFLAGS='-fPIC -DPIC'" >> config.sh
+copy bootstrap/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/
+add http://downloads.haskell.org/~ghc/8.0.1/ghc-8.0.1-src.tar.xz /tmp/
+
+env tardir /tmp/root
+env destdir /tmp/root/x86_64
+env triple x86_64-pc-linux-musl
+env crosscc $triple-gcc
+env ghc 8.0.1
workdir /tmp
-run openssl sha1 ghc-$ghc-src.tar.xz | grep "SHA1(ghc-$ghc-src.tar.xz)= 0e0ae6d5ba119c10f3c7b807d35166e7c06b9b35" && \
+run openssl sha1 ghc-$ghc-src.tar.xz | grep "SHA1(ghc-8.0.1-src.tar.xz)= 585a2d34a17ce2452273147f2e3cef1a2efe1aa5" && \
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
+env PATH $PATH:/usr/$triple/bin
+copy bootstrap/$arch/bootstrap.patch bootstrap.patch
+run patch -p1 < bootstrap.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 "BuildFlavour = quick-llvm" >> 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 {} \;
+run rm $(find $destdir -name "*-hp2ps")
# remove target prefix from stage2 binaries
# HACK, just build unlit with the cross compiler and move it to /usr/bin in the install dir
@@ -138,10 +132,12 @@ 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
+run (for i in $triple-* ; do ln -s $i ${i#$triple-} ; done )
+copy bootstrap/$arch/settings /tmp/settings
+run mv /tmp/settings $(find $destdir -name settings -type f)
+run 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 .
+run tar -I'pixz -9' -cf /tmp/ghc-$ghc-$triple.tar.xz .
diff --git a/testing/ghc-bootstrap/bootstrap/x86_64/bootstrap.patch b/testing/ghc-bootstrap/bootstrap/x86_64/bootstrap.patch
new file mode 100644
index 0000000000..7e5fc95432
--- /dev/null
+++ b/testing/ghc-bootstrap/bootstrap/x86_64/bootstrap.patch
@@ -0,0 +1,112 @@
+diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
+index fa1141e..6ff2ac4 100644
+--- a/compiler/main/DynFlags.hs
++++ b/compiler/main/DynFlags.hs
+@@ -2448,8 +2448,7 @@ dynamic_flags_deps = [
+ , make_ord_flag defGhcFlag "dynload" (hasArg parseDynLibLoaderMode)
+ , make_ord_flag defGhcFlag "dylib-install-name" (hasArg setDylibInstallName)
+ -- -dll-split is an internal flag, used only during the GHC build
+- , make_ord_flag defHiddenFlag "dll-split"
+- (hasArg (\f d -> d { dllSplitFile = Just f, dllSplit = Nothing }))
++ , make_ord_flag defHiddenFlag "dll-split" (NoArg (addWarn "ignoring -dll-split"))
+
+ ------- Libraries ---------------------------------------------------
+ , make_ord_flag defFlag "L" (Prefix addLibraryPath)
+diff --git a/ghc.mk b/ghc.mk
+index 5e4ecc6..a07ff73 100644
+--- a/ghc.mk
++++ b/ghc.mk
+@@ -433,7 +433,7 @@ else # CLEANING
+ PACKAGES_STAGE0 = binary Cabal/Cabal hpc ghc-boot hoopl transformers template-haskell
+ ifeq "$(Windows_Host)" "NO"
+ ifneq "$(HostOS_CPP)" "ios"
+-PACKAGES_STAGE0 += terminfo
++PACKAGES_STAGE0 +=
+ endif
+ endif
+
+@@ -471,7 +471,7 @@ endif
+
+ ifeq "$(Windows_Target)" "NO"
+ ifneq "$(TargetOS_CPP)" "ios"
+-PACKAGES_STAGE1 += terminfo
++PACKAGES_STAGE1 +=
+ endif
+ endif
+ PACKAGES_STAGE1 += haskeline
+@@ -968,8 +968,8 @@ INSTALLED_PACKAGE_CONF=$(DESTDIR)$(topdir)/package.conf.d
+ # Install packages in the right order, so that ghc-pkg doesn't complain.
+ # Also, install ghc-pkg first.
+ ifeq "$(Windows_Host)" "NO"
+-INSTALLED_GHC_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc
+-INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(ghclibexecdir)/bin/ghc-pkg
++INSTALLED_GHC_REAL=$(CURDIR)/inplace/bin/ghc-stage1
++INSTALLED_GHC_PKG_REAL=$(CURDIR)/utils/ghc-pkg/dist/build/tmp/ghc-pkg
+ else
+ INSTALLED_GHC_REAL=$(DESTDIR)$(bindir)/ghc.exe
+ INSTALLED_GHC_PKG_REAL=$(DESTDIR)$(bindir)/ghc-pkg.exe
+diff --git a/rules/build-package-way.mk b/rules/build-package-way.mk
+index 905b7f0..3e23b1f 100644
+--- a/rules/build-package-way.mk
++++ b/rules/build-package-way.mk
+@@ -62,17 +62,6 @@ $1_$2_$3_ALL_OBJS = $$($1_$2_$3_HS_OBJS) $$($1_$2_$3_NON_HS_OBJS)
+
+ ifeq "$3" "dyn"
+
+-ifneq "$$($1_$2_dll0_MODULES)" ""
+-$$($1_$2_$3_LIB) : $1/$2/dll-split.stamp
+-ifneq "$$($1_$2_$3_LIB0)" ""
+-$$($1_$2_$3_LIB0) : $1/$2/dll-split.stamp
+-endif
+-endif
+-
+-$1/$2/dll-split.stamp: $$($1_$2_depfile_haskell) $$$$(dll-split_INPLACE)
+- $$(dll-split_INPLACE) $$< "$$($1_$2_dll0_START_MODULE)" "$$($1_$2_dll0_MODULES)"
+- touch $$@
+-
+ # Link a dynamic library
+ # On windows we have to supply the extra libs this one links to when building it.
+ ifeq "$$(HostOS_CPP)" "mingw32"
+diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
+index f099d4e..6dcf911 100644
+--- a/rules/distdir-way-opts.mk
++++ b/rules/distdir-way-opts.mk
+@@ -160,13 +160,6 @@ $1_$2_$3_ALL_HC_OPTS = \
+ $$(if $$(findstring YES,$$($1_$2_SplitSections)),$$(if $$(findstring dyn,$3),,-split-sections),) \
+ $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),$$(if $$(findstring v,$3),-dynamic-too))
+
+-ifeq "$3" "dyn"
+-ifeq "$$(HostOS_CPP)" "mingw32"
+-ifneq "$$($1_$2_dll0_MODULES)" ""
+-$1_$2_$3_ALL_HC_OPTS += -dll-split $1/$2/dll-split
+-endif
+-endif
+-endif
+
+ $1_$2_$3_ALL_CC_OPTS = \
+ $$(WAY_$3_CC_OPTS) \
+diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
+index af3032d..1c38e8e 100644
+--- a/utils/ghc-pkg/Main.hs
++++ b/utils/ghc-pkg/Main.hs
+@@ -1,5 +1,6 @@
+ {-# LANGUAGE CPP, TypeSynonymInstances, FlexibleInstances #-}
+ {-# OPTIONS_GHC -fno-warn-orphans #-}
++#define BOOTSTRAPPING
+ -----------------------------------------------------------------------------
+ --
+ -- (c) The University of Glasgow 2004-2009.
+diff --git a/utils/ghc-pkg/ghc-pkg.cabal b/utils/ghc-pkg/ghc-pkg.cabal
+index 5f76e1b..2f9b558 100644
+--- a/utils/ghc-pkg/ghc-pkg.cabal
++++ b/utils/ghc-pkg/ghc-pkg.cabal
+@@ -31,7 +31,7 @@ Executable ghc-pkg
+ ghc-boot,
+ bytestring
+ if !os(windows)
+- Build-Depends: unix,
+- terminfo
++ Build-Depends: unix
++
+ if os(windows)
+ c-sources: CRT_noglob.c
diff --git a/testing/ghc-bootstrap/bootstrap/x86_64/settings b/testing/ghc-bootstrap/bootstrap/x86_64/settings
new file mode 100644
index 0000000000..bd33b80f23
--- /dev/null
+++ b/testing/ghc-bootstrap/bootstrap/x86_64/settings
@@ -0,0 +1,32 @@
+[("GCC extra via C opts", " -fwrapv -fno-builtin"),
+ ("C compiler command", "gcc"),
+ ("C compiler flags", " -fno-stack-protector"),
+ ("C compiler link flags", "--no-pie"),
+ ("Haskell CPP command","gcc"),
+ ("Haskell CPP flags","-E -undef -traditional "),
+ ("ld command", "ld.gold"),
+ ("ld flags", ""),
+ ("ld supports compact unwind", "YES"),
+ ("ld supports build-id", "YES"),
+ ("ld supports filelist", "NO"),
+ ("ld is GNU ld", "YES"),
+ ("ar command", "ar"),
+ ("ar flags", "q"),
+ ("ar supports at file", "YES"),
+ ("touch command", "touch"),
+ ("dllwrap command", "/bin/false"),
+ ("windres command", "/bin/false"),
+ ("libtool command", "libtool"),
+ ("readelf command", "readelf"),
+ ("perl command", "perl"),
+ ("cross compiling", "YES"),
+ ("target os", "OSLinux"),
+ ("target arch", "ArchX86_64"),
+ ("target word size", "8"),
+ ("target has GNU nonexec stack", "True"),
+ ("target has .ident directive", "True"),
+ ("target has subsections via symbols", "False"),
+ ("Unregisterised", "NO"),
+ ("LLVM llc command", "llc-3.7"),
+ ("LLVM opt command", "opt-3.7")
+ ]
diff --git a/testing/ghc-bootstrap/gmpurl.patch b/testing/ghc-bootstrap/gmpurl.patch
deleted file mode 100644
index 3f8b4e5ccc..0000000000
--- a/testing/ghc-bootstrap/gmpurl.patch
+++ /dev/null
@@ -1,12 +0,0 @@
-diff -r d72695b410e3 defs.sh
---- a/defs.sh Sun Jul 26 15:38:58 2015 -0400
-+++ b/defs.sh Sun Jan 31 23:18:18 2016 +0000
-@@ -221,7 +221,7 @@
- gccprereqs() {
- if [ ! -e gcc-$GCC_VERSION/gmp ]
- then
-- fetchextract http://gmplib.org/download/gmp/archive/ gmp-$GMP_VERSION .tar.bz2
-+ fetchextract http://gmplib.org/download/gmp/ gmp-$GMP_VERSION .tar.bz2
- mv gmp-$GMP_VERSION gcc-$GCC_VERSION/gmp
- fi
-
diff --git a/testing/ghc-bootstrap/rm-ghc-pwd.patch b/testing/ghc-bootstrap/rm-ghc-pwd.patch
deleted file mode 100644
index cf4417547b..0000000000
--- a/testing/ghc-bootstrap/rm-ghc-pwd.patch
+++ /dev/null
@@ -1,184 +0,0 @@
-commit 4c56ad36ee0d1f8b6f1b2bc0d8fff1c9acd1a389
-Author: Thomas Miedema <thomasmiedema@gmail.com>
-Date: Mon Jan 4 18:29:49 2016 +0100
-
- Build system: delete ghc-pwd
-
- On Windows, with msys2, `pwd` works (as can be seen by the use of `pwd`
- that slipped into the validate script), so there is really no need for
- `ghc-pwd` anymore.
-
- Test Plan: try it
-
- Reviewers: austin, bgamari, Phyx
-
- Reviewed By: Phyx
-
- Subscribers: Phyx, erikd
-
- Differential Revision: https://phabricator.haskell.org/D1731
-
-diff --git a/aclocal.m4 b/aclocal.m4
-index 8e97726..0c93de4 100644
---- a/aclocal.m4
-+++ b/aclocal.m4
-@@ -1737,33 +1737,9 @@ AC_DEFUN([FP_CURSES],
- # Calculate absolute path to build tree
- # --------------------------------------------------------------
-
--AC_DEFUN([FP_INTREE_GHC_PWD],[
--AC_MSG_NOTICE(Building in-tree ghc-pwd)
-- dnl This would be
-- dnl make -C utils/ghc-pwd clean && make -C utils/ghc-pwd
-- dnl except we don't want to have to know what make is called. Sigh.
-- rm -rf utils/ghc-pwd/dist-boot
-- mkdir utils/ghc-pwd/dist-boot
-- dnl If special linker flags are needed to build things, then allow
-- dnl the user to pass them in via LDFLAGS.
-- changequote(, )dnl
-- GHC_LDFLAGS=`perl -e 'foreach (@ARGV) { print "-optl$_ " }' -- $LDFLAGS`
-- changequote([, ])dnl
-- if ! "$WithGhc" $GHC_LDFLAGS -v0 -no-user-$GHC_PACKAGE_DB_FLAG -hidir utils/ghc-pwd/dist-boot -odir utils/ghc-pwd/dist-boot -stubdir utils/ghc-pwd/dist-boot --make utils/ghc-pwd/Main.hs -o utils/ghc-pwd/dist-boot/ghc-pwd
-- then
-- AC_MSG_ERROR([Building ghc-pwd failed])
-- fi
--
-- GHC_PWD=utils/ghc-pwd/dist-boot/ghc-pwd
--])
--
--AC_DEFUN([FP_BINDIST_GHC_PWD],[
-- GHC_PWD=utils/ghc-pwd/dist-install/build/tmp/ghc-pwd-bindist
--])
--
- AC_DEFUN([FP_FIND_ROOT],[
- AC_MSG_CHECKING(for path to top of build tree)
-- hardtop=`$GHC_PWD`
-+ hardtop=`pwd`
-
- dnl Remove common automounter nonsense
- hardtop=`echo $hardtop | sed 's|^/tmp_mnt.*\(/local/.*\)$|\1|' | sed 's|^/tmp_mnt/|/|'`
-diff --git a/configure.ac b/configure.ac
-index 042b417..ab82bb0 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -26,6 +26,8 @@ AC_INIT([The Glorious Glasgow Haskell Compilation System], [8.1], [glasgow-haske
- # checkout), then we ship a file 'VERSION' containing the full version
- # when the source distribution was created.
-
-+FP_FIND_ROOT
-+
- if test ! -f mk/config.h.in; then
- echo "mk/config.h.in doesn't exist: perhaps you haven't run 'perl boot'?"
- exit 1
-@@ -258,10 +260,6 @@ AC_ARG_WITH(hc,
- )
- AC_SUBST(WithHc)
-
--# This uses GHC, so put it after the "GHC is required" check above:
--FP_INTREE_GHC_PWD
--FP_FIND_ROOT
--
- fail() {
- echo >&2
- echo "$1" >&2
-diff --git a/distrib/configure.ac.in b/distrib/configure.ac.in
-index 0f68a52..4d57cd8 100644
---- a/distrib/configure.ac.in
-+++ b/distrib/configure.ac.in
-@@ -6,7 +6,6 @@ dnl
-
- AC_INIT([The Glorious Glasgow Haskell Compilation System], [@ProjectVersion@], [glasgow-haskell-bugs@haskell.org], [ghc])
-
--FP_BINDIST_GHC_PWD
- FP_FIND_ROOT
-
- dnl--------------------------------------------------------------------
-diff --git a/ghc.mk b/ghc.mk
-index ba708a1..3ccc496 100644
---- a/ghc.mk
-+++ b/ghc.mk
-@@ -516,7 +516,6 @@ $(foreach pkg,$(PACKAGES_STAGE1),$(eval $(call fixed_pkg_dep,$(pkg),dist-install
- # the stage1 packages, so we have to make sure those packages get configured
- # and registered before we can start with these. Note that they don't depend on
- # eachother, so we can configure them in parallel.
--utils/ghc-pwd/dist-install/package-data.mk: $(fixed_pkg_prev)
- utils/ghc-cabal/dist-install/package-data.mk: $(fixed_pkg_prev)
- utils/hpc/dist-install/package-data.mk: $(fixed_pkg_prev)
- utils/ghc-pkg/dist-install/package-data.mk: $(fixed_pkg_prev)
-@@ -660,7 +659,6 @@ BUILD_DIRS += utils/testremove
- BUILD_DIRS += utils/ghctags
- BUILD_DIRS += utils/check-api-annotations
- BUILD_DIRS += utils/dll-split
--BUILD_DIRS += utils/ghc-pwd
- BUILD_DIRS += utils/ghc-cabal
- BUILD_DIRS += utils/hpc
- BUILD_DIRS += utils/runghc
-@@ -1020,7 +1018,6 @@ $(eval $(call bindist-list,.,\
- mk/config.mk.in \
- $(INPLACE_BIN)/mkdirhier \
- utils/ghc-cabal/dist-install/build/tmp/ghc-cabal \
-- utils/ghc-pwd/dist-install/build/tmp/ghc-pwd \
- $(BINDIST_WRAPPERS) \
- $(BINDIST_PERL_SOURCES) \
- $(BINDIST_LIBS) \
-@@ -1366,9 +1363,6 @@ distclean : clean
- # Internal files generated by ./configure for itself.
- $(call removeFiles,config.cache config.status config.log)
-
--# ./configure build ghc-pwd in utils/ghc-pwd/dist-boot, so clean it up.
-- $(call removeTrees,utils/ghc-pwd/dist-boot)
--
- # The root Makefile makes .old versions of some files that configure
- # generates, so we clean those too.
- $(call removeFiles,mk/config.mk.old)
-diff --git a/utils/ghc-pwd/Main.hs b/utils/ghc-pwd/Main.hs
-deleted file mode 100644
-index 91a5606..0000000
---- a/utils/ghc-pwd/Main.hs
-+++ /dev/null
-@@ -1,22 +0,0 @@
--
--module Main where
--
--import System.Directory
--import System.Environment
--import System.Exit
--import System.IO
--
--main :: IO ()
--main = do
-- args <- getArgs
-- case args of
-- [] -> do d <- getCurrentDirectory
-- putStr $ map forwardifySlashes d
-- _ -> do hPutStrLn stderr ("Bad args: " ++ show args)
-- hPutStrLn stderr "Usage: ghc-pwd"
-- exitFailure
--
--forwardifySlashes :: Char -> Char
--forwardifySlashes '\\' = '/'
--forwardifySlashes c = c
--
-diff --git a/utils/ghc-pwd/Setup.hs b/utils/ghc-pwd/Setup.hs
-deleted file mode 100644
-index 9a994af..0000000
---- a/utils/ghc-pwd/Setup.hs
-+++ /dev/null
-@@ -1,2 +0,0 @@
--import Distribution.Simple
--main = defaultMain
-diff --git a/utils/ghc-pwd/ghc.mk b/utils/ghc-pwd/ghc.mk
-deleted file mode 100644
-index ac6bc76..0000000
---- a/utils/ghc-pwd/ghc.mk
-+++ /dev/null
-@@ -1,9 +0,0 @@
--
--utils/ghc-pwd_USES_CABAL = YES
--utils/ghc-pwd_PACKAGE = ghc-pwd
--utils/ghc-pwd_dist-install_INSTALL_INPLACE = YES
--utils/ghc-pwd_dist-install_WANT_BINDIST_WRAPPER = YES
--utils/ghc-pwd_dist-install_PROGNAME = ghc-pwd
--
--$(eval $(call build-prog,utils/ghc-pwd,dist-install,1))
--