Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/files/, dev-libs/libffi/
Date: Thu, 19 Sep 2019 07:30:05
Message-Id: 1568878190.8cd14f3d80746f350e6ffd103cb1f4629c625f2f.slyfox@gentoo
1 commit: 8cd14f3d80746f350e6ffd103cb1f4629c625f2f
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 19 07:29:10 2019 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 19 07:29:50 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8cd14f3d
7
8 dev-libs/libffi: backport emutramp fix to 3.2.1, bug #694916
9
10 Reported-by: spotlight <AT> joscomputing.space
11 Bug: https://bugs.gentoo.org/694916
12 Package-Manager: Portage-2.3.76, Repoman-2.3.17
13 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
14
15 .../libffi/files/libffi-3.2.1-musl-emutramp.patch | 31 ++++++++++
16 dev-libs/libffi/libffi-3.2.1-r3.ebuild | 70 ++++++++++++++++++++++
17 2 files changed, 101 insertions(+)
18
19 diff --git a/dev-libs/libffi/files/libffi-3.2.1-musl-emutramp.patch b/dev-libs/libffi/files/libffi-3.2.1-musl-emutramp.patch
20 new file mode 100644
21 index 00000000000..7c011d2b6d0
22 --- /dev/null
23 +++ b/dev-libs/libffi/files/libffi-3.2.1-musl-emutramp.patch
24 @@ -0,0 +1,31 @@
25 +https://github.com/libffi/libffi/commit/e169ba2b83c780058fe626856cfdb5903a85cb97.patch
26 +https://bugs.gentoo.org/694916
27 +
28 +From e169ba2b83c780058fe626856cfdb5903a85cb97 Mon Sep 17 00:00:00 2001
29 +From: Kylie McClain <somasis@×××××××.org>
30 +Date: Fri, 29 Apr 2016 21:04:07 -0400
31 +Subject: [PATCH] Fix usage on musl libc
32 +
33 +A gcc compiled on musl does not define __gnu_linux__, it defines __linux__.
34 +Only on glibc does __gnu_linux__ get defined, but both define __linux__, so
35 +we should check for that instead.
36 +
37 +With this patch, libffi works perfectly, and passes its testsuite entirely
38 +on musl libc systems.
39 +---
40 + src/closures.c | 2 +-
41 + 1 file changed, 1 insertion(+), 1 deletion(-)
42 +
43 +diff --git a/src/closures.c b/src/closures.c
44 +index 3dec0e31..05849e06 100644
45 +--- a/src/closures.c
46 ++++ b/src/closures.c
47 +@@ -35,7 +35,7 @@
48 + #include <ffi_common.h>
49 +
50 + #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
51 +-# if __gnu_linux__ && !defined(__ANDROID__)
52 ++# if __linux__ && !defined(__ANDROID__)
53 + /* This macro indicates it may be forbidden to map anonymous memory
54 + with both write and execute permission. Code compiled when this
55 + option is defined will attempt to map such pages once, but if it
56
57 diff --git a/dev-libs/libffi/libffi-3.2.1-r3.ebuild b/dev-libs/libffi/libffi-3.2.1-r3.ebuild
58 new file mode 100644
59 index 00000000000..45d1209a70d
60 --- /dev/null
61 +++ b/dev-libs/libffi/libffi-3.2.1-r3.ebuild
62 @@ -0,0 +1,70 @@
63 +# Copyright 1999-2019 Gentoo Authors
64 +# Distributed under the terms of the GNU General Public License v2
65 +
66 +EAPI=7
67 +inherit eutils libtool multilib multilib-minimal toolchain-funcs
68 +
69 +DESCRIPTION="a portable, high level programming interface to various calling conventions"
70 +HOMEPAGE="https://sourceware.org/libffi/"
71 +SRC_URI="ftp://sourceware.org/pub/${PN}/${P}.tar.gz"
72 +
73 +LICENSE="MIT"
74 +SLOT="0"
75 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
76 +IUSE="debug pax_kernel static-libs test"
77 +
78 +RDEPEND=""
79 +DEPEND="test? ( dev-util/dejagnu )"
80 +
81 +DOCS="ChangeLog* README"
82 +
83 +PATCHES=(
84 + "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
85 + "${FILESDIR}"/${PN}-3.2.1-complex_alpha.patch
86 + "${FILESDIR}"/${PN}-3.1-darwin-x32.patch
87 + "${FILESDIR}"/${PN}-3.2.1-complex-ia64.patch
88 + "${FILESDIR}"/${PN}-3.2.1-include-path.patch
89 + "${FILESDIR}"/${PN}-3.2.1-include-path-autogen.patch
90 + "${FILESDIR}"/${PN}-3.2.1-ia64-small-struct.patch #634190
91 + "${FILESDIR}"/${PN}-3.2.1-musl-emutramp.patch #694916
92 +)
93 +
94 +ECONF_SOURCE=${S}
95 +
96 +pkg_setup() {
97 + # Check for orphaned libffi, see https://bugs.gentoo.org/354903 for example
98 + if [[ ${ROOT} == "/" && ${EPREFIX} == "" ]] && ! has_version ${CATEGORY}/${PN}; then
99 + local base="${T}"/conftest
100 + echo 'int main() { }' > "${base}".c
101 + $(tc-getCC) -o "${base}" "${base}".c -lffi >&/dev/null
102 + if [ $? -eq 0 ]; then
103 + eerror "The linker reported linking against -lffi to be working while it shouldn't have."
104 + eerror "This is wrong and you should find and delete the old copy of libffi before continuing."
105 + die "The system is in inconsistent state with unknown libffi installed."
106 + fi
107 + fi
108 +}
109 +
110 +src_prepare() {
111 + default
112 +
113 + sed -i -e 's:@toolexeclibdir@:$(libdir):g' Makefile.in || die #462814
114 + elibtoolize
115 +}
116 +
117 +multilib_src_configure() {
118 + use userland_BSD && export HOST="${CHOST}"
119 + # python does not like miltilib-wrapped headers: bug #643582
120 + # thus we install includes into ABI-specific paths
121 + local includes="${EPREFIX}"/usr/$(get_libdir)/${P}/include/
122 + econf \
123 + $(use_enable static-libs static) \
124 + $(use_enable pax_kernel pax_emutramp) \
125 + $(use_enable debug) \
126 + --includedir="${includes}"
127 +}
128 +
129 +multilib_src_install_all() {
130 + prune_libtool_files
131 + einstalldocs
132 +}