make header files multilib safe

This commit is contained in:
Tom Callaway 2013-05-27 15:55:41 -04:00
parent c6030192ad
commit 5a0f802724
3 changed files with 71 additions and 1 deletions

23
ffi-multilib.h Normal file
View File

@ -0,0 +1,23 @@
/* This file is here to prevent a file conflict on multiarch systems. */
#ifdef ffi_wrapper_h
#error "Do not define ffi_wrapper_h!"
#endif
#define ffi_wrapper_h
#elif defined(__i386__)
#include "ffi-i386.h"
#elif defined(__powerpc64__)
#include "ffi-ppc64.h"
#elif defined(__powerpc__)
#include "ffi-ppc.h"
#elif defined(__s390x__)
#include "ffi-s390x.h"
#elif defined(__s390__)
#include "ffi-s390.h"
#elif defined(__x86_64__)
#include "ffi-x86_64.h"
#else
#error "The libffi-devel package is not usable with the architecture."
#endif
#undef ffi_wrapper_h

23
ffitarget-multilib.h Normal file
View File

@ -0,0 +1,23 @@
/* This file is here to prevent a file conflict on multiarch systems. */
#ifdef ffitarget_wrapper_h
#error "Do not define ffitarget_wrapper_h!"
#endif
#define ffitarget_wrapper_h
#elif defined(__i386__)
#include "ffitarget-i386.h"
#elif defined(__powerpc64__)
#include "ffitarget-ppc64.h"
#elif defined(__powerpc__)
#include "ffitarget-ppc.h"
#elif defined(__s390x__)
#include "ffitarget-s390x.h"
#elif defined(__s390__)
#include "ffitarget-s390.h"
#elif defined(__x86_64__)
#include "ffitarget-x86_64.h"
#else
#error "The libffi-devel package is not usable with the architecture."
#endif
#undef ffitarget_wrapper_h

View File

@ -1,6 +1,8 @@
%global multilib_arches %{ix86} ppc %{power64} s390 s390x x86_64
Name: libffi Name: libffi
Version: 3.0.13 Version: 3.0.13
Release: 2%{?dist} Release: 3%{?dist}
Summary: A portable foreign function interface library Summary: A portable foreign function interface library
Group: System Environment/Libraries Group: System Environment/Libraries
@ -8,6 +10,8 @@ License: BSD
URL: http://sourceware.org/libffi URL: http://sourceware.org/libffi
Source0: ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz Source0: ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz
# part of upstream commit 5feacad4 # part of upstream commit 5feacad4
Source1: ffi-multilib.h
Source2: ffitarget-multilib.h
Patch0: libffi-3.0.13-fix-include-path.patch Patch0: libffi-3.0.13-fix-include-path.patch
# part of upstream commit 5feacad4 # part of upstream commit 5feacad4
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -69,6 +73,23 @@ make install DESTDIR=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
rm -f $RPM_BUILD_ROOT%{_infodir}/dir rm -f $RPM_BUILD_ROOT%{_infodir}/dir
# Determine generic arch target name for multilib wrapper
basearch=%{_arch}
%ifarch %{ix86}
basearch=i386
%endif
%ifarch %{multilib_arches}
# Do header file switcheroo to avoid file conflicts on systems where you
# can have both a 32- and 64-bit version of the library, and they each need
# their own correct-but-different versions of the headers to be usable.
for i in ffi ffitarget; do
mv $RPM_BUILD_ROOT%{_includedir}/$i.h $RPM_BUILD_ROOT%{_includedir}/$i-${basearch}.h
done
install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/ffi.h
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/ffitarget.h
%endif
%clean %clean
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
@ -101,6 +122,9 @@ fi
%{_infodir}/libffi.info.gz %{_infodir}/libffi.info.gz
%changelog %changelog
* Mon May 27 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-3
- make header files multilib safe
* Sat May 25 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-2 * Sat May 25 2013 Tom Callaway <spot@fedoraproject.org> - 3.0.13-2
- fix incorrect header pathing (and .pc file) - fix incorrect header pathing (and .pc file)