From 039c5495135f7d3f0f0438f76f8dbd9c294c4c44 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: May 10 2022 10:58:58 +0000 Subject: use --with-system-libffi also for Hadrian (#2082827) the bundled libffi broke the rawhide buildroot :-( 6e12e3c isn't actually needed for Hadrian builds --- diff --git a/6e12e3c178fe9ad16131eb3c089bd6578976f5d6.patch b/6e12e3c178fe9ad16131eb3c089bd6578976f5d6.patch new file mode 100644 index 0000000..8747821 --- /dev/null +++ b/6e12e3c178fe9ad16131eb3c089bd6578976f5d6.patch @@ -0,0 +1,48 @@ +From 6e12e3c178fe9ad16131eb3c089bd6578976f5d6 Mon Sep 17 00:00:00 2001 +From: Ben Gamari +Date: Tue, 3 May 2022 13:48:56 -0400 +Subject: [PATCH] configure: Check for ffi.h + +As noted in #21485, we checked for ffi.h yet then failed to throw an +error if it is missing. + +Fixes #21485. +--- + m4/fp_find_libffi.m4 | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/m4/fp_find_libffi.m4 b/m4/fp_find_libffi.m4 +index ddc511553c8b..bf52afefbb8e 100644 +--- a/m4/fp_find_libffi.m4 ++++ b/m4/fp_find_libffi.m4 +@@ -49,6 +49,7 @@ AC_DEFUN([FP_FIND_LIBFFI], + CFLAGS="$LIBFFI_CFLAGS $CFLAGS" + LDFLAGS2="$LDFLAGS" + LDFLAGS="$LIBFFI_LDFLAGS $LDFLAGS" ++ + if test "$HostOS" = "openbsd"; + then + # OpenBSD's libffi is not directly linked to the libpthread but +@@ -58,10 +59,16 @@ AC_DEFUN([FP_FIND_LIBFFI], + # symbols. + LDFLAGS="$LDFLAGS -lpthread" + fi ++ + AC_CHECK_LIB(ffi, ffi_call, +- [AC_CHECK_HEADERS([ffi.h], [break], []) +- AC_DEFINE([HAVE_SYSTEM_LIBFFI], [1], [Define to 1 if you have libffi.])], +- [AC_MSG_ERROR([Cannot find system libffi])]) ++ [AC_CHECK_HEADERS( ++ [ffi.h], ++ [AC_DEFINE([HAVE_SYSTEM_LIBFFI], [1], [Define to 1 if you have libffi.])], ++ [AC_MSG_ERROR([Cannot find ffi.h for system libffi])] ++ )], ++ [AC_MSG_ERROR([Cannot find system libffi])] ++ ) ++ + CFLAGS="$CFLAGS2" + LDFLAGS="$LDFLAGS2" + ]) +-- +GitLab + diff --git a/8189.patch b/8189.patch new file mode 100644 index 0000000..5343188 --- /dev/null +++ b/8189.patch @@ -0,0 +1,74 @@ +From 235474e7ae582d66081d8e44666beb2f7638fdd3 Mon Sep 17 00:00:00 2001 +From: Matthew Pickering +Date: Mon, 9 May 2022 18:23:15 +0100 +Subject: [PATCH] hadrian: Only copy and install libffi headers when using + in-tree libffi + +When passed `--use-system-libffi` then we shouldn't copy and install the +headers from the system package. Instead the headers are expected to be +available as a runtime dependency on the users system. + +Fixes #21485 #21487 +--- + hadrian/src/Rules/Generate.hs | 4 +++- + hadrian/src/Rules/Rts.hs | 2 +- + rts/rts.cabal.in | 6 +++--- + 3 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/hadrian/src/Rules/Generate.hs b/hadrian/src/Rules/Generate.hs +index aaa83e0060ec..5653bd1d25e1 100644 +--- a/hadrian/src/Rules/Generate.hs ++++ b/hadrian/src/Rules/Generate.hs +@@ -41,13 +41,15 @@ rtsDependencies :: Expr [FilePath] + rtsDependencies = do + stage <- getStage + rtsPath <- expr (rtsBuildPath stage) ++ useSystemFfi <- expr (flag UseSystemFfi) ++ + let headers = + [ "ghcautoconf.h", "ghcplatform.h" + , "DerivedConstants.h" + , "rts" -/- "EventTypes.h" + , "rts" -/- "EventLogConstants.h" + ] +- ++ libffiHeaderFiles ++ ++ (if useSystemFfi then [] else libffiHeaderFiles) + pure $ ((rtsPath -/- "include") -/-) <$> headers + + genapplyDependencies :: Expr [FilePath] +diff --git a/hadrian/src/Rules/Rts.hs b/hadrian/src/Rules/Rts.hs +index 59a337801fce..9a18a41c46fb 100644 +--- a/hadrian/src/Rules/Rts.hs ++++ b/hadrian/src/Rules/Rts.hs +@@ -126,7 +126,7 @@ needRtsLibffiTargets stage = do + let headers = fmap ((rtsPath -/- "include") -/-) libffiHeaderFiles + + if useSystemFfi +- then return headers ++ then return [] + else do + -- Need Libffi + -- This returns the dynamic library files (in the Libffi build dir). +diff --git a/rts/rts.cabal.in b/rts/rts.cabal.in +index ff60f1b4564f..cc449ee5226c 100644 +--- a/rts/rts.cabal.in ++++ b/rts/rts.cabal.in +@@ -73,6 +73,9 @@ library + extra-bundled-libraries: Cffi-6 + else + extra-bundled-libraries: Cffi ++ install-includes: ffi.h ffitarget.h ++ -- ^ see Note [Packaging libffi headers] in ++ -- GHC.Driver.CodeOutput. + + -- The make build system does something special in config.mk.in + -- for generating profiled, debugged, etc builds of those +@@ -166,7 +166,7 @@ + install-includes: Cmm.h HsFFI.h MachDeps.h Rts.h RtsAPI.h Stg.h + ghcautoconf.h ghcconfig.h ghcplatform.h ghcversion.h + -- ^ from include +- DerivedConstants.h ffi.h ffitarget.h ++ DerivedConstants.h + rts/EventLogConstants.h + rts/EventTypes.h + -- ^ generated diff --git a/ghc9.4.spec b/ghc9.4.spec index 347faee..b9b06d6 100644 --- a/ghc9.4.spec +++ b/ghc9.4.spec @@ -65,7 +65,7 @@ Version: 9.4.0.20220501 # - release can only be reset if *all* library versions get bumped simultaneously # (sometimes after a major release) # - minor release numbers for a branch should be incremented monotonically -Release: 1%{?dist} +Release: 2%{?dist} Summary: Glasgow Haskell Compiler License: BSD and HaskellReport @@ -88,6 +88,11 @@ Patch6: ghc-8.6.3-sphinx-1.8.patch # fix bindist install_docs error when no docs # https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8170 Patch7: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8170.patch +# detect ffi.h +# https://gitlab.haskell.org/ghc/ghc/-/issues/21485 +Patch8: https://gitlab.haskell.org/ghc/ghc/-/commit/6e12e3c178fe9ad16131eb3c089bd6578976f5d6.patch +# https://gitlab.haskell.org/ghc/ghc/-/issues/21487 +Patch9: https://gitlab.haskell.org/ghc/ghc/-/merge_requests/8189.patch # arm patches Patch12: ghc-armv7-VFPv3D16--NEON.patch @@ -134,9 +139,7 @@ BuildRequires: ghc-template-haskell-devel BuildRequires: ghc-transformers-devel BuildRequires: alex BuildRequires: gmp-devel -%if %{without hadrian} BuildRequires: libffi-devel -%endif BuildRequires: lzip BuildRequires: make BuildRequires: gcc-c++ @@ -154,10 +157,6 @@ BuildRequires: llvm%{llvm_major} BuildRequires: llvm >= %{llvm_major} %endif %endif -%ifarch armv7hl -# patch12 -BuildRequires: autoconf, automake -%endif %if %{with hadrian} BuildRequires: ghc-Cabal-static BuildRequires: ghc-QuickCheck-static @@ -177,9 +176,11 @@ BuildRequires: alex BuildRequires: autoconf BuildRequires: automake BuildRequires: happy +%else +%ifarch armv7hl +# patch12 +BuildRequires: autoconf, automake %endif -%if %{with hadrian} -Provides: bundled(libffi) = 3.3-rc2 %endif Requires: %{name}-compiler = %{version}-%{release} Requires: %{name}-devel = %{version}-%{release} @@ -388,9 +389,11 @@ Installing this package causes %{name}-*-prof packages corresponding to %patch2 -p1 -b .orig %patch6 -p1 -b .orig %patch7 -p1 -b .orig +%patch8 -p1 -b .orig +%patch9 -p1 -b .orig #%%patch10 -p1 -b .orig -#rm -r libffi-tarballs +rm libffi-tarballs/libffi-*.tar.gz #sed -i -e '/libffi-tarballs/d' packages %ifarch armv7hl @@ -480,9 +483,7 @@ export CC=%{_bindir}/gcc --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} \ --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \ --docdir=%{_docdir}/%{name} \ -%if %{without hadrian} --with-system-libffi \ -%endif %ifarch %{ghc_unregisterized_arches} --enable-unregisterised \ %endif @@ -598,7 +599,7 @@ fi\ # add rts libs %if %{with hadrian} -for i in %{buildroot}%{ghclibplatform}/libHSrts*ghc%{ghc_version}.so %{buildroot}%{ghclibplatform}/libffi.so*; do +for i in %{buildroot}%{ghclibplatform}/libHSrts*ghc%{ghc_version}.so; do echo $i >> %{name}-base.files done %else @@ -888,6 +889,9 @@ env -C %{ghc_html_libraries_dir} ./gen_contents_index %changelog +* Mon May 9 2022 Jens Petersen - 9.4.0.20220501-2 +- use --with-system-libffi for Hadrian (#2082827) + * Sat May 7 2022 Jens Petersen - 9.4.0.20220501-1 - 9.4.1-alpha1 - derived from the ghc9.2 package