4c2bdc
%global multilib_arches %{ix86} ppc ppc64 ppc64p7 s390 s390x x86_64
4c2bdc
4c2bdc
Name:		libffi
4c2bdc
Version:	3.1
ddf358
Release:	24%{?dist}
4c2bdc
Summary:	A portable foreign function interface library
4c2bdc
4c2bdc
Group:		System Environment/Libraries
4c2bdc
License:	MIT
4c2bdc
URL:		http://sourceware.org/libffi
4c2bdc
Source0:	ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz
4c2bdc
Source1:	ffi-multilib.h
4c2bdc
Source2:	ffitarget-multilib.h
4c2bdc
Patch0:		libffi-3.1-fix-include-path.patch
4c2bdc
Patch1:		libffi-3.1-fix-exec-stack.patch
4c2bdc
Patch2:		libffi-aarch64-rhbz1174037.patch
4c2bdc
Patch3:		libffi-3.1-aarch64-fix-exec-stack.patch
e65318
Patch5:		libffi-3.1-closures-Create-temporary-file-with-O_TMPFILE-and-O_.patch
0eb13e
Patch6:		libffi-3.1-libffi_tmpdir.patch
50a7f9
Patch7:		libffi-3.1-memfd.patch
ddf358
Patch8:		libffi-3.1-rh2014228.patch
4c2bdc
4c2bdc
%description
4c2bdc
Compilers for high level languages generate code that follow certain
4c2bdc
conventions.  These conventions are necessary, in part, for separate
4c2bdc
compilation to work.  One such convention is the "calling convention".
4c2bdc
The calling convention is a set of assumptions made by the compiler
4c2bdc
about where function arguments will be found on entry to a function.  A
4c2bdc
calling convention also specifies where the return value for a function
4c2bdc
is found.  
4c2bdc
4c2bdc
Some programs may not know at the time of compilation what arguments
4c2bdc
are to be passed to a function.  For instance, an interpreter may be
4c2bdc
told at run-time about the number and types of arguments used to call a
4c2bdc
given function.  `Libffi' can be used in such programs to provide a
4c2bdc
bridge from the interpreter program to compiled code.
4c2bdc
4c2bdc
The `libffi' library provides a portable, high level programming
4c2bdc
interface to various calling conventions.  This allows a programmer to
4c2bdc
call any function specified by a call interface description at run time.
4c2bdc
4c2bdc
FFI stands for Foreign Function Interface.  A foreign function
4c2bdc
interface is the popular name for the interface that allows code
4c2bdc
written in one language to call code written in another language.  The
4c2bdc
`libffi' library really only provides the lowest, machine dependent
4c2bdc
layer of a fully featured foreign function interface.  A layer must
4c2bdc
exist above `libffi' that handles type conversions for values passed
4c2bdc
between the two languages.  
4c2bdc
4c2bdc
4c2bdc
%package	devel
4c2bdc
Summary:	Development files for %{name}
4c2bdc
Group:		Development/Libraries
4c2bdc
Requires:	%{name} = %{version}-%{release}
4c2bdc
Requires:	pkgconfig
4c2bdc
Requires(post): /sbin/install-info
4c2bdc
Requires(preun): /sbin/install-info
4c2bdc
4c2bdc
%description	devel
4c2bdc
The %{name}-devel package contains libraries and header files for
4c2bdc
developing applications that use %{name}.
4c2bdc
4c2bdc
4c2bdc
%prep
4c2bdc
%setup -q
4c2bdc
%patch0 -p1 -b .fixpath
4c2bdc
%patch1 -p1 -b .execstack
4c2bdc
%patch2 -p1 -b .aarch64
4c2bdc
%patch3 -p1 -b .aarch64execstack
e65318
%patch5 -p1
0eb13e
%patch6 -p1
50a7f9
%patch7 -p1
ddf358
%patch8 -p1
4c2bdc
4c2bdc
4c2bdc
%build
4c2bdc
export CFLAGS="%{build_cflags} -Wa,--generate-missing-build-notes=yes"
4c2bdc
%configure --disable-static
4c2bdc
make %{?_smp_mflags}
4c2bdc
4c2bdc
4c2bdc
%install
4c2bdc
make install DESTDIR=$RPM_BUILD_ROOT
4c2bdc
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
4c2bdc
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
4c2bdc
4c2bdc
# Determine generic arch target name for multilib wrapper
4c2bdc
basearch=%{_arch}
4c2bdc
%ifarch %{ix86}
4c2bdc
basearch=i386
4c2bdc
%endif
4c2bdc
4c2bdc
mkdir -p $RPM_BUILD_ROOT%{_includedir}
4c2bdc
%ifarch %{multilib_arches}
4c2bdc
# Do header file switcheroo to avoid file conflicts on systems where you
4c2bdc
# can have both a 32- and 64-bit version of the library, and they each need
4c2bdc
# their own correct-but-different versions of the headers to be usable.
4c2bdc
for i in ffi ffitarget; do
4c2bdc
  mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/$i.h $RPM_BUILD_ROOT%{_includedir}/$i-${basearch}.h
