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