From 6c5e6e710fca15aa4783e7919e8e9866c783126b Mon Sep 17 00:00:00 2001 From: Carlos O'Donell Date: Tue, 27 Jul 2021 23:16:43 -0400 Subject: [PATCH] Rebase to libffi-3.4.2 and provide compat-libffi3.1 Resolves: #1891914 --- .gitignore | 1 + libffi.spec | 109 +++++++++++++++++++++++++++++++------- libffi3.1-pkgconfig.patch | 11 ++++ sources | 3 +- 4 files changed, 105 insertions(+), 19 deletions(-) create mode 100644 libffi3.1-pkgconfig.patch diff --git a/.gitignore b/.gitignore index 6d5a2a3..b02cf99 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ libffi-3.0.9.tar.gz /libffi-3.0.11.tar.gz /libffi-3.0.13.tar.gz /libffi-3.1.tar.gz +/libffi-3.4.2.tar.gz diff --git a/libffi.spec b/libffi.spec index 4f759e5..d566a43 100644 --- a/libffi.spec +++ b/libffi.spec @@ -1,22 +1,30 @@ %bcond_with bootstrap +# Default: Build compat-libffi3.1. +%bcond_without compat -%global multilib_arches %{ix86} ppc ppc64 ppc64p7 s390 s390x x86_64 +%global multilib_arches %{ix86} x86_64 Name: libffi -Version: 3.1 -Release: 29%{?dist} +Version: 3.4.2 +Release: 3%{?dist} Summary: A portable foreign function interface library License: MIT URL: http://sourceware.org/libffi -Source0: ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz +Source0: https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2.tar.gz Source1: ffi-multilib.h Source2: ffitarget-multilib.h -Patch0: libffi-3.1-fix-include-path.patch -Patch1: libffi-3.1-fix-exec-stack.patch -Patch2: libffi-aarch64-rhbz1174037.patch -Patch3: libffi-3.1-aarch64-fix-exec-stack.patch -Patch4: libffi-3.1-libffi_tmpdir.patch + +%if %{with compat} +# Sources and patches required for compat-libffi3.1: +Source3: ftp://sourceware.org/pub/libffi/libffi-3.1.tar.gz +Patch0: libffi-3.1-fix-include-path.patch +Patch1: libffi-3.1-fix-exec-stack.patch +Patch2: libffi-aarch64-rhbz1174037.patch +Patch3: libffi-3.1-aarch64-fix-exec-stack.patch +Patch4: libffi-3.1-libffi_tmpdir.patch +Patch5: libffi3.1-pkgconfig.patch +%endif BuildRequires: make BuildRequires: gcc @@ -52,6 +60,15 @@ layer of a fully featured foreign function interface. A layer must exist above `libffi' that handles type conversions for values passed between the two languages. +%if %{with compat} +%package -n compat-libffi3.1 +Summary: Compatibility package for libffi transition from 3.1 to 3.4.2. + +%description -n compat-libffi3.1 +The compat-libffi3.1 package contains the libffi 3.1 runtime library +to support the library SONAME transition from 3.1 to 3.4.2. This pacakge +will eventually be removed once the transition is complete. +%endif %package devel Summary: Development files for %{name} @@ -62,26 +79,68 @@ Requires: pkgconfig The %{name}-devel package contains libraries and header files for developing applications that use %{name}. - %prep +%if %{without compat} %setup -q +%else +# Setup libffi-3.4.2 and compat-libffi3.1 sources. +%setup -q -b 3 +%endif + +%if %{with compat} +cd %{_builddir}/libffi-3.1 %patch0 -p1 -b .fixpath %patch1 -p1 -b .execstack %patch2 -p1 -b .aarch64 %patch3 -p1 -b .aarch64execstack %patch4 -p1 -b .libffitmpdir +%patch5 -p1 -b .pkgconfig +%endif %build -%configure --disable-static + +# For now we disable the static templates to avoid ghc and +# gobject-introspection failures: +# https://gitlab.haskell.org/ghc/ghc/-/issues/20051 +# https://gitlab.gnome.org/GNOME/gobject-introspection/-/merge_requests/283 +# We need to get these fixes into Fedora before we can reeanble them. +%configure --disable-static --disable-exec-static-tramp %make_build +%if %{with compat} +cd %{_builddir}/libffi-3.1 +%configure --disable-static --includedir=%{_includedir}/libffi3.1 +%make_build +%endif + %check %if %{without bootstrap} %make_build check +%if %{with compat} +cd %{_builddir}/libffi-3.1 +%make_build check +%endif %endif %install %make_install + +%if %{with compat} +# Install compat-libffi-3.1 files. +rm -rf $RPM_BUILD_ROOT/libffi-3.1 +mkdir -p $RPM_BUILD_ROOT/libffi-3.1 +cd %{_builddir}/libffi-3.1 +make install DESTDIR=$RPM_BUILD_ROOT/libffi-3.1 +# We only need the shared libraries, license, and README.md. +mv $RPM_BUILD_ROOT/libffi-3.1/%{_libdir}/libffi.so.6 $RPM_BUILD_ROOT/%{_libdir} +mv $RPM_BUILD_ROOT/libffi-3.1/%{_libdir}/libffi.so.6.0.2 $RPM_BUILD_ROOT/%{_libdir} +mkdir -p $RPM_BUILD_ROOT/%{_docdir}/libffi-3.1 +cp %{_builddir}/libffi-3.1/README $RPM_BUILD_ROOT/%{_docdir}/libffi-3.1/README +mkdir -p $RPM_BUILD_ROOT/%{_datadir}/licenses/libffi-3.1 +cp %{_builddir}/libffi-3.1/LICENSE $RPM_BUILD_ROOT/%{_datadir}/licenses/libffi-3.1/LICENSE +rm -rf $RPM_BUILD_ROOT/libffi-3.1 +%endif + find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' rm -f $RPM_BUILD_ROOT%{_infodir}/dir @@ -97,22 +156,27 @@ mkdir -p $RPM_BUILD_ROOT%{_includedir} # can have both a 32- and 64-bit version of the library, and they each need # their own correct-but-different versions of the headers to be usable. for i in ffi ffitarget; do - mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/$i.h $RPM_BUILD_ROOT%{_includedir}/$i-${basearch}.h + mv $RPM_BUILD_ROOT%{_includedir}/$i.h $RPM_BUILD_ROOT%{_includedir}/$i-${basearch}.h done install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/ffi.h install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h -%else -mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/{ffi,ffitarget}.h $RPM_BUILD_ROOT%{_includedir} %endif -rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} - %ldconfig_scriptlets %files %license LICENSE -%doc README -%{_libdir}/*.so.* +%doc README.md +%{_libdir}/libffi.so.8 +%{_libdir}/libffi.so.8.1.0 + +%if %{with compat} +%files -n compat-libffi3.1 +%license %{_datadir}/licenses/libffi-3.1/LICENSE +%doc %{_docdir}/libffi-3.1/README +%{_libdir}/libffi.so.6 +%{_libdir}/libffi.so.6.0.2 +%endif %files devel %{_libdir}/pkgconfig/*.pc @@ -122,6 +186,15 @@ rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version} %{_infodir}/libffi.info.* %changelog +* Tue Jul 27 2021 Carlos O'Donell - 3.4.2-3 +- Add temporary compat-libffi3.1 for library transition. + +* Thu Jul 22 2021 Fedora Release Engineering - 3.4.2-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild + +* Mon Jun 28 2021 Carlos O'Donell - 3.4.2-1 +- Rebase to libffi 3.4.2. + * Fri Apr 16 2021 Mohan Boddu - 3.1-29 - Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937 diff --git a/libffi3.1-pkgconfig.patch b/libffi3.1-pkgconfig.patch new file mode 100644 index 0000000..644a893 --- /dev/null +++ b/libffi3.1-pkgconfig.patch @@ -0,0 +1,11 @@ +diff -rup a/libffi.pc.in b/libffi.pc.in +--- a/libffi.pc.in 2020-12-02 15:33:14.076549606 -0500 ++++ b/libffi.pc.in 2020-12-02 16:11:42.855654638 -0500 +@@ -6,5 +6,5 @@ includedir=@includedir@ + Name: @PACKAGE_NAME@ + Description: Library supporting Foreign Function Interfaces + Version: @PACKAGE_VERSION@ +-Libs: -L${libdir} -lffi ++Libs: -L${libdir} libffi.so.6 + Cflags: -I${includedir} +Only in b: libffi.pc.in~ diff --git a/sources b/sources index f24e41b..60acf20 100644 --- a/sources +++ b/sources @@ -1 +1,2 @@ -f5898b29bbfd70502831a212d9249d10 libffi-3.1.tar.gz +SHA512 (libffi-3.4.2.tar.gz) = 31bad35251bf5c0adb998c88ff065085ca6105cf22071b9bd4b5d5d69db4fadf16cadeec9baca944c4bb97b619b035bb8279de8794b922531fddeb0779eb7fb1 +SHA512 (libffi-3.1.tar.gz) = 8994973d75facf5ad928c270e17b1a56e24d1543af75b93731a0048e747df27e4190a736b6dc2dca7d43de1d7e88891220304802c10fcccdcebee9c9ffd3d1b9