aboutsummaryrefslogtreecommitdiffstats
path: root/testing/ghc-bootstrap/APKBUILD
blob: 85d2a8c27147441e404feb68baa3e8db026c1e3f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#-*-mode: Shell-script; coding: utf-8;-*-
# Maintainer: Mitch Tishmack <mitch.tishmack@gmail.com>
#
# 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
pkgrel=0
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
	"

# 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.
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
}

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
}

sha512sums="84404cd23677755e010e90c357e7eea940524531ae82bd70d215fda61fc63c1ef4c367b3fe7a938e8d8f415d8130ae98e77eee122450a80b41099b623fa99f9f  ghc-8.0.2-x86_64.tar.xz"