From bbbb1efebc35654b81368256ba429232d514ffe8 Mon Sep 17 00:00:00 2001 From: slotThe Date: Wed, 25 Mar 2020 20:45:46 +0100 Subject: [PATCH] ghc: update to 8.8.3 Incorporates #20368 Also uses a recent libffi tarball for generating bindists. This may not matter so much for x86_64 but the libffi tarball ghc bundles by default is from 2017 and there is an assortment of bugs that would be too much effort to patch. Instead just fetch a fresh, confirmed-to-work tarball from upstream source. Currently selected revision is 4d6d286 because that's almost just the official 3.3 release, but with a bunch of fixes applied (which we are patching in in our own libffi). It was selected to predate some more invasive changes made in libffi master. --- srcpkgs/ghc/patches/libffi-autogen.patch | 25 +++++++++++++++ srcpkgs/ghc/template | 39 ++++++++++++++++++++++-- 2 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 srcpkgs/ghc/patches/libffi-autogen.patch diff --git a/srcpkgs/ghc/patches/libffi-autogen.patch b/srcpkgs/ghc/patches/libffi-autogen.patch new file mode 100644 index 00000000000..7b08c65a39b --- /dev/null +++ b/srcpkgs/ghc/patches/libffi-autogen.patch @@ -0,0 +1,25 @@ +Since we replace bundled tarball with our own and it's a git +snapshot, it is necessary to generate the build system ourselves + +Source: @q66 + +--- a/libffi/ghc.mk ++++ b/libffi/ghc.mk +@@ -58,16 +58,7 @@ $(libffi_STAMP_CONFIGURE): $(TOUCH_DEP) + $(CP) "$(TOP)/config.guess" libffi/build/config.guess + $(CP) "$(TOP)/config.sub" libffi/build/config.sub + +-# We have to fake a non-working ln for configure, so that the fallback +-# option (cp -p) gets used instead. Otherwise the libffi build system +-# will use cygwin symbolic links which cannot be read by mingw gcc. +- chmod +x libffi/ln +- +- # We need to use -MMD rather than -MD, as otherwise we get paths +- # like c:/... in the dependency files on Windows, and the extra +- # colons break make +- mv libffi/build/Makefile.in libffi/build/Makefile.in.orig +- sed "s/-MD/-MMD/" < libffi/build/Makefile.in.orig > libffi/build/Makefile.in ++ cd libffi && cd build && "$(SHELL)" ./autogen.sh + + # We attempt to specify the installation directory below with --libdir, + # but libffi installs into 'toolexeclibdir' instead, which may differ diff --git a/srcpkgs/ghc/template b/srcpkgs/ghc/template index 1bcfa039200..12a1a8235db 100644 --- a/srcpkgs/ghc/template +++ b/srcpkgs/ghc/template @@ -1,8 +1,8 @@ # Template file for 'ghc' pkgname=ghc # Keep this synchronized with http://www.stackage.org/lts -version=8.6.5 -revision=2 +version=8.8.3 +revision=1 wrksrc="ghc-${version%[!0-9]}" build_style=gnu-configure configure_args="--with-system-libffi" @@ -14,7 +14,7 @@ maintainer="Leah Neukirchen " license="BSD-3-Clause" homepage="http://www.haskell.org/ghc/" distfiles="http://www.haskell.org/ghc/dist/${version%[!0-9]}/${pkgname}-${version%[!0-9]}-src.tar.xz" -checksum=4d4aa1e96f4001b934ac6193ab09af5d6172f41f5a5d39d8e43393b9aafee361 +checksum=e0dcc0aaf3e234c5978f29e6df62947e97720ab404ec0158343df211c5480f89 patch_args="-Np1" nocross=yes # ask leah2 before wasting time trying to do that _bindir="/usr/lib/${pkgname}-${version}/bin" @@ -32,6 +32,31 @@ nopie_files=" ${_bindir}/unlit " +build_options="bindist" +desc_option_bindist="Create a binary distribution" + +# Recent safe to use tarball +# GHC's bundled tarball is from 2017, buggy on some archs +_ffi_rev=4d6d2866ae43e55325e8ee96561221804602cd7a + +if [ "$build_option_bindist" ]; then + # Strip --with-system-libffi from configuration + configure_args=${configure_args/--with-system-libffi/} + # Required to make the binary distribution tarball + hostmakedepends+=" tar xz libtool libltdl-devel" + # Fetch a safe libffi tarball + distfiles+=" https://github.com/libffi/libffi/archive/${_ffi_rev}.tar.gz>libffi-${_ffi_rev}.tar.gz" + checksum+=" f7a17fa61261942e93450ec52272b5f09d8f42cfffd147867587f969ee01b739" + skip_extraction+=" libffi-${_ffi_rev}.tar.gz" +fi + +post_extract() { + [ "$build_option_bindist" ] || return 0 + rm -f libffi-tarballs/libffi-*.tar.gz + cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/libffi-${_ffi_rev}.tar.gz \ + libffi-tarballs +} + pre_configure() { export CONF_CC_OPTS_STAGE0=$CFLAGS_FOR_BUILD export CONF_CC_OPTS_STAGE1=$CFLAGS @@ -49,6 +74,14 @@ pre_configure() { post_install() { sed -i 's#/usr/lib/ccache/bin/##g' ${DESTDIR}/usr/lib/ghc-${version%[!0-9]}/settings vlicense LICENSE + + if [ "$build_option_bindist" ]; then + msg_normal "Creating binary distribution for ${XBPS_TARGET_MACHINE}...\n" + make ${makejobs} binary-dist + dest="${XBPS_SRCDISTDIR}"/distfiles/ghc-${version}-void-linux-${XBPS_TARGET_LIBC}.tar.xz + install -d -m 0644 ghc-${version}-*-unknown-linux.tar.xz "${dest}" + msg_normal "Installed in ${dest}\n" + fi } ghc-doc_package() {