diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-10 23:52:24 +0200 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2017-04-11 00:05:02 +0200 |
commit | ad037349e2b0b41a60917cf5bbbdbd642ab4752b (patch) | |
tree | db5cc90f2fb8861fff841ec5890c2c28a96601f5 /testing/ghc | |
parent | 1bc6e9463b5fffb5ec6d0a49e74b683f799ace95 (diff) | |
download | aports-ad037349e2b0b41a60917cf5bbbdbd642ab4752b.tar.bz2 aports-ad037349e2b0b41a60917cf5bbbdbd642ab4752b.tar.xz |
testing/ghc: improve and fix abuild
Diffstat (limited to 'testing/ghc')
-rw-r--r-- | testing/ghc/APKBUILD | 108 | ||||
-rw-r--r--[-rwxr-xr-x] | testing/ghc/ghc.post-install | 0 |
2 files changed, 63 insertions, 45 deletions
diff --git a/testing/ghc/APKBUILD b/testing/ghc/APKBUILD index 36f2676dc7..79885f481f 100644 --- a/testing/ghc/APKBUILD +++ b/testing/ghc/APKBUILD @@ -2,14 +2,14 @@ # Maintainer: Mitch Tishmack <mitch.tishmack@gmail.com> pkgname=ghc pkgver=8.0.2 -pkgrel=4 +pkgrel=5 pkgdesc="The Glasgow Haskell Compiler" url="http://haskell.org" arch="x86_64 armhf" # Note ghc's license is basically BSD-3. If you'd like to know more visit: # * https://www.haskell.org/ghc/license # * https://ghc.haskell.org/trac/ghc/wiki/Licensing -license="custom:bsd3" +license="custom:BSD-3" # Note, gcc supports --no-pie on alpine linux 3.5+ only. We test for # that version as it greatly simplifies the apkbuild process. The # apks built on 3.5 will not work on any prior version of Alpine Linux. @@ -52,8 +52,9 @@ provides="ghc-bootstrap=$pkgver-r$pkgrel " subpackages="$pkgname-doc $pkgname-dev" install="$pkgname.post-install" -source="http://downloads.haskell.org/~ghc/${pkgver}/ghc-${pkgver}-src.tar.xz - http://downloads.haskell.org/~ghc/${pkgver}/ghc-${pkgver}-testsuite.tar.xz +options="!strip" # we strip it manually in build() +source="http://downloads.haskell.org/~ghc/$pkgver/ghc-$pkgver-src.tar.xz + http://downloads.haskell.org/~ghc/$pkgver/ghc-$pkgver-testsuite.tar.xz 0000-alpine.patch 0000-bootstrap.patch 0001-rm-ghc-pwd.patch @@ -68,8 +69,10 @@ source="http://downloads.haskell.org/~ghc/${pkgver}/ghc-${pkgver}-src.tar.xz builddir="$srcdir/$pkgname-$pkgver" prepare() { - default_prepare || return 1 - cp mk/build.mk.sample mk/build.mk || return 1 + default_prepare + + cp mk/build.mk.sample mk/build.mk + cat >> mk/build.mk <<-EOF BuildFlavour = perf-llvm INTEGER_LIBRARY = integer-gmp @@ -90,13 +93,14 @@ prepare() { fi # Due to patches to the configure script - autoreconf || return 1 + autoreconf } build() { cd "$builddir" - local _ffi_inc=$(pkg-config libffi --cflags-only-I); _ffi_inc="${_ffi_inc%% }" - local _ffi_lib=$(pkg-config libffi --libs-only-L); _ffi_lib="${_ffi_lib%% }" + + local ffi_inc=$(pkg-config libffi --cflags-only-I); ffi_inc="${ffi_inc%% }" + local ffi_lib=$(pkg-config libffi --libs-only-L); ffi_lib="${ffi_lib%% }" # NOTE: ghc build system requires host == build, and it ends up # compiling the cross-compiler (stage1) and cross-compiling with @@ -107,71 +111,85 @@ build() { --target=$CTARGET \ --prefix=/usr \ --with-system-libffi \ - ${_ffi_inc:+--with-ffi-includes="${_ffi_inc#-I}"} \ - ${_ffi_lib:+--with-ffi-libraries="${_ffi_lib#-L}"} \ + ${ffi_inc:+--with-ffi-includes="${ffi_inc#-I}"} \ + ${ffi_lib:+--with-ffi-libraries="${ffi_lib#-L}"} \ --with-ar=${CROSS_COMPILE}ar \ --with-nm=${CROSS_COMPILE}nm \ --with-ranlib=${CROSS_COMPILE}ranlib \ --with-objdump=${CROSS_COMPILE}objdump \ --with-ld=${CROSS_COMPILE}ld.gold \ - --with-ld.gold=${CROSS_COMPILE}ld.gold \ - || return 1 - make || return 1 + --with-ld.gold=${CROSS_COMPILE}ld.gold + make } check() { cd "$builddir/testsuite" - make fast THREADS=$JOBS || return 1 + make fast THREADS=$JOBS } doc() { default_doc - install -Dm644 "$builddir/LICENSE" "$subpkgdir/usr/share/licenses/$subpkgname/LICENSE" || return 1 + install -Dm644 "$builddir/LICENSE" \ + "$subpkgdir/usr/share/licenses/$subpkgname/LICENSE" } package() { + local ghclib="usr/lib/ghc-$pkgver" + local newpath path target + cd "$builddir" - make -j1 DESTDIR="$pkgdir" install || return 1 + make -j1 DESTDIR="$pkgdir" install - local _ghclib="usr/lib/ghc-$pkgver" + cd "$pkgdir" - # Fixup install tree if needed - if [ -d "$pkgdir/usr/lib/$CTARGET-ghc-$pkgver" ]; then + # Fixup install tree if needed. + if [ -d usr/lib/$CTARGET-ghc-$pkgver ]; then # different location - _ghclib="usr/lib/$CTARGET-ghc-$pkgver" - # rename binaries, and fix links - local fn; for fn in "$pkgdir"/usr/bin/"$CTARGET"-*; do - local _new="${fn//${CTARGET}-/}" - if [ -h "$fn" ]; then - local _target="$(readlink $fn)" - ln -sf "${_target//${CTARGET}-/}" "$_new" || return 1 - rm "$fn" || return 1 + ghclib="usr/lib/$CTARGET-ghc-$pkgver" + + # Rename binaries and fix links. + local path; for path in usr/bin/"$CTARGET"-*; do + newpath="${path//$CTARGET-/}" + + if [ -h "$path" ]; then + target="$(readlink $path)" + ln -sf "${target//$CTARGET-/}" "$newpath" + rm "$path" else - mv "$fn" "$_new" || return 1 + mv "$path" "$newpath" fi done - # remove triplet prefix from settings -- the intention is - # that the native compiler will use native gcc/ld on the target - sed -ie "s|$CTARGET-||g" "$pkgdir"/usr/lib/${CTARGET}-ghc-$pkgver/settings || return 1 + + # Remove triplet prefix from settings -- the intention is + # that the native compiler will use native gcc/ld on the target. + sed -i "s|$CTARGET-||g" usr/lib/$CTARGET-ghc-$pkgver/settings fi # Can't do a full strip on archives. - find "$pkgdir" -type f \( -name "*.so" -o -name "*.a" \) -exec ${CROSS_COMPILE}strip --strip-unneeded {} \; - find "$pkgdir/$_ghclib/bin" -type f -exec ${CROSS_COMPILE}strip {} \; - paxmark -m "$pkgdir/$_ghclib/bin/ghc" \ - "$pkgdir/$_ghclib/bin/ghc-iserv" \ - "$pkgdir/$_ghclib/bin/ghc-iserv-dyn" \ - "$pkgdir/$_ghclib/bin/ghc-iserv-prof" + find . -type f \( -name "*.so" -o -name "*.a" \) \ + -exec ${CROSS_COMPILE}strip --strip-unneeded {} \; + find $ghclib/bin -type f -exec ${CROSS_COMPILE}strip {} \; + + paxmark -m \ + $ghclib/bin/ghc \ + $ghclib/bin/ghc-iserv \ + $ghclib/bin/ghc-iserv-dyn \ + $ghclib/bin/ghc-iserv-prof } +# Like debian, we split apart the profiled archives/etc... +# This drastically reduces the install size of the ghc pkg. dev() { - # Like debian, we split apart the profiled archives/etc... - # This drastically reduces the install size of the ghc pkg. - cd "${pkgdir}" || return 1 - install -dm755 "${subpkgdir}" || return 1 - local PFILES=$(find . \( -type f -o -type l \) \( -name "*.p_*" -o -name "lib*_p.a" \)) - echo "${PFILES}" | cpio -pamVd "${subpkgdir}" || return 1 - echo "${PFILES}" | xargs rm -fr || return 1 + pkgdesc="$pkgdesc (development files)" + depends="$pkgname=$pkgver-r$pkgrel" + + cd "$pkgdir" + + install -dm755 "$subpkgdir" + + local pfiles=$(find . \( -type f -o -type l \) \( -name "*.p_*" -o -name "lib*_p.a" \)) + echo "$pfiles" | cpio -pamVd "$subpkgdir" + echo "$pfiles" | xargs rm -fr } sha512sums="58ea3853cd93b556ecdc4abd0be079b2621171b8491f59004ea4e036a4cba4470aaafe6591b942e0a50a64bdc47540e01fe6900212a1ef7087850112d9bfc5ef ghc-8.0.2-src.tar.xz diff --git a/testing/ghc/ghc.post-install b/testing/ghc/ghc.post-install index 43a1034bf6..43a1034bf6 100755..100644 --- a/testing/ghc/ghc.post-install +++ b/testing/ghc/ghc.post-install |