From 826e5b4b12a7ca6ec24d99a4825aa9fa6481b535 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Sat, 27 Jul 2019 12:08:22 +0000 Subject: [PATCH] use Debian fix-build-using-unregisterized-v8.4.patch https://gitlab.haskell.org/ghc/ghc/issues/15913 - remove ghc wrapper script hack! --- fix-build-using-unregisterized-v8.4.patch | 58 +++++++++++++++++++++++ ghc.spec | 16 ++----- 2 files changed, 63 insertions(+), 11 deletions(-) create mode 100644 fix-build-using-unregisterized-v8.4.patch diff --git a/fix-build-using-unregisterized-v8.4.patch b/fix-build-using-unregisterized-v8.4.patch new file mode 100644 index 0000000..c524733 --- /dev/null +++ b/fix-build-using-unregisterized-v8.4.patch @@ -0,0 +1,58 @@ +Description: Allow unregisterised ghc-8.4 to build newer GHC + Commit 4075656e8bb introduced a regression stopping existing unregisteristed + compilers from being able to compile newer versions of GHC. The problem is + that the bootstrap compiler uses the newer `rts/storage/ClosureTypes.h` file + where some defines have been renamed, resulting in the following error: +. + error: ‘stg_MUT_ARR_PTRS_FROZEN0_info’ undeclared (first use in this function); did you mean ‘stg_MUT_ARR_PTRS_FROZEN_DIRTY_info’? +. + For more information, see https://gitlab.haskell.org/ghc/ghc/issues/15913. +. + This patch can be removed, once ghc-8.4 is no longer the bootstrap compiler. +Author: Ilias Tsitsimpis +Bug: https://gitlab.haskell.org/ghc/ghc/issues/15913 +Bug-Debian: https://bugs.debian.org/932941 + +Index: b/includes/rts/storage/ClosureTypes.h +=================================================================== +--- a/includes/rts/storage/ClosureTypes.h ++++ b/includes/rts/storage/ClosureTypes.h +@@ -82,5 +82,11 @@ + #define SMALL_MUT_ARR_PTRS_DIRTY 60 + #define SMALL_MUT_ARR_PTRS_FROZEN_DIRTY 61 + #define SMALL_MUT_ARR_PTRS_FROZEN_CLEAN 62 ++#if __GLASGOW_HASKELL__ < 806 ++#define SMALL_MUT_ARR_PTRS_FROZEN0 SMALL_MUT_ARR_PTRS_FROZEN_DIRTY ++#define SMALL_MUT_ARR_PTRS_FROZEN SMALL_MUT_ARR_PTRS_FROZEN_CLEAN ++#define MUT_ARR_PTRS_FROZEN0 MUT_ARR_PTRS_FROZEN_DIRTY ++#define MUT_ARR_PTRS_FROZEN MUT_ARR_PTRS_FROZEN_CLEAN ++#endif + #define COMPACT_NFDATA 63 + #define N_CLOSURE_TYPES 64 +Index: b/includes/stg/MiscClosures.h +=================================================================== +--- a/includes/stg/MiscClosures.h ++++ b/includes/stg/MiscClosures.h +@@ -116,12 +116,22 @@ RTS_ENTRY(stg_ARR_WORDS); + RTS_ENTRY(stg_MUT_ARR_WORDS); + RTS_ENTRY(stg_MUT_ARR_PTRS_CLEAN); + RTS_ENTRY(stg_MUT_ARR_PTRS_DIRTY); ++#if __GLASGOW_HASKELL__ < 806 ++RTS_ENTRY(stg_MUT_ARR_PTRS_FROZEN); ++RTS_ENTRY(stg_MUT_ARR_PTRS_FROZEN0); ++#else + RTS_ENTRY(stg_MUT_ARR_PTRS_FROZEN_CLEAN); + RTS_ENTRY(stg_MUT_ARR_PTRS_FROZEN_DIRTY); ++#endif + RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_CLEAN); + RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_DIRTY); ++#if __GLASGOW_HASKELL__ < 806 ++RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_FROZEN); ++RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_FROZEN0); ++#else + RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_FROZEN_CLEAN); + RTS_ENTRY(stg_SMALL_MUT_ARR_PTRS_FROZEN_DIRTY); ++#endif + RTS_ENTRY(stg_MUT_VAR_CLEAN); + RTS_ENTRY(stg_MUT_VAR_DIRTY); + RTS_ENTRY(stg_END_TSO_QUEUE); diff --git a/ghc.spec b/ghc.spec index a2808bd..57ffcae 100644 --- a/ghc.spec +++ b/ghc.spec @@ -94,6 +94,10 @@ Patch28: x32-use-native-x86_64-insn.patch Patch30: add_-latomic_to_ghc-prim.patch # https://salsa.debian.org/haskell-team/DHG_packages/blob/master/p/ghc/debian/patches/e175aaf6918bb2b497b83618dc4c270a0d231a1c.patch Patch32: https://salsa.debian.org/haskell-team/DHG_packages/raw/master/p/ghc/debian/patches/e175aaf6918bb2b497b83618dc4c270a0d231a1c.patch +# https://gitlab.haskell.org/ghc/ghc/issues/15913 +# remove after Fedora default moves to 8.6 +# https://salsa.debian.org/haskell-team/DHG_packages/blob/master/p/ghc/debian/patches/fix-build-using-unregisterized-v8.4 +Patch34: fix-build-using-unregisterized-v8.4.patch # fedora ghc has been bootstrapped on # %%{ix86} x86_64 ppc ppc64 armv7hl s390 s390x ppc64le aarch64 @@ -327,6 +331,7 @@ cd libraries/process %ifarch %{ghc_unregisterized_arches} %patch15 -p1 -b .orig %patch17 -p1 -b .orig +%patch34 -p1 -b .orig %endif # bigendian @@ -401,16 +406,6 @@ export LDFLAGS="${LDFLAGS:-%{?__global_ldflags}}" # for ghc >= 8.2 export CC=%{_bindir}/gcc -# remove after Fedora default moves to 8.6 -%ifarch %{ghc_unregisterized_arches} -cat > ghc-unregisterised-wrapper << EOF -#!/usr/bin/sh -exec /usr/bin/ghc -optc-I%{_libdir}/ghc-$(ghc --numeric-version)/include \${1+"\$@"} -EOF -chmod a+x ghc-unregisterised-wrapper -ln -s /usr/bin/ghc-pkg ghc-pkg-unregisterised-wrapper -%endif - # * %%configure induces cross-build due to different target/host/build platform names ./configure --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} \ --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} \ @@ -421,7 +416,6 @@ ln -s /usr/bin/ghc-pkg ghc-pkg-unregisterised-wrapper --with-system-libffi \ %ifarch %{ghc_unregisterized_arches} --enable-unregisterised \ - --with-ghc=$PWD/ghc-unregisterised-wrapper \ %endif %{nil}