4c2bdc
done
4c2bdc
install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/ffi.h
4c2bdc
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h
4c2bdc
%else
4c2bdc
mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/{ffi,ffitarget}.h $RPM_BUILD_ROOT%{_includedir}
4c2bdc
%endif
4c2bdc
rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}
4c2bdc
4c2bdc
4c2bdc
%ldconfig_scriptlets
4c2bdc
4c2bdc
%post devel
4c2bdc
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || :
4c2bdc
4c2bdc
%preun devel
4c2bdc
if [ $1 = 0 ] ;then
4c2bdc
  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || :
4c2bdc
fi
4c2bdc
4c2bdc
4c2bdc
%files
4c2bdc
%{!?_licensedir:%global license %%doc}
4c2bdc
%license LICENSE
4c2bdc
%doc README
4c2bdc
%{_libdir}/*.so.*
4c2bdc
4c2bdc
%files devel
4c2bdc
%{_libdir}/pkgconfig/*.pc
4c2bdc
%{_includedir}/ffi*.h
4c2bdc
%{_libdir}/*.so
4c2bdc
%{_mandir}/man3/*.gz
4c2bdc
%{_infodir}/libffi.info.gz
4c2bdc
4c2bdc
%changelog
ddf358
* Wed Nov 16 2022 DJ Delorie <dj@redhat.com> - 3.1-24
ddf358
- Use /etc/sysconfig/libffi-force-shared-memory-check-first to
ddf358
  override selinux permissions check for shared memory access (#2014228)
ddf358
50a7f9
* Fri Nov 19 2021 DJ Delorie <dj@redhat.com> - 3.1-23
50a7f9
- Use memfd_create() to allocate closures (#1875340)
50a7f9
0eb13e
* Wed May 6 2020 DJ Delorie <dj@redhat.com> - 3.1-22
0eb13e
- Add $LIBFFI_TMPDIR environment variable support (#1723951)
0eb13e
e65318
* Thu Aug 1 2019 DJ Delorie <dj@redhat.com> - 3.1-21
e65318
- Revert 1652930 until 1721569 can be fixed (#1652930)
e65318
e65318
* Fri Jun 14 2019 DJ Delorie <dj@redhat.com> - 3.1-20
e65318
- closures: Create temporary file with O_TMPFILE and O_CLOEXEC (#1720600)
e65318
e65318
* Fri Jun 14 2019 Florian Weimer <fweimer@redhat.com> - 3.1-19
e65318
- aarch64: Flush code alias mapping after creating closure (#1652930)
e65318
4c2bdc
* Tue Nov 27 2018 Severin Gehwolf <sgehwolf@redhat.com> - 3.1-18
4c2bdc
- Compile with -Wa,--generate-missing-build-notes=yes
4c2bdc
4c2bdc
* Fri Aug 10 2018 Severin Gehwolf <sgehwolf@redhat.com> - 3.1-17
4c2bdc
- Fix declared license: BSD => MIT.
4c2bdc
4c2bdc
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-16
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
4c2bdc
4c2bdc
* Sat Feb 03 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.1-15
4c2bdc
- Switch to %%ldconfig_scriptlets
4c2bdc
4c2bdc
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-14
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
4c2bdc
4c2bdc
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-13
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
4c2bdc
4c2bdc
* Wed Jul  5 2017 Jens Petersen <petersen@redhat.com> - 3.1-12
4c2bdc
- protect install-info in the rpm scriptlets
4c2bdc
  https://fedoraproject.org/wiki/Packaging:Scriptlets#Texinfo
4c2bdc
4c2bdc
* Tue Jun 20 2017 Anthony Green <green@redhat.com> - 3.1-11
4c2bdc
- fix exec stack problem on aarch64 build
4c2bdc
4c2bdc
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-10
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
4c2bdc
4c2bdc
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.1-9
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
4c2bdc
4c2bdc
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1-8
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
4c2bdc
4c2bdc
* Thu Jan 15 2015 Peter Robinson <pbrobinson@fedoraproject.org> 3.1-7
4c2bdc
- Add patch to fix issues on aarch64 (rhbz 1174037)
4c2bdc
4c2bdc
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1-6
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
4c2bdc
4c2bdc
* Thu Jul 17 2014 Tom Callaway <spot@fedoraproject.org> - 3.1-5
4c2bdc
- fix license handling
4c2bdc
4c2bdc
* Sun Jun 29 2014 Anthony Green <green@redhat.com> - 3.1-4
4c2bdc
- fix exec stack problem on 32-bit build
4c2bdc
4c2bdc
* Thu Jun 12 2014 Dan Horák <dan[at]danny.cz> - 3.1-3
4c2bdc
- fix header path in pkgconfig file
4c2bdc
4c2bdc
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1-2
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
4c2bdc
4c2bdc
* Mon May 19 2014 Anthony Green <green@redhat.com> - 3.1-1
4c2bdc
- fix non-multiarch builds (arm).
4c2bdc
4c2bdc
* Mon May 19 2014 Anthony Green <green@redhat.com> - 3.1-0
4c2bdc
- update to 3.1.
4c2bdc
4c2bdc
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.13-5
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
4c2bdc
4c2bdc
* Tue May 28 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-4
4c2bdc
- fix typos in wrapper headers
4c2bdc
4c2bdc
* Mon May 27 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-3
4c2bdc
- make header files multilib safe
4c2bdc
4c2bdc
* Sat May 25 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-2
4c2bdc
- fix incorrect header pathing (and .pc file)
4c2bdc
4c2bdc
* Wed Mar 20 2013 Anthony Green <green@redhat.com> - 3.0.13-1
4c2bdc
- update to 3.0.13
4c2bdc
4c2bdc
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.11-2
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
4c2bdc
4c2bdc
* Mon Jan 14 2013 Dennis Gilmore <dennis@ausil.us> - 3.0.11-1
4c2bdc
- update to 3.0.11
4c2bdc
4c2bdc
* Fri Nov 02 2012 Deepak Bhole <dbhole@redhat.com> - 3.0.10-4
4c2bdc
- Fixed source location
4c2bdc
4c2bdc
* Fri Aug 10 2012 Dennis Gilmore <dennis@ausil.us> - 3.0.10-3
4c2bdc
- drop back to 3.0.10, 3.0.11 was never pushed anywhere as the soname bump broke buildroots
4c2bdc
- as 3.0.11 never went out no epoch needed.
4c2bdc
4c2bdc
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.11-2
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
4c2bdc
4c2bdc
* Fri Apr 13 2012 Anthony Green <green@redhat.com> - 3.0.11-1
4c2bdc
- Upgrade to 3.0.11.
4c2bdc
4c2bdc
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.10-2
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
4c2bdc
4c2bdc
* Tue Aug 23 2011 Anthony Green <green@redhat.com> - 3.0.10-1
4c2bdc
- Upgrade to 3.0.10. 
4c2bdc
4c2bdc
* Fri Mar 18 2011 Dan Horák <dan[at]danny.cz> - 3.0.9-3
4c2bdc
- added patch for being careful when defining relatively generic symbols
4c2bdc
4c2bdc
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.9-2
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
4c2bdc
4c2bdc
* Tue Dec 29 2009 Anthony Green <green@redhat.com> - 3.0.9-1
4c2bdc
- Upgrade
4c2bdc
4c2bdc
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-3
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
4c2bdc
4c2bdc
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-2
4c2bdc
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
4c2bdc
4c2bdc
* Tue Jul 08 2008 Anthony Green <green@redhat.com> 3.0.5-1
4c2bdc
- Upgrade to 3.0.5
4c2bdc
4c2bdc
* Fri Feb 15 2008 Anthony Green <green@redhat.com> 3.0.1-1
4c2bdc
- Upgrade to 3.0.1
4c2bdc
4c2bdc
* Fri Feb 15 2008 Anthony Green <green@redhat.com> 2.99.9-1
4c2bdc
- Upgrade to 2.99.9
4c2bdc
- Require pkgconfig for the devel package.
4c2bdc
- Update summary.
4c2bdc
4c2bdc
* Fri Feb 15 2008 Anthony Green <green@redhat.com> 2.99.8-1
4c2bdc
- Upgrade to 2.99.8
4c2bdc
4c2bdc
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.7-1
4c2bdc
- Upgrade to 2.99.7
4c2bdc
4c2bdc
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.6-1
4c2bdc
- Upgrade to 2.99.6
4c2bdc
4c2bdc
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.4-1
4c2bdc
- Upgrade to 2.99.4
4c2bdc
4c2bdc
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.3-1
4c2bdc
- Upgrade to 2.99.3
4c2bdc
4c2bdc
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.2-1
4c2bdc
- Created.