libffi3.1/libffi3.1.spec

143 lines
4.9 KiB
RPMSpec

%bcond_with bootstrap
%global multilib_arches %{ix86} x86_64
Name: libffi3.1
Version: 3.1
# The last libffi-3.1 release was libffi-3.1-27, and so to help with the
# logical transition we label the compat package libffi3.1-3.1-28
# (next NEVRA bump) rather than the more confusing libffi3.1-3.1-1 since
# there was already a 3.1-1 on May 19, 2014.
Release: 28%{?dist}
Summary: A portable foreign function interface library
License: MIT
URL: http://sourceware.org/libffi
Source0: ftp://sourceware.org/pub/libffi/libffi-%{version}.tar.gz
Source1: ffi-multilib.h
Source2: ffitarget-multilib.h
Patch0: libffi-3.1-fix-include-path.patch
Patch1: libffi-3.1-fix-exec-stack.patch
Patch2: libffi-aarch64-rhbz1174037.patch
Patch3: libffi-3.1-aarch64-fix-exec-stack.patch
Patch4: libffi-3.1-libffi_tmpdir.patch
Patch5: libffi3.1-pkgconfig.patch
BuildRequires: gcc
%if %{without bootstrap}
BuildRequires: gcc-c++
BuildRequires: dejagnu
%endif
%description
The %{name} package provides the "libffi" library at version 3.1
which provides the shared object (SONAME) "libffi.so.6" for all
objects that require that library version. This is a compatibility
library and packages should be compiling against the latest version
of the "libffi" library using the libffi-devel (not %{name})
package.
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}
Requires: %{name} = %{version}-%{release}
Requires: pkgconfig
%description devel
This is a compatibility library and packages should be compiling
against the latest version of the "libffi" library using the
libffi-devel (not %{name}-devel) package.
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%prep
%setup -q -n libffi-3.1
%patch0 -p1 -b .fixpath
%patch1 -p1 -b .execstack
%patch2 -p1 -b .aarch64
%patch3 -p1 -b .aarch64execstack
%patch4 -p1 -b .libffitmpdir
%patch5 -p1 -b .pkgconfig
%build
%configure --disable-static --includedir=%{_includedir}/libffi3.1
%make_build
%check
%if %{without bootstrap}
%make_build check
%endif
%install
%make_install
find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
# Determine generic arch target name for multilib wrapper
basearch=%{_arch}
%ifarch %{ix86}
basearch=i386
%endif
mkdir -p $RPM_BUILD_ROOT%{_includedir}/libffi3.1
%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%{_libdir}/libffi-%{version}/include/$i.h $RPM_BUILD_ROOT%{_includedir}/libffi3.1/$i-${basearch}.h
done
install -m644 %{SOURCE1} $RPM_BUILD_ROOT%{_includedir}/libffi3.1/ffi.h
install -m644 %{SOURCE2} $RPM_BUILD_ROOT%{_includedir}/libffi3.1/ffitarget.h
%else
mv $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}/include/{ffi,ffitarget}.h $RPM_BUILD_ROOT%{_includedir}/libffi3.1
%endif
rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi-%{version}
rm -rf $RPM_BUILD_ROOT%{_libdir}/libffi.so
find $RPM_BUILD_ROOT%{_mandir} -name 'ffi*' -exec rm -f {} ';'
find $RPM_BUILD_ROOT%{_infodir} -name 'libffi.info*' -exec rm -f {} ';'
mv $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libffi.pc $RPM_BUILD_ROOT%{_libdir}/pkgconfig/libffi3.1.pc
%ldconfig_scriptlets
%files
%license LICENSE
%doc README
%{_libdir}/libffi.so.6.0.2
%{_libdir}/libffi.so.6
%files devel
%{_libdir}/pkgconfig/*.pc
%{_includedir}/libffi3.1/ffi*.h
%changelog
* Tue Dec 08 2020 Carlos O'Donell <carlos@redhat.com> 3.1-28
- Created compatibility libffi3.1 package.