e9b5f4
%global multilib_arches %{ix86} ppc ppc64 s390 s390x x86_64
e9b5f4
e9b5f4
Name:		libffi
e9b5f4
Version:	3.0.13
e9b5f4
Release:	19%{?dist}
e9b5f4
Summary:	A portable foreign function interface library
e9b5f4
e9b5f4
Group:		System Environment/Libraries
e9b5f4
License:	MIT and Public Domain
e9b5f4
URL:		http://sourceware.org/libffi
e9b5f4
Source0:	ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz
e9b5f4
# part of upstream commit 5feacad4
e9b5f4
Source1:	ffi-multilib.h
e9b5f4
Source2:	ffitarget-multilib.h
e9b5f4
Patch0:		libffi-3.0.13-fix-include-path.patch
e9b5f4
Patch1:		libffi-fix-ppc-tests.patch
e9b5f4
# part of upstream commit 5feacad4
e9b5f4
Patch10:	libffi-3.0.13-ppc64le-0.patch
e9b5f4
Patch11:	libffi-3.0.13-ppc64le-1.patch
e9b5f4
Patch12:	libffi-3.0.13-ppc64le-2.patch
e9b5f4
Patch13:	libffi-3.0.13-ppc64le-3.patch
e9b5f4
# rhbz 1287815:
e9b5f4
Patch20:	libffi-aarch64-rhbz1174037.patch
e9b5f4
e9b5f4
Patch21:        libffi-3.0.13-closures-Create-temporary-file-with-O_TMPFILE-and-O_.patch
e9b5f4
%ifarch ppc64le
e9b5f4
BuildRequires:  autoconf automake libtool texinfo
e9b5f4
%endif
e9b5f4
BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
e9b5f4
e9b5f4
%description
e9b5f4
Compilers for high level languages generate code that follow certain
e9b5f4
conventions.  These conventions are necessary, in part, for separate
e9b5f4
compilation to work.  One such convention is the "calling convention".
e9b5f4
The calling convention is a set of assumptions made by the compiler
e9b5f4
about where function arguments will be found on entry to a function.  A
e9b5f4
calling convention also specifies where the return value for a function
e9b5f4
is found.  
e9b5f4
e9b5f4
Some programs may not know at the time of compilation what arguments
e9b5f4
are to be passed to a function.  For instance, an interpreter may be
e9b5f4
told at run-time about the number and types of arguments used to call a
e9b5f4
given function.  `Libffi' can be used in such programs to provide a
e9b5f4
bridge from the interpreter program to compiled code.
e9b5f4
e9b5f4
The `libffi' library provides a portable, high level programming
e9b5f4
interface to various calling conventions.  This allows a programmer to
e9b5f4
call any function specified by a call interface description at run time.
e9b5f4
e9b5f4
FFI stands for Foreign Function Interface.  A foreign function
e9b5f4
interface is the popular name for the interface that allows code
e9b5f4
written in one language to call code written in another language.  The
e9b5f4
`libffi' library really only provides the lowest, machine dependent
e9b5f4
layer of a fully featured foreign function interface.  A layer must
e9b5f4
exist above `libffi' that handles type conversions for values passed
e9b5f4
between the two languages.  
e9b5f4
e9b5f4
e9b5f4
%package	devel
e9b5f4
Summary:	Development files for %{name}
e9b5f4
Group:		Development/Libraries
e9b5f4
Requires:	%{name} = %{version}-%{release}
e9b5f4
Requires:       pkgconfig
e9b5f4
Requires(post): /sbin/install-info
e9b5f4
Requires(preun): /sbin/install-info
e9b5f4
e9b5f4
%description	devel
e9b5f4
The %{name}-devel package contains libraries and header files for
e9b5f4
developing applications that use %{name}.
e9b5f4
e9b5f4
e9b5f4
%prep
e9b5f4
%setup -q
e9b5f4
%patch0 -p1 -b .fixpath
e9b5f4
%patch1 -p1 -b .fixpath
e9b5f4
%ifarch ppc64le
e9b5f4
%patch10 -p1 -b .ppc64le-0
e9b5f4
%patch11 -p1 -b .ppc64le-1
e9b5f4
%patch12 -p1 -b .ppc64le-2
e9b5f4
%patch13 -p1 -b .ppc64le-3
e9b5f4
e9b5f4
autoreconf -vif
e9b5f4
%endif
e9b5f4
e9b5f4
%patch20 -p1 -b .aarch64
e9b5f4
%patch21 -p1 -b .tmpfile
e9b5f4
%build
e9b5f4
CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %configure --disable-static
e9b5f4
make %{?_smp_mflags}
e9b5f4
e9b5f4
e9b5f4
%install
e9b5f4
rm -rf $RPM_BUILD_ROOT
e9b5f4
make install DESTDIR=$RPM_BUILD_ROOT
e9b5f4
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
e9b5f4
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
e9b5f4
e9b5f4
# Determine generic arch target name for multilib wrapper
e9b5f4
basearch=%{_arch}
e9b5f4
%ifarch %{ix86}
e9b5f4
basearch=i386
e9b5f4
%endif
e9b5f4
e9b5f4
%ifarch %{multilib_arches}
e9b5f4
# Do header file switcheroo to avoid file conflicts on systems where you
e9b5f4
# can have both a 32- and 64-bit version of the library, and they each need
e9b5f4
# their own correct-but-different versions of the headers to be usable.
e9b5f4
for i in ffi ffitarget; do
e9b5f4
  mv $RPM_BUILD_ROOT%{_includedir}/$i.h $RPM_BUILD_ROOT%{_includedir}/$i-${basearch}.h
e9b5f4
done
e9b5f4
install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/ffi.h
e9b5f4
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h
e9b5f4
%endif
e9b5f4
e9b5f4
e9b5f4
%clean
e9b5f4
rm -rf $RPM_BUILD_ROOT
e9b5f4
e9b5f4
e9b5f4
%post -p /sbin/ldconfig
e9b5f4
e9b5f4
%post devel
e9b5f4
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || :
e9b5f4
e9b5f4
%preun devel
e9b5f4
if [ $1 = 0 ] ;then
e9b5f4
  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libffi.info.gz || :
e9b5f4
fi
e9b5f4
e9b5f4
%postun -p /sbin/ldconfig
e9b5f4
e9b5f4
e9b5f4
%files
e9b5f4
%defattr(-,root,root,-)
e9b5f4
%doc LICENSE README
e9b5f4
%{_libdir}/*.so.*
e9b5f4
e9b5f4
%files devel
e9b5f4
%defattr(-,root,root,-)
e9b5f4
%{_libdir}/pkgconfig/*.pc
e9b5f4
%{_includedir}/ffi*.h
e9b5f4
%{_libdir}/*.so
e9b5f4
%{_mandir}/man3/*.gz
e9b5f4
%{_infodir}/libffi.info.gz
e9b5f4
e9b5f4
%changelog
e9b5f4
* Tue Jul 23 2019 DJ Delorie <dj@redhat.com> - 3.0.13-19
e9b5f4
- Allow libffi-devel uninstall even when docs are not installed (#1609331)
e9b5f4
e9b5f4
* Tue Apr  5 2016 Andrew Haley <aph@redhat.com> - 3.0.13-18
e9b5f4
- closures: Create temporary file with O_TMPFILE and O_CLOEXEC
e9b5f4
- Resolves: RHBZ1151568
e9b5f4
e9b5f4
* Tue Apr  5 2016 Andrew Haley <aph@redhat.com> - 3.0.13-17
e9b5f4
- libffi needs fix for structures not passed in registers
e9b5f4
- Resolves: RHBZ1287815
e9b5f4
e9b5f4
* Tue Sep 02 2014 Dan HorĂ¡k <dhorak@redhat.com> - 3.0.13-16
e9b5f4
- Drop ppc64le from the multilib list
e9b5f4
- Use additional BR: only in ppc64le build
e9b5f4
- Resolves: RHBZ1116945
e9b5f4
e9b5f4
* Tue Aug 26 2014 Andrew Haley <aph@redhat.com> - 3.0.13-15
e9b5f4
- Add requires for libtool and texinfo
e9b5f4
- Resolves: RHBZ1116945
e9b5f4
e9b5f4
* Tue Aug 26 2014 Andrew Haley <aph@redhat.com> - 3.0.13-14
e9b5f4
- Add requires for automake
e9b5f4
- Resolves: RHBZ1116945
e9b5f4
e9b5f4
* Tue Aug 26 2014 Andrew Haley <aph@redhat.com> - 3.0.13-13
e9b5f4
- Add requires for autoconf
e9b5f4
- Resolves: RHBZ1116945
e9b5f4
e9b5f4
* Tue Aug 26 2014 Andrew Haley <aph@redhat.com> - 3.0.13-12
e9b5f4
- Merge from private-rhel-7.0-ppc64le branch
e9b5f4
- Resolves: RHBZ1116945
e9b5f4
e9b5f4
* Fri Jan 24 2014 Daniel Mach <dmach@redhat.com> - 3.0.13-11
e9b5f4
- Mass rebuild 2014-01-24
e9b5f4
e9b5f4
* Fri Dec 27 2013 Daniel Mach <dmach@redhat.com> - 3.0.13-10
e9b5f4
- Mass rebuild 2013-12-27
e9b5f4
e9b5f4
* Wed Dec 18 2013 Deepak Bhole <dbhole@redhat.com> - 3.0.13-9
e9b5f4
- Added -fno-strict-aliasing (pointed out by rpmdiff)
e9b5f4
- Fixes RHBZ 1006261
e9b5f4
e9b5f4
* Fri Nov 15 2013 Jon VanAlten <jon.vanalten@redhat.com> - 3.0.13-8
e9b5f4
- Patch test suite to fix errors on ppc64
e9b5f4
- Fixes RHBZ 1006261
e9b5f4
e9b5f4
* Thu Aug 22 2013 Deepak Bhole <dbhole@redhat.com> - 3.0.13-7
e9b5f4
- Removed temporarily introduced compat package for OpenJDk6 bootstrap
e9b5f4
e9b5f4
* Wed Aug 21 2013 Deepak Bhole <dbhole@redhat.com> - 3.0.13-6
e9b5f4
- Temporarily build with a .so.5 compat package to allow OpenJDK6 bootstrap
e9b5f4
e9b5f4
* Mon Jul 15 2013 Jon VanAlten <jon.vanalten@redhat.com> - 3.0.13-5
e9b5f4
- Correct spec license
e9b5f4
e9b5f4
* Tue May 28 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-4
e9b5f4
- fix typos in wrapper headers
e9b5f4
e9b5f4
* Mon May 27 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-3
e9b5f4
- make header files multilib safe
e9b5f4
e9b5f4
* Sat May 25 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-2
e9b5f4
- fix incorrect header pathing (and .pc file)
e9b5f4
e9b5f4
* Wed Mar 20 2013 Anthony Green <green@redhat.com> - 3.0.13-1
e9b5f4
- update to 3.0.13
e9b5f4
e9b5f4
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.11-2
e9b5f4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
e9b5f4
e9b5f4
* Mon Jan 14 2013 Dennis Gilmore <dennis@ausil.us> - 3.0.11-1
e9b5f4
- update to 3.0.11
e9b5f4
e9b5f4
* Fri Nov 02 2012 Deepak Bhole <dbhole@redhat.com> - 3.0.10-4
e9b5f4
- Fixed source location
e9b5f4
e9b5f4
* Fri Aug 10 2012 Dennis Gilmore <dennis@ausil.us> - 3.0.10-3
e9b5f4
- drop back to 3.0.10, 3.0.11 was never pushed anywhere as the soname bump broke buildroots
e9b5f4
- as 3.0.11 never went out no epoch needed.
e9b5f4
e9b5f4
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.11-2
e9b5f4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
e9b5f4
e9b5f4
* Fri Apr 13 2012 Anthony Green <green@redhat.com> - 3.0.11-1
e9b5f4
- Upgrade to 3.0.11.
e9b5f4
e9b5f4
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.10-2
e9b5f4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
e9b5f4
e9b5f4
* Tue Aug 23 2011 Anthony Green <green@redhat.com> - 3.0.10-1
e9b5f4
- Upgrade to 3.0.10. 
e9b5f4
e9b5f4
* Fri Mar 18 2011 Dan HorĂ¡k <dan[at]danny.cz> - 3.0.9-3
e9b5f4
- added patch for being careful when defining relatively generic symbols
e9b5f4
e9b5f4
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.9-2
e9b5f4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
e9b5f4
e9b5f4
* Tue Dec 29 2009 Anthony Green <green@redhat.com> - 3.0.9-1
e9b5f4
- Upgrade
e9b5f4
e9b5f4
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-3
e9b5f4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
e9b5f4
e9b5f4
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-2
e9b5f4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
e9b5f4
e9b5f4
* Tue Jul 08 2008 Anthony Green <green@redhat.com> 3.0.5-1
e9b5f4
- Upgrade to 3.0.5
e9b5f4
e9b5f4
* Fri Feb 15 2008 Anthony Green <green@redhat.com> 3.0.1-1
e9b5f4
- Upgrade to 3.0.1
e9b5f4
e9b5f4
* Fri Feb 15 2008 Anthony Green <green@redhat.com> 2.99.9-1
e9b5f4
- Upgrade to 2.99.9
e9b5f4
- Require pkgconfig for the devel package.
e9b5f4
- Update summary.
e9b5f4
e9b5f4
* Fri Feb 15 2008 Anthony Green <green@redhat.com> 2.99.8-1
e9b5f4
- Upgrade to 2.99.8
e9b5f4
e9b5f4
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.7-1
e9b5f4
- Upgrade to 2.99.7
e9b5f4
e9b5f4
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.6-1
e9b5f4
- Upgrade to 2.99.6
e9b5f4
e9b5f4
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.4-1
e9b5f4
- Upgrade to 2.99.4
e9b5f4
e9b5f4
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.3-1
e9b5f4
- Upgrade to 2.99.3
e9b5f4
e9b5f4
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.2-1
e9b5f4
- Created.