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