diff --git a/.fmf/version b/.fmf/version deleted file mode 100644 index d00491f..0000000 --- a/.fmf/version +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/.gitignore b/.gitignore index 24dfd22..6d5a2a3 100644 --- a/.gitignore +++ b/.gitignore @@ -3,10 +3,3 @@ 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 -/libffi-3.4.4.tar.gz -/libffi-3.4.6.tar.gz -/libffi-3.4.7.tar.gz -/libffi-3.4.8.tar.gz -/libffi-3.5.1.tar.gz -/libffi-3.5.2.tar.gz diff --git a/libffi-3.1-aarch64-fix-exec-stack.patch b/libffi-3.1-aarch64-fix-exec-stack.patch new file mode 100644 index 0000000..e20c920 --- /dev/null +++ b/libffi-3.1-aarch64-fix-exec-stack.patch @@ -0,0 +1,11 @@ +--- a/src/aarch64/sysv.S ++++ b/src/aarch64/sysv.S +@@ -396,3 +396,8 @@ + #ifdef __ELF__ + .size CNAME(ffi_closure_SYSV), .-CNAME(ffi_closure_SYSV) + #endif ++ ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",%progbits ++#endif ++ diff --git a/libffi-3.1-fix-exec-stack.patch b/libffi-3.1-fix-exec-stack.patch new file mode 100644 index 0000000..4c2a59f --- /dev/null +++ b/libffi-3.1-fix-exec-stack.patch @@ -0,0 +1,31 @@ +From 978c9540154d320525488db1b7049277122f736d Mon Sep 17 00:00:00 2001 +From: Samuli Suominen +Date: Sat, 31 May 2014 08:53:10 -0400 +Subject: [PATCH] Add missing GNU stack markings in win32.S + +--- + src/x86/win32.S | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/x86/win32.S b/src/x86/win32.S +index daf0e79..e42baf2 100644 +--- a/src/x86/win32.S ++++ b/src/x86/win32.S +@@ -1,5 +1,6 @@ + /* ----------------------------------------------------------------------- +- win32.S - Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. ++ win32.S - Copyright (c) 2014 Anthony Green ++ Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. + Copyright (c) 2001 John Beniton + Copyright (c) 2002 Ranjit Mathew + Copyright (c) 2009 Daniel Witte +@@ -1304,3 +1305,6 @@ L_ffi_closure_SYSV_inner$stub: + + #endif /* !_MSC_VER */ + ++#if defined __ELF__ && defined __linux__ ++ .section .note.GNU-stack,"",@progbits ++#endif +-- +1.9.3 + diff --git a/libffi-3.1-fix-include-path.patch b/libffi-3.1-fix-include-path.patch new file mode 100644 index 0000000..5a3b7a5 --- /dev/null +++ b/libffi-3.1-fix-include-path.patch @@ -0,0 +1,17 @@ +diff -up libffi-3.1/libffi.pc.in.fixpath libffi-3.1/libffi.pc.in +--- libffi-3.1/libffi.pc.in.fixpath 2014-04-25 19:45:13.000000000 +0200 ++++ libffi-3.1/libffi.pc.in 2014-06-12 12:06:06.000000000 +0200 +@@ -1,11 +1,10 @@ + prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ +-toolexeclibdir=@toolexeclibdir@ +-includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include ++includedir=@includedir@ + + Name: @PACKAGE_NAME@ + Description: Library supporting Foreign Function Interfaces + Version: @PACKAGE_VERSION@ +-Libs: -L${toolexeclibdir} -lffi ++Libs: -L${libdir} -lffi + Cflags: -I${includedir} diff --git a/libffi-aarch64-rhbz1174037.patch b/libffi-aarch64-rhbz1174037.patch new file mode 100644 index 0000000..dbf6308 --- /dev/null +++ b/libffi-aarch64-rhbz1174037.patch @@ -0,0 +1,11 @@ +--- libffi-3.1/src/aarch64/ffi.c.orig 2014-04-25 18:45:13.000000000 +0100 ++++ libffi-3.1/src/aarch64/ffi.c 2015-01-15 02:36:56.314906455 +0000 +@@ -728,7 +728,7 @@ + state.ngrn = N_X_ARG_REG; + + memcpy (allocate_to_stack (&state, stack, ty->alignment, +- ty->size), ecif->avalue + i, ty->size); ++ ty->size), ecif->avalue[i], ty->size); + } + break; + diff --git a/libffi.spec b/libffi.spec index a056262..de2b4cc 100644 --- a/libffi.spec +++ b/libffi.spec @@ -1,56 +1,20 @@ -%bcond_with bootstrap - -%global multilib_arches %{ix86} x86_64 +%global multilib_arches %{ix86} ppc ppc64 ppc64p7 s390 s390x x86_64 Name: libffi -Version: 3.5.2 -Release: 1%{?dist} +Version: 3.1 +Release: 14%{?dist} Summary: A portable foreign function interface library -# No license change for 3.5.2 -# No license change for 3.5.1 -# No license change for 3.4.8 -# No license change for 3.4.7 -# No license change for 3.4.6 -# The following SPDX licenses are extracted from the sources using -# ScanCode 32.0.8 on build libffi-3.4.4-7.fc40: -# -# MIT - Most of the project sources (Required) -# CC-PDDC - src/dlmalloc.c (Required) -# mit OR gpl-3.0 - ltmain.sh (Ignored) -# mit OR gpl-1.0-plus - ltmain.sh (Ignored) -# gpl-2.0-plus WITH libtool-exception-2.0 - ltmain.sh, libtool.m4, configure (Ignored, not shipped) -# warranty-disclaimer - ltmain.sh (Ignored) -# unknown-license-reference - ltmain.sh (Ignored) -# gpl-2.0-plus - Used by build system only (Ignored) -# gpl-2.0 - Used by build system only (Ignored) -# free-unknown - config.guess, config.sub (Ignored) -# fsf-ap - Used by build system only (Ignored) -# fsf-free - Used by build system only (Ignored) -# fsf-unlimited - Used by build system only (Ignored) -# fsf-unlimited-no-warranty - Used by build system only (Ignored) -# gpl-1.0-plus - False positive in texinfo.tex (Ignored) -# gpl-3.0-plus WITH tex-exception - texinfo.tex used in libffi-devel docs (Required) -# gpl-2.0-plus WITH autoconf-simple-exception-2.0 - Used by build system only (Ignored) -# gpl-3.0 - Used by build system only (Ignored) -# gpl-3.0-plus - Used by the testsuite only (Ignored) -# gpl-3.0-plus WITH autoconf-exception-2.0 - Used by build system only (Ignored) -# gpl-3.0-plus WITH autoconf-simple-exception - Used by build system only (Ignored) -# mpl-1.1 OR gpl-2.0-plus OR lgpl-2.1-plus - Not used in build (Ignored) -# public-domain - Used by build system only (Ignored) -# x11-xconsortium - Used by build system only (Ignored) -License: MIT AND CC-PDDC AND (GPL-3.0-or-later WITH Texinfo-exception) -URL: http://sourceware.org/libffi -Source0: https://github.com/libffi/libffi/releases/download/v%{version}/libffi-%{version}.tar.gz +Group: System Environment/Libraries +License: BSD +URL: http://sourceware.org/libffi +Source0: ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz Source1: ffi-multilib.h Source2: ffitarget-multilib.h - -BuildRequires: make -BuildRequires: gcc -%if %{without bootstrap} -BuildRequires: gcc-c++ -BuildRequires: dejagnu -%endif +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 %description Compilers for high level languages generate code that follow certain @@ -79,33 +43,35 @@ 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. + %package devel Summary: Development files for %{name} +Group: Development/Libraries Requires: %{name} = %{version}-%{release} Requires: pkgconfig +Requires(post): /sbin/install-info +Requires(preun): /sbin/install-info %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. + %prep -%autosetup -p1 +%setup -q +%patch0 -p1 -b .fixpath +%patch1 -p1 -b .execstack +%patch2 -p1 -b .aarch64 +%patch3 -p1 -b .aarch64execstack + %build -# --disable-multi-os-directory is used because otherwise, on riscv64, the -# library is installed under ${_libdir}/lp64d, which we don't want. Other -# architectures don't have the same problem so they're unaffected. -%configure --disable-static --disable-multi-os-directory -%make_build +%configure --disable-static +make %{?_smp_mflags} -%check -%if %{without bootstrap} -%make_build check -%endif %install -%make_install - +make install DESTDIR=$RPM_BUILD_ROOT find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' rm -f $RPM_BUILD_ROOT%{_infodir}/dir @@ -121,165 +87,43 @@ 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%{_includedir}/$i.h $RPM_BUILD_ROOT%{_includedir}/$i-${basearch}.h + mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/$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} + + +%post -p /sbin/ldconfig + +%post devel +/sbin/install-info --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || : + +%preun devel +if [ $1 = 0 ] ;then + /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || : +fi + +%postun -p /sbin/ldconfig -%ldconfig_scriptlets %files +%{!?_licensedir:%global license %%doc} %license LICENSE -%doc README.md -%{_libdir}/libffi.so.8 -%{_libdir}/libffi.so.8.2.0 +%doc README +%{_libdir}/*.so.* %files devel %{_libdir}/pkgconfig/*.pc %{_includedir}/ffi*.h %{_libdir}/*.so %{_mandir}/man3/*.gz -%{_infodir}/libffi.info.* +%{_infodir}/libffi.info.gz %changelog -* Fri Sep 5 2025 DJ Delorie - 3.5.2-1 -- Rebase to libffi 3.5.1. - -* Thu Jul 24 2025 Fedora Release Engineering - 3.5.1-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_43_Mass_Rebuild - -* Fri Jun 13 2025 DJ Delorie - 3.5.1-1 -- Rebase to libffi 3.5.1. - -* Wed May 07 2025 DJ Delorie - 3.4.8-1 -- Rebase to libffi 3.4.8. - -* Fri Apr 04 2025 Andrea Bolognani - 3.4.7-4 -- Fix riscv64 build (thanks David Abdurachmanov and Rich Jones) - -* Thu Mar 27 2025 DJ Delorie - 3.4.7-3 -- Regenerate configure for previous patch(#2313598) - -* Thu Mar 06 2025 DJ Delorie - 3.4.7-2 -- Add PPC64 static trampoline support (#2313598) - -* Tue Feb 18 2025 DJ Delorie - 3.4.7-1 -- Rebase to libffi 3.4.7. - -* Wed Jan 22 2025 DJ Delorie - 3.4.6-5 -- Fix FTBFS due to C23 compiler (#2340729) - -* Fri Jan 17 2025 Fedora Release Engineering - 3.4.6-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild - -* Wed Aug 21 2024 Carlos O'Donell 3.4.6-3 -- Fix AArch64 BTI enablement issues (#2305877) - -* Thu Jul 18 2024 Fedora Release Engineering - 3.4.6-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild - -* Mon Mar 18 2024 DJ Delorie - 3.4.6-1 -- Rebase to libffi 3.4.6. - -* Thu Feb 29 2024 Carlos O'Donell - 3.4.4-8 -- Analyze libffi-3.4.4-7.fc40 sources for license information -- Migrate License field to SPDX identifiers for - https://docs.fedoraproject.org/en-US/legal/allowed-licenses/ - https://docs.fedoraproject.org/en-US/legal/update-existing-packages - (#2222084) - -* Thu Jan 25 2024 Fedora Release Engineering - 3.4.4-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Sun Jan 21 2024 Fedora Release Engineering - 3.4.4-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild - -* Tue Jan 02 2024 Florian Weimer - 3.4.4-5 -- Add missing declaration of open_temp_exec_file - -* Thu Jul 20 2023 Fedora Release Engineering - 3.4.4-4 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild - -* Tue May 02 2023 DJ Delorie - 3.4.4-3 -- Enable static trampolines - -* Thu Jan 19 2023 Fedora Release Engineering - 3.4.4-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - -* Fri Oct 28 2022 DJ Delorie - 3.4.4-1 -- Rebase to libffi 3.4.4. - -* Thu Jul 21 2022 Fedora Release Engineering - 3.4.2-9 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild - -* Mon Jan 31 2022 Dan Horák - 3.4.2-8 -- Fix handling Float128 structs on ppc64le (#2045797) - -* Thu Jan 20 2022 Fedora Release Engineering - 3.4.2-7 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild - -* Sat Jan 08 2022 Miro Hrončok - 3.4.2-6 -- Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34 - -* Wed Sep 15 2021 Carlos O'Donell - 3.4.2-5 -- Rebuilt for https://fedoraproject.org/wiki/Changes/LIBFFI34 - -* Wed Sep 15 2021 Carlos O'Donell - 3.4.2-4 -- Harmonize spec file layout with downstream. - -* Wed Aug 11 2021 Carlos O'Donell - 3.4.2-3 -- Rebuild package and bump NEVRA. - -* 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. - -* Tue Jan 26 2021 Fedora Release Engineering - 3.1-28 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - -* Wed Dec 02 2020 Carlos O'Donell - 3.1-27 -- Use make macros -- https://fedoraproject.org/wiki/Changes/UseMakeBuildInstallMacro - -* Tue Jul 28 2020 Fedora Release Engineering - 3.1-26 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild - -* Thu Apr 30 2020 DJ Delorie - 3.1-25 -- Add $LIBFFI_TMPDIR environment variable support (#1667620) - -* Wed Jan 29 2020 Fedora Release Engineering - 3.1-24 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild - -* Thu Jul 25 2019 Fedora Release Engineering - 3.1-23 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - -* Tue Jul 9 2019 Florian Weimer - 3.1-22 -- Run test suite during build (#1727088) - -* Wed Jun 19 2019 Anthony Green - 3.1-21 -- Fix license tag - -* Wed Apr 24 2019 Björn Esser - 3.1-20 -- Remove hardcoded gzip suffix from GNU info pages - -* Fri Feb 01 2019 Fedora Release Engineering - 3.1-19 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild - -* Sun Jul 22 2018 Peter Robinson 3.1-28 -- Fix FTBFS - -* Fri Jul 13 2018 Fedora Release Engineering - 3.1-17 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - -* Wed Feb 07 2018 Fedora Release Engineering - 3.1-16 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - -* Sat Feb 03 2018 Igor Gnatenko - 3.1-15 -- Switch to %%ldconfig_scriptlets - * Thu Aug 03 2017 Fedora Release Engineering - 3.1-14 - Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild diff --git a/plans/gating.fmf b/plans/gating.fmf deleted file mode 100644 index 1ff37e7..0000000 --- a/plans/gating.fmf +++ /dev/null @@ -1,6 +0,0 @@ -summary: Gating testplan for libffi -discover: - how: fmf -execute: - how: tmt - diff --git a/sources b/sources index 5cd2132..f24e41b 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libffi-3.5.2.tar.gz) = 76974a84e3aee6bbd646a6da2e641825ae0b791ca6efdc479b2d4cbcd3ad607df59cffcf5031ad5bd30822961a8c6de164ac8ae379d1804acd388b1975cdbf4d +f5898b29bbfd70502831a212d9249d10 libffi-3.1.tar.gz diff --git a/tests/testsuite/Makefile b/tests/testsuite/Makefile deleted file mode 100644 index 59c8522..0000000 --- a/tests/testsuite/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Makefile of /tools/libffi/Sanity/testsuite -# Description: Runs upstream testsuite -# Author: Michal Nowak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2010 Red Hat, Inc. All rights reserved. -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -export TEST=/tools/libffi/Sanity/testsuite -export TESTVERSION=1.0 - -BUILT_FILES= - -FILES=$(METADATA) runtest.sh Makefile PURPOSE - -.PHONY: all install download clean - -run: $(FILES) build - ./runtest.sh - -build: $(BUILT_FILES) - chmod a+x runtest.sh - -clean: - rm -f *~ $(BUILT_FILES) - - -include /usr/share/rhts/lib/rhts-make.include - -$(METADATA): Makefile - @echo "Owner: Michal Nowak " > $(METADATA) - @echo "Name: $(TEST)" >> $(METADATA) - @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) - @echo "Path: $(TEST_DIR)" >> $(METADATA) - @echo "Description: Runs upstream testsuite" >> $(METADATA) - @echo "Type: Sanity" >> $(METADATA) - @echo "TestTime: 35m" >> $(METADATA) - @echo "RunFor: libffi" >> $(METADATA) - @echo "Requires: libffi libffi-devel libtool gcc dejagnu rpm-build gcc-c++ texinfo strace" >> $(METADATA) - @echo "Priority: Normal" >> $(METADATA) - @echo "License: GPLv3" >> $(METADATA) - @echo "Confidential: no" >> $(METADATA) - @echo "Destructive: no" >> $(METADATA) - @echo "Releases: -RHEL4 -RHEL5" >> $(METADATA) - - rhts-lint $(METADATA) diff --git a/tests/testsuite/PURPOSE b/tests/testsuite/PURPOSE deleted file mode 100644 index 688fefb..0000000 --- a/tests/testsuite/PURPOSE +++ /dev/null @@ -1,3 +0,0 @@ -PURPOSE of /tools/libffi/Sanity/testsuite -Description: Runs upstream testsuite -Author: Michal Nowak diff --git a/tests/testsuite/main.fmf b/tests/testsuite/main.fmf deleted file mode 100644 index 360ae2b..0000000 --- a/tests/testsuite/main.fmf +++ /dev/null @@ -1,33 +0,0 @@ -summary: Runs upstream testsuite -description: '' -enabled: true -link: - - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1031159 - - relates: https://bugzilla.redhat.com/show_bug.cgi?id=839210 - - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1006261 -tag: - - CI-Tier-1 - - RHEL6 - - Tier1 - - rhel-buildroot -tier: '1' -contact: mcermak@redhat.com -component: - - libffi -test: ./runtest.sh -framework: beakerlib -require: - - libffi - - libffi-devel - - libtool - - gcc - - dejagnu - - rpm-build - - gcc-c++ - - texinfo - - strace -duration: 35m -extra-nitrate: TC#0063644 -extra-summary: /tools/libffi/Sanity/testsuite -extra-task: /tools/libffi/Sanity/testsuite -id: 2d3a499f-1f59-40f0-a76c-1c73569d0512 diff --git a/tests/testsuite/runtest.sh b/tests/testsuite/runtest.sh deleted file mode 100755 index df1b20b..0000000 --- a/tests/testsuite/runtest.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# runtest.sh of /tools/libffi/Sanity/testsuite -# Description: Runs upstream testsuite -# Author: Michal Nowak -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# -# Copyright (c) 2010 Red Hat, Inc. All rights reserved. -# -# This program is free software: you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied -# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -# PURPOSE. See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. -# -# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -# Include rhts environment -. /usr/share/beakerlib/beakerlib.sh || exit 1 - -PACKAGES=(libffi libffi-devel gcc dejagnu rpm-build gcc-c++) - -rlJournalStart - rlPhaseStartSetup - for p in "${PACKAGES[@]}"; do - if ! rlCheckRpm "$p"; then - rlRun "yum -y install $p" - rlAssertRpm "$p" - fi - done; - - rlRun "TmpDir=$(mktemp -d)" 0 "Creating tmp directory" - rlRun "pushd $TmpDir" - rlFetchSrcForInstalled libffi - rlRun "rpm -ivh libffi*.src.rpm" - rlRun "popd" - rlRun "specfile=$(rpm --eval='%_specdir')/libffi.spec" - rlRun "rpmbuild -bp --undefine specpartsdir $specfile" - rlRun "builddir=$(rpm --eval='%_builddir')" - rlRun "pushd $(dirname "$(find $builddir -name configure)")" - rlRun "./configure" - rlRun "make" - rlPhaseEnd - - rlPhaseStartTest "Run testsuite" - set -xe - # Patch the testsuite to run with the installed libffi libraries, not - # with the ones built from the rpm. - # Do not add the current dir or the build dir to ld_library_path - sed -i 's/set ld_library_path "."/set ld_library_path ""/' testsuite/lib/libffi*.exp - sed -i '/append ld_library_path.*blddirffi/d' testsuite/lib/libffi*.exp - # Set ld_library_path to the system libdir (typically /usr/lib or /usr/lib64) - MYLIBDIR=$(rpm --eval '%{_libdir}') - sed -i 's;set libffi_dir.*"[^"]*";set libffi_dir "'"${MYLIBDIR}"'";' testsuite/lib/libffi*.exp - grep -F -e 'set ld_library_path' -e 'set libffi_dir' testsuite/lib/libffi.exp - # As of upstream commit 40a7682 the link flags hardcode the library dir so we need to edit that too - # by removing the explicit library seach path to the built libraries. - # https://github.com/libffi/libffi/commit/40a7682#diff-b4e449eb85934de2bdcf9ee0ac320872a7d09d60df6a24e3f066d7d74f6ddfd0R345 - sed -i 's;set libffi_link_flags "-L[^"]*";set libffi_link_flags "";' testsuite/lib/libffi*.exp - set +xe - rlLog "Checking whether we test really the installed libraries." - strace -F -e open,openat,stat -o strace.log -- make check - # Count library calls from places different than the libdir we want (MYLIBDIR) - LIBFFI_SO_CALLS=$(cat strace.log | grep libffi.so | grep -v ENOENT | grep -v "/usr" | grep -v '"/lib' | grep -c -v 'unfinished') - rlAssertGreater "The just built libraries should not be used, everything should be taken from /usr" 5 "$LIBFFI_SO_CALLS" - rlRun "cat strace.log | grep libffi.so | grep /usr" - rlRun "cat strace.log | grep libffi.so | grep rpmbuild" 1 - rlRun "make check" 0 "RUNNING THE TESTSUITE" - rlRun "popd" - rlPhaseEnd - - rlPhaseStartCleanup - rlRun "ls -al $TmpDir" - rlBundleLogs logs "$(find . -name 'libffi.sum')" "$(find . -name 'libffi.log')" - rlRun "rm -r $TmpDir" 0 "Removing tmp directory" - rlPhaseEnd -rlJournalPrintText -rlJournalEnd