Create libffi3.1 compat package.
This commit is contained in:
parent
239cba8cb1
commit
04f1ae62fc
|
@ -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
|
||||
|
||||
#if 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
|
|
@ -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
|
||||
|
||||
#if 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
|
|
@ -0,0 +1,11 @@
|
|||
--- a/src/aarch64/sysv.S
|
||||
+++ b/src/aarch64/sysv.S
|
||||
@@ -396,3 +396,8 @@
|
||||
#ifdef __ELF__
|
||||
.size CNAME(ffi_closure_SYSV), .-CNAME(ffi_closure_SYSV)
|
||||
#endif
|
||||
+
|
||||
+#if defined __ELF__ && defined __linux__
|
||||
+ .section .note.GNU-stack,"",%progbits
|
||||
+#endif
|
||||
+
|
|
@ -0,0 +1,31 @@
|
|||
From 978c9540154d320525488db1b7049277122f736d Mon Sep 17 00:00:00 2001
|
||||
From: Samuli Suominen <ssuominen@gentoo.org>
|
||||
Date: Sat, 31 May 2014 08:53:10 -0400
|
||||
Subject: [PATCH] Add missing GNU stack markings in win32.S
|
||||
|
||||
---
|
||||
src/x86/win32.S | 6 +++++-
|
||||
1 file changed, 5 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/x86/win32.S b/src/x86/win32.S
|
||||
index daf0e79..e42baf2 100644
|
||||
--- a/src/x86/win32.S
|
||||
+++ b/src/x86/win32.S
|
||||
@@ -1,5 +1,6 @@
|
||||
/* -----------------------------------------------------------------------
|
||||
- win32.S - Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc.
|
||||
+ win32.S - Copyright (c) 2014 Anthony Green
|
||||
+ Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc.
|
||||
Copyright (c) 2001 John Beniton
|
||||
Copyright (c) 2002 Ranjit Mathew
|
||||
Copyright (c) 2009 Daniel Witte
|
||||
@@ -1304,3 +1305,6 @@ L_ffi_closure_SYSV_inner$stub:
|
||||
|
||||
#endif /* !_MSC_VER */
|
||||
|
||||
+#if defined __ELF__ && defined __linux__
|
||||
+ .section .note.GNU-stack,"",@progbits
|
||||
+#endif
|
||||
--
|
||||
1.9.3
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
diff -up libffi-3.1/libffi.pc.in.fixpath libffi-3.1/libffi.pc.in
|
||||
--- libffi-3.1/libffi.pc.in.fixpath 2014-04-25 19:45:13.000000000 +0200
|
||||
+++ libffi-3.1/libffi.pc.in 2014-06-12 12:06:06.000000000 +0200
|
||||
@@ -1,11 +1,10 @@
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
-toolexeclibdir=@toolexeclibdir@
|
||||
-includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
|
||||
+includedir=@includedir@
|
||||
|
||||
Name: @PACKAGE_NAME@
|
||||
Description: Library supporting Foreign Function Interfaces
|
||||
Version: @PACKAGE_VERSION@
|
||||
-Libs: -L${toolexeclibdir} -lffi
|
||||
+Libs: -L${libdir} -lffi
|
||||
Cflags: -I${includedir}
|
|
@ -0,0 +1,17 @@
|
|||
Most temp file directories need to be hardened against execution, but
|
||||
libffi needs execute privileges. Add a libffi-specific temp directory
|
||||
that can be set up by sysadmins as needed with suitable permissions.
|
||||
This both ensures that libffi will have a valid temp directory to use
|
||||
as well as preventing attempts to access other directories.
|
||||
|
||||
diff -rup a/src/closures.c b/src/closures.c
|
||||
--- a/src/closures.c 2014-05-11 09:54:19.000000000 -0400
|
||||
+++ b/src/closures.c 2020-04-29 20:50:00.454853909 -0400
|
||||
@@ -362,6 +362,7 @@ static struct
|
||||
const char *arg;
|
||||
int repeat;
|
||||
} open_temp_exec_file_opts[] = {
|
||||
+ { open_temp_exec_file_env, "LIBFFI_TMPDIR", 0 },
|
||||
{ open_temp_exec_file_env, "TMPDIR", 0 },
|
||||
{ open_temp_exec_file_dir, "/tmp", 0 },
|
||||
{ open_temp_exec_file_dir, "/var/tmp", 0 },
|
|
@ -0,0 +1,11 @@
|
|||
--- libffi-3.1/src/aarch64/ffi.c.orig 2014-04-25 18:45:13.000000000 +0100
|
||||
+++ libffi-3.1/src/aarch64/ffi.c 2015-01-15 02:36:56.314906455 +0000
|
||||
@@ -728,7 +728,7 @@
|
||||
state.ngrn = N_X_ARG_REG;
|
||||
|
||||
memcpy (allocate_to_stack (&state, stack, ty->alignment,
|
||||
- ty->size), ecif->avalue + i, ty->size);
|
||||
+ ty->size), ecif->avalue[i], ty->size);
|
||||
}
|
||||
break;
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
diff -rup a/libffi.pc.in b/libffi.pc.in
|
||||
--- a/libffi.pc.in 2020-12-02 15:33:14.076549606 -0500
|
||||
+++ b/libffi.pc.in 2020-12-02 16:11:42.855654638 -0500
|
||||
@@ -6,5 +6,5 @@ includedir=@includedir@
|
||||
Name: @PACKAGE_NAME@
|
||||
Description: Library supporting Foreign Function Interfaces
|
||||
Version: @PACKAGE_VERSION@
|
||||
-Libs: -L${libdir} -lffi
|
||||
+Libs: -L${libdir} libffi.so.6
|
||||
Cflags: -I${includedir}
|
||||
Only in b: libffi.pc.in~
|
|
@ -0,0 +1,142 @@
|
|||
%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.
|
Loading…
Reference in New Issue