71e48fa
%global multilib_arches %{ix86} ppc ppc64 ppc64p7 s390 s390x x86_64
5a0f802
852f77e
Name:		libffi
Anthony Green 1bd5eb5
Version:	3.1
4d6c708
Release:	7%{?dist}
852f77e
Summary:	A portable foreign function interface library
852f77e
852f77e
Group:		System Environment/Libraries
852f77e
License:	BSD
852f77e
URL:		http://sourceware.org/libffi
13e42c2
Source0:	ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz
5a0f802
Source1:	ffi-multilib.h
5a0f802
Source2:	ffitarget-multilib.h
Anthony Green 1bd5eb5
Patch0:		libffi-3.1-fix-include-path.patch
Anthony Green fe5ad41
Patch1:		libffi-3.1-fix-exec-stack.patch
4d6c708
Patch2:		libffi-aarch64-rhbz1174037.patch
852f77e
852f77e
%description
852f77e
Compilers for high level languages generate code that follow certain
852f77e
conventions.  These conventions are necessary, in part, for separate
852f77e
compilation to work.  One such convention is the "calling convention".
852f77e
The calling convention is a set of assumptions made by the compiler
852f77e
about where function arguments will be found on entry to a function.  A
852f77e
calling convention also specifies where the return value for a function
852f77e
is found.  
852f77e
852f77e
Some programs may not know at the time of compilation what arguments
852f77e
are to be passed to a function.  For instance, an interpreter may be
852f77e
told at run-time about the number and types of arguments used to call a
852f77e
given function.  `Libffi' can be used in such programs to provide a
852f77e
bridge from the interpreter program to compiled code.
852f77e
852f77e
The `libffi' library provides a portable, high level programming
852f77e
interface to various calling conventions.  This allows a programmer to
852f77e
call any function specified by a call interface description at run time.
852f77e
852f77e
FFI stands for Foreign Function Interface.  A foreign function
852f77e
interface is the popular name for the interface that allows code
852f77e
written in one language to call code written in another language.  The
852f77e
`libffi' library really only provides the lowest, machine dependent
852f77e
layer of a fully featured foreign function interface.  A layer must
852f77e
exist above `libffi' that handles type conversions for values passed
852f77e
between the two languages.  
852f77e
852f77e
852f77e
%package	devel
852f77e
Summary:	Development files for %{name}
852f77e
Group:		Development/Libraries
852f77e
Requires:	%{name} = %{version}-%{release}
852f77e
Requires:       pkgconfig
852f77e
Requires(post): /sbin/install-info
852f77e
Requires(preun): /sbin/install-info
852f77e
852f77e
%description	devel
852f77e
The %{name}-devel package contains libraries and header files for
852f77e
developing applications that use %{name}.
852f77e
852f77e
852f77e
%prep
852f77e
%setup -q
f8dded0
%patch0 -p1 -b .fixpath
Anthony Green fe5ad41
%patch1 -p1 -b .execstack
4d6c708
%patch2 -p1 -b .aarch64
852f77e
852f77e
852f77e
%build
852f77e
%configure --disable-static
852f77e
make %{?_smp_mflags}
852f77e
852f77e
852f77e
%install
852f77e
make install DESTDIR=$RPM_BUILD_ROOT
852f77e
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
852f77e
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
852f77e
5a0f802
# Determine generic arch target name for multilib wrapper
5a0f802
basearch=%{_arch}
5a0f802
%ifarch %{ix86}
5a0f802
basearch=i386
5a0f802
%endif
5a0f802
71e48fa
mkdir -p $RPM_BUILD_ROOT%{_includedir}
5a0f802
%ifarch %{multilib_arches}
5a0f802
# Do header file switcheroo to avoid file conflicts on systems where you
5a0f802
# can have both a 32- and 64-bit version of the library, and they each need
5a0f802
# their own correct-but-different versions of the headers to be usable.
5a0f802
for i in ffi ffitarget; do
Anthony Green 1bd5eb5
  mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/$i.h $RPM_BUILD_ROOT%{_includedir}/$i-${basearch}.h
5a0f802
done
5a0f802
install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/ffi.h
5a0f802
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h
Anthony Green b3340e8
%else
71e48fa
mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/{ffi,ffitarget}.h $RPM_BUILD_ROOT%{_includedir}
5a0f802
%endif
Anthony Green b3340e8
rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}
852f77e
852f77e
852f77e
%post -p /sbin/ldconfig
852f77e
852f77e
%post devel
852f77e
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/libffi.info.gz
852f77e
852f77e
%preun devel
852f77e
if [ $1 = 0 ] ;then
852f77e
  /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/libffi.info.gz
