%define gitdate 20110211 Name: libffi Version: 3.0.10rc4 Release: 1 Summary: A portable foreign function interface library Group: System Environment/Libraries License: BSD URL: http://sourceware.org/libffi Source0: http://sourceware.org/libffi/%{name}-%{gitdate}.tar.bz2 Patch0: %{name}-%{gitdate}-aix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: gcc >= 4.2.3-2 Requires: libgcc >= 4.2.3-2 %define _libdir64 %{_prefix}/lib64 %description Compilers for high level languages generate code that follow certain conventions. These conventions are necessary, in part, for separate compilation to work. One such convention is the "calling convention". The calling convention is a set of assumptions made by the compiler about where function arguments will be found on entry to a function. A calling convention also specifies where the return value for a function is found. Some programs may not know at the time of compilation what arguments are to be passed to a function. For instance, an interpreter may be told at run-time about the number and types of arguments used to call a given function. `Libffi' can be used in such programs to provide a bridge from the interpreter program to compiled code. The `libffi' library provides a portable, high level programming interface to various calling conventions. This allows a programmer to call any function specified by a call interface description at run time. FFI stands for Foreign Function Interface. A foreign function interface is the popular name for the interface that allows code written in one language to call code written in another language. The `libffi' library really only provides the lowest, machine dependent layer of a fully featured foreign function interface. A layer must exist above `libffi' that handles type conversions for values passed between the two languages. %package devel Summary: Development files for %{name} Group: Development/Libraries Requires: %{name} = %{version}-%{release} Requires: pkg-config Requires: /sbin/install-info, info %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %prep %setup -q -n %{name}-%{gitdate} %patch0 mkdir ../32bit mv * ../32bit mv ../32bit . mkdir 64bit cp -r 32bit/* 64bit/ %build # setup GNU GCC build environment export CFLAGS="-DSYSV -D_AIX -D_AIX32 -D_AIX41 -D_AIX43 -D_AIX51 -D_ALL_SOURCE -DFUNCPROTO=15 -O -I/opt/freeware/include" cd 64bit # first build the 64-bit version # on purpose we configure the "--build=powerpc-ibm-aix5.1.0.0" option # differently from what config.guess provides export OBJECT_MODE=64 export CC="gcc -maix64 -mcpu=power3" export LDFLAGS="-L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000" ./configure \ --build=powerpc-ibm-aix5.1.0.0 \ --prefix=%{_prefix} \ --libdir=%{_libdir64} \ --infodir=%{_infodir} \ --mandir=%{_mandir} \ --enable-shared --disable-static make %{?_smp_mflags} cd ../32bit # now build the 32-bit version # on purpose we configure the "--build=powerpc-ibm-aix5.1.0.0" option # differently from what config.guess provides export OBJECT_MODE=32 export CC="gcc -maix32 -mcpu=power3" export LDFLAGS="-L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000" ./configure \ --build=powerpc-ibm-aix5.1.0.0 \ --prefix=%{_prefix} \ --infodir=%{_infodir} \ --mandir=%{_mandir} \ --enable-shared --disable-static make %{?_smp_mflags} %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} cd 64bit export OBJECT_MODE=64 make install DESTDIR=${RPM_BUILD_ROOT} cd ../32bit export OBJECT_MODE=32 make install DESTDIR=${RPM_BUILD_ROOT} mv ${RPM_BUILD_ROOT}%{_libdir}/%{name}-%{version}/include ${RPM_BUILD_ROOT}%{_prefix} rmdir ${RPM_BUILD_ROOT}%{_libdir}/%{name}-%{version} gzip --best ${RPM_BUILD_ROOT}%{_infodir}/*.info rm -f ${RPM_BUILD_ROOT}%{_infodir}/dir ( cd ${RPM_BUILD_ROOT}%{_libdir64} for f in *.a ; do /usr/bin/ar -X64 -x ${f} done cd ${RPM_BUILD_ROOT}%{_libdir} for f in *.a ; do /usr/bin/ar -X32 -x ${f} done ) # add the 64-bit shared objects to the shared libraries containing already the # 32-bit shared objects /usr/bin/ar -X64 -q ${RPM_BUILD_ROOT}%{_libdir}/%{name}.a ${RPM_BUILD_ROOT}%{_libdir64}/%{name}.so* ( cd ${RPM_BUILD_ROOT} for dir in include lib lib64 do mkdir -p usr/${dir} cd usr/${dir} ln -sf ../..%{_prefix}/${dir}/* . cd - done ) %post devel /sbin/install-info %{_infodir}/%{name}.info.gz %{_infodir}/dir || : %preun devel if [ $1 = 0 ] ; then /sbin/install-info --delete %{_infodir}/%{name}.info.gz %{_infodir}/dir || : fi %clean [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} %files %defattr(-,root,system,-) %doc 32bit/LICENSE 32bit/README %{_libdir}/*.a %{_libdir}/*.so* %{_libdir64}/*.so* /usr/lib/*.a /usr/lib/*.so* /usr/lib64/*.so* %files devel %defattr(-,root,system,-) %{_includedir}/* %{_libdir}/*.la %{_libdir64}/*.la %{_libdir}/pkgconfig/*.pc %{_libdir64}/pkgconfig/*.pc %{_mandir}/man3/* %{_infodir}/%{name}.info.gz /usr/include/* /usr/lib/*.la /usr/lib64/*.la %changelog * Fri Feb 11 2011 Michael Perzl - 3.0.10rc4-1 - updated to git version 2011.02.11 (3.0.10rc4) * Wed Feb 17 2010 Michael Perzl - 3.0.9-1 - updated to version 3.0.9 * Fri Aug 28 2009 Michael Perzl - 3.0.8-1 - first version for AIX V5.1 and higher, added the 64-bit AIX patch - from http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35484