852f77e
fi
852f77e
852f77e
%postun -p /sbin/ldconfig
852f77e
852f77e
852f77e
%files
4c18369
%{!?_licensedir:%global license %%doc}
4c18369
%license LICENSE
4c18369
%doc README
852f77e
%{_libdir}/*.so.*
852f77e
852f77e
%files devel
852f77e
%{_libdir}/pkgconfig/*.pc
c603019
%{_includedir}/ffi*.h
852f77e
%{_libdir}/*.so
852f77e
%{_mandir}/man3/*.gz
852f77e
%{_infodir}/libffi.info.gz
852f77e
852f77e
%changelog
4d6c708
* Thu Jan 15 2015 Peter Robinson <pbrobinson@fedoraproject.org> 3.1-7
4d6c708
- Add patch to fix issues on aarch64 (rhbz 1174037)
4d6c708
0936745
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1-6
0936745
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
0936745
4c18369
* Thu Jul 17 2014 Tom Callaway <spot@fedoraproject.org> - 3.1-5
4c18369
- fix license handling
4c18369
Anthony Green fe5ad41
* Sun Jun 29 2014 Anthony Green <green@redhat.com> - 3.1-4
Anthony Green fe5ad41
- fix exec stack problem on 32-bit build
Anthony Green fe5ad41
a41ac6e
* Thu Jun 12 2014 Dan Horák <dan[at]danny.cz> - 3.1-3
a41ac6e
- fix header path in pkgconfig file
a41ac6e
450db82
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1-2
450db82
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
450db82
Anthony Green b3340e8
* Mon May 19 2014 Anthony Green <green@redhat.com> - 3.1-1
Anthony Green b3340e8
- fix non-multiarch builds (arm).
Anthony Green b3340e8
Anthony Green 1bd5eb5
* Mon May 19 2014 Anthony Green <green@redhat.com> - 3.1-0
Anthony Green 1bd5eb5
- update to 3.1.
Anthony Green 1bd5eb5
a06c6a6
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.13-5
a06c6a6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
a06c6a6
1c448e5
* Tue May 28 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-4
1c448e5
- fix typos in wrapper headers
1c448e5
5a0f802
* Mon May 27 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-3
5a0f802
- make header files multilib safe
5a0f802
c603019
* Sat May 25 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-2
c603019
- fix incorrect header pathing (and .pc file)
c603019
Anthony Green f05ce37
* Wed Mar 20 2013 Anthony Green <green@redhat.com> - 3.0.13-1
Anthony Green f05ce37
- update to 3.0.13
Anthony Green f05ce37
bf88038
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.11-2
bf88038
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
bf88038
c4152dc
* Mon Jan 14 2013 Dennis Gilmore <dennis@ausil.us> - 3.0.11-1
c4152dc
- update to 3.0.11
c4152dc
13e42c2
* Fri Nov 02 2012 Deepak Bhole <dbhole@redhat.com> - 3.0.10-4
13e42c2
- Fixed source location
13e42c2
356a806
* Fri Aug 10 2012 Dennis Gilmore <dennis@ausil.us> - 3.0.10-3
356a806
- drop back to 3.0.10, 3.0.11 was never pushed anywhere as the soname bump broke buildroots
356a806
- as 3.0.11 never went out no epoch needed.
356a806
d65ba29
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.11-2
d65ba29
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
d65ba29
Anthony Green 2d5d2b1
* Fri Apr 13 2012 Anthony Green <green@redhat.com> - 3.0.11-1
Anthony Green 2d5d2b1
- Upgrade to 3.0.11.
Anthony Green 2d5d2b1
3b0df0a
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.10-2
3b0df0a
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
3b0df0a
Anthony Green 2919e3e
* Tue Aug 23 2011 Anthony Green <green@redhat.com> - 3.0.10-1
Anthony Green 2919e3e
- Upgrade to 3.0.10. 
Anthony Green 2919e3e
a95b47f
* Fri Mar 18 2011 Dan Horák <dan[at]danny.cz> - 3.0.9-3
a95b47f
- added patch for being careful when defining relatively generic symbols
a95b47f
ef8a313
* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.9-2
ef8a313
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
ef8a313
bce594c
* Tue Dec 29 2009 Anthony Green <green@redhat.com> - 3.0.9-1
bce594c
- Upgrade
bce594c
26f44d9
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-3
26f44d9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
26f44d9
6f19f43
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.5-2
6f19f43
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
6f19f43
cc7083f
* Tue Jul 08 2008 Anthony Green <green@redhat.com> 3.0.5-1
cc7083f
- Upgrade to 3.0.5
cc7083f
2375866
* Fri Feb 15 2008 Anthony Green <green@redhat.com> 3.0.1-1
2375866
- Upgrade to 3.0.1
2375866
852f77e
* Fri Feb 15 2008 Anthony Green <green@redhat.com> 2.99.9-1
852f77e
- Upgrade to 2.99.9
852f77e
- Require pkgconfig for the devel package.
852f77e
- Update summary.
852f77e
852f77e
* Fri Feb 15 2008 Anthony Green <green@redhat.com> 2.99.8-1
852f77e
- Upgrade to 2.99.8
852f77e
852f77e
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.7-1
852f77e
- Upgrade to 2.99.7
852f77e
852f77e
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.6-1
852f77e
- Upgrade to 2.99.6
852f77e
852f77e
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.4-1
852f77e
- Upgrade to 2.99.4
852f77e
852f77e
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.3-1
852f77e
- Upgrade to 2.99.3
852f77e
852f77e
* Thu Feb 14 2008 Anthony Green <green@redhat.com> 2.99.2-1
852f77e
- Created.