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-compat/files/, dev-libs/libffi-compat/
Date: Tue, 01 Oct 2019 19:29:23
Message-Id: 1569958149.150f49cdb500318a543afebda095b3127fdc7f95.slyfox@gentoo
1 commit: 150f49cdb500318a543afebda095b3127fdc7f95
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 1 19:28:34 2019 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 1 19:29:09 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=150f49cd
7
8 dev-libs/libffi-compat: new package, provides libffi.so.6
9
10 There are still a few binary-only packages out there that rely on
11 'libffi.so.6' presence. This package provides these libraries.
12 No development headers here. Thus this library can co-exist with
13 dev-libs/libffi:0/7 package.
14
15 Ebuild is based on dev-libs/libffi. We can fast-stabilize it if
16 in-tree stable packages do rely on libffi.so.6 (they should not).
17
18 The patch is almost entirely by Timo Rothenpieler.
19 I renamed a package and made a few minor tweaks.
20
21 Fix-by: Timo Rothenpieler
22 Reported-by: Timo Rothenpieler
23 Closes: https://bugs.gentoo.org/695964
24 Package-Manager: Portage-2.3.76, Repoman-2.3.17
25 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
26
27 dev-libs/libffi-compat/Manifest | 1 +
28 .../files/libffi-3.1-darwin-x32.patch | 22 +++++++
29 .../files/libffi-3.2.1-complex-ia64.patch | 41 ++++++++++++
30 .../files/libffi-3.2.1-complex_alpha.patch | 20 ++++++
31 .../files/libffi-3.2.1-ia64-small-struct.patch | 74 ++++++++++++++++++++++
32 .../files/libffi-3.2.1-include-path-autogen.patch | 56 ++++++++++++++++
33 .../files/libffi-3.2.1-include-path.patch | 39 ++++++++++++
34 .../files/libffi-3.2.1-musl-emutramp.patch | 31 +++++++++
35 .../files/libffi-3.2.1-o-tmpfile-eacces.patch | 17 +++++
36 .../libffi-compat/libffi-compat-3.2.1-r3.ebuild | 52 +++++++++++++++
37 dev-libs/libffi-compat/metadata.xml | 42 ++++++++++++
38 11 files changed, 395 insertions(+)
39
40 diff --git a/dev-libs/libffi-compat/Manifest b/dev-libs/libffi-compat/Manifest
41 new file mode 100644
42 index 00000000000..f77899f0229
43 --- /dev/null
44 +++ b/dev-libs/libffi-compat/Manifest
45 @@ -0,0 +1 @@
46 +DIST libffi-3.2.1.tar.gz 940837 BLAKE2B d202ccaa185acfd2476ed2a9b011891507cd8efbbda60f67c583268d1563853442ed829acecbf81c9b6b9a930345780bb7a4bd80e71e50ef544c7f4eab8cb01f SHA512 980ca30a8d76f963fca722432b1fe5af77d7a4e4d2eac5144fbc5374d4c596609a293440573f4294207e1bdd9fda80ad1e1cafb2ffb543df5a275bc3bd546483
47
48 diff --git a/dev-libs/libffi-compat/files/libffi-3.1-darwin-x32.patch b/dev-libs/libffi-compat/files/libffi-3.1-darwin-x32.patch
49 new file mode 100644
50 index 00000000000..e5f100e5672
51 --- /dev/null
52 +++ b/dev-libs/libffi-compat/files/libffi-3.1-darwin-x32.patch
53 @@ -0,0 +1,22 @@
54 +https://bugs.gentoo.org/show_bug.cgi?id=513428
55 +https://bugs.gentoo.org/show_bug.cgi?id=536764
56 +https://trac.macports.org/ticket/44170
57 +
58 +--- libffi-3.2.1/src/x86/win32.S
59 ++++ libffi-3.2.1/src/x86/win32.S
60 +@@ -1184,7 +1184,6 @@
61 +
62 + #if defined(X86_WIN32) && !defined(__OS2__)
63 + .section .eh_frame,"w"
64 +-#endif
65 + .Lframe1:
66 + .LSCIE1:
67 + .long .LECIE1-.LASCIE1 /* Length of Common Information Entry */
68 +@@ -1343,6 +1342,7 @@
69 + /* End of DW_CFA_xxx CFI instructions. */
70 + .align 4
71 + .LEFDE5:
72 ++#endif /* defined(X86_WIN32) && !defined(__OS2__), for the eh_frame */
73 +
74 + #endif /* !_MSC_VER */
75 +
76
77 diff --git a/dev-libs/libffi-compat/files/libffi-3.2.1-complex-ia64.patch b/dev-libs/libffi-compat/files/libffi-3.2.1-complex-ia64.patch
78 new file mode 100644
79 index 00000000000..fd5c1ea4b28
80 --- /dev/null
81 +++ b/dev-libs/libffi-compat/files/libffi-3.2.1-complex-ia64.patch
82 @@ -0,0 +1,41 @@
83 +ia64: fix small struct handling (missing complex type entry)
84 +
85 +commit 6e8a4460833594d5af1b4539178025da0077df19
86 +added FFI_TYPE_COMPLEX value type (comes after FFI_TYPE_POINTER)
87 +
88 +ia64 ffi_closure_unix reiles on the ordering of
89 +types as ia64 has ia64-specific FFI types:
90 +small struct and others.
91 +
92 +As a result all tests handling small structs broke.
93 +
94 +The change fixes dispatch table by ignoring FFI_TYPE_COMPLEX.
95 +This has positive effect of unbreaking most tests:
96 +
97 + === libffi Summary ===
98 +
99 +-# of expected passes 1595
100 +-# of unexpected failures 295
101 ++# of expected passes 1930
102 ++# of unexpected failures 10
103 + # of unsupported tests 30
104 +
105 +Bug: https://bugs.gentoo.org/634190
106 +--- a/src/ia64/unix.S
107 ++++ b/src/ia64/unix.S
108 +@@ -529,6 +529,7 @@ ffi_closure_unix:
109 + data8 @pcrel(.Lst_int64) // FFI_TYPE_SINT64
110 + data8 @pcrel(.Lst_void) // FFI_TYPE_STRUCT
111 + data8 @pcrel(.Lst_int64) // FFI_TYPE_POINTER
112 ++ data8 @pcrel(.Lst_void) // FFI_TYPE_COMPLEX (not implemented)
113 + data8 @pcrel(.Lst_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT
114 + data8 @pcrel(.Lst_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT
115 + data8 @pcrel(.Lst_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE
116 +@@ -550,6 +551,7 @@ ffi_closure_unix:
117 + data8 @pcrel(.Lld_int) // FFI_TYPE_SINT64
118 + data8 @pcrel(.Lld_void) // FFI_TYPE_STRUCT
119 + data8 @pcrel(.Lld_int) // FFI_TYPE_POINTER
120 ++ data8 @pcrel(.Lld_void) // FFI_TYPE_COMPLEX (not implemented)
121 + data8 @pcrel(.Lld_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT
122 + data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT
123 + data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE
124
125 diff --git a/dev-libs/libffi-compat/files/libffi-3.2.1-complex_alpha.patch b/dev-libs/libffi-compat/files/libffi-3.2.1-complex_alpha.patch
126 new file mode 100644
127 index 00000000000..5e8c943eee3
128 --- /dev/null
129 +++ b/dev-libs/libffi-compat/files/libffi-3.2.1-complex_alpha.patch
130 @@ -0,0 +1,20 @@
131 +--- a/src/alpha/osf.S.orig 2015-01-16 10:46:15.000000000 +0100
132 ++++ b/src/alpha/osf.S 2015-01-16 10:46:24.000000000 +0100
133 +@@ -279,6 +279,7 @@
134 + .gprel32 $load_64 # FFI_TYPE_SINT64
135 + .gprel32 $load_none # FFI_TYPE_STRUCT
136 + .gprel32 $load_64 # FFI_TYPE_POINTER
137 ++ .gprel32 $load_none # FFI_TYPE_COMPLEX
138 +
139 + /* Assert that the table above is in sync with ffi.h. */
140 +
141 +@@ -294,7 +295,8 @@
142 + || FFI_TYPE_SINT64 != 12 \
143 + || FFI_TYPE_STRUCT != 13 \
144 + || FFI_TYPE_POINTER != 14 \
145 +- || FFI_TYPE_LAST != 14
146 ++ || FFI_TYPE_COMPLEX != 15 \
147 ++ || FFI_TYPE_LAST != 15
148 + #error "osf.S out of sync with ffi.h"
149 + #endif
150 +
151
152 diff --git a/dev-libs/libffi-compat/files/libffi-3.2.1-ia64-small-struct.patch b/dev-libs/libffi-compat/files/libffi-3.2.1-ia64-small-struct.patch
153 new file mode 100644
154 index 00000000000..6e21f3566bc
155 --- /dev/null
156 +++ b/dev-libs/libffi-compat/files/libffi-3.2.1-ia64-small-struct.patch
157 @@ -0,0 +1,74 @@
158 +From b58caef7fd620408be9239ac24ea89d5bc84f30b Mon Sep 17 00:00:00 2001
159 +From: Sergei Trofimovich <slyfox@g.o>
160 +Date: Sat, 17 Feb 2018 19:00:40 +0000
161 +Subject: [PATCH 2/2] ia64: fix small struct return
162 +
163 +This change fixes libffi.call/struct10.c failure on ia64:
164 +FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O0 execution test
165 +
166 +.Lst_small_struct handles returns for structs less than 32 bytes
167 +(following ia64 return value ABI [1]). Subroutine does roughly the
168 +following:
169 +
170 +```
171 + mov [sp+0] = r8
172 + mov [sp+8] = r9
173 + mov [sp+16] = r10
174 + mov [sp+24] = r11
175 + memcpy(destination, source=sp, 12);
176 +```
177 +
178 +The problem: ia64 ABI guarantees that top 16 bytes of stack are
179 +scratch space for callee function. Thus it can clobber it. [1]
180 +says (7.1 Procedure Frames):
181 +"""
182 +* Scratch area. This 16-byte region is provided as scratch storage
183 + for procedures that are called by the current procedure. Leaf
184 + procedures do not need to allocate this region. A procedure may
185 + use the 16 bytes at the top of its own frame as scratch memory,
186 + but the contents of this area are not preserved by a procedure call.
187 +"""
188 +
189 +In our case 16 top bytes are clobbered by a PLT resolver when memcpy()
190 +is called for the first time. As a result memcpy implementation reads
191 +already clobbered data frop top of stack.
192 +
193 +The fix is simple: allocate 16 bytes of scrats space prior to memcpy()
194 +call.
195 +
196 +[1]: https://www.intel.com/content/dam/www/public/us/en/documents/guides/itanium-software-runtime-architecture-guide.pdf
197 +
198 +Bug: https://bugs.gentoo.org/634190
199 +Signed-off-by: Sergei Trofimovich <slyfox@g.o>
200 +---
201 + src/ia64/unix.S | 7 ++++++-
202 + 1 file changed, 6 insertions(+), 1 deletion(-)
203 +
204 +diff --git a/src/ia64/unix.S b/src/ia64/unix.S
205 +index 4733377..e2547e0 100644
206 +--- a/src/ia64/unix.S
207 ++++ b/src/ia64/unix.S
208 +@@ -175,7 +175,6 @@ ffi_call_unix:
209 + ;;
210 +
211 + .Lst_small_struct:
212 +- add sp = -16, sp
213 + cmp.lt p6, p0 = 8, in3
214 + cmp.lt p7, p0 = 16, in3
215 + cmp.lt p8, p0 = 24, in3
216 +@@ -191,6 +190,12 @@ ffi_call_unix:
217 + (p8) st8 [r18] = r11
218 + mov out1 = sp
219 + mov out2 = in3
220 ++ ;;
221 ++ // ia64 software calling convention requires
222 ++ // top 16 bytes of stack to be scratch space
223 ++ // PLT resolver uses that scratch space at
224 ++ // 'memcpy' symbol reolution time
225 ++ add sp = -16, sp
226 + br.call.sptk.many b0 = memcpy#
227 + ;;
228 + mov ar.pfs = loc0
229 +--
230 +2.16.1
231 +
232
233 diff --git a/dev-libs/libffi-compat/files/libffi-3.2.1-include-path-autogen.patch b/dev-libs/libffi-compat/files/libffi-3.2.1-include-path-autogen.patch
234 new file mode 100644
235 index 00000000000..522e1fa9c48
236 --- /dev/null
237 +++ b/dev-libs/libffi-compat/files/libffi-3.2.1-include-path-autogen.patch
238 @@ -0,0 +1,56 @@
239 +Autogenerated part of libffi-3.2.1-include-path.patch
240 +
241 +https://bugs.gentoo.org/643582
242 +diff --git a/include/Makefile.in b/include/Makefile.in
243 +index 9d747e8..99ecfd7 100644
244 +--- a/include/Makefile.in
245 ++++ b/include/Makefile.in
246 +@@ -152,2 +152,2 @@ am__uninstall_files_from_dir = { \
247 +-am__installdirs = "$(DESTDIR)$(includesdir)"
248 +-HEADERS = $(nodist_includes_HEADERS)
249 ++am__installdirs = "$(DESTDIR)$(includedir)"
250 ++HEADERS = $(nodist_include_HEADERS)
251 +@@ -317,2 +317 @@ EXTRA_DIST = ffi.h.in ffi_common.h
252 +-includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
253 +-nodist_includes_HEADERS = ffi.h ffitarget.h
254 ++nodist_include_HEADERS = ffi.h ffitarget.h
255 +@@ -360 +359 @@ clean-libtool:
256 +-install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
257 ++install-nodist_includeHEADERS: $(nodist_include_HEADERS)
258 +@@ -362 +361 @@ install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
259 +- @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \
260 ++ @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
261 +@@ -364,2 +363,2 @@ install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
262 +- echo " $(MKDIR_P) '$(DESTDIR)$(includesdir)'"; \
263 +- $(MKDIR_P) "$(DESTDIR)$(includesdir)" || exit 1; \
264 ++ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
265 ++ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
266 +@@ -372,2 +371,2 @@ install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
267 +- echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \
268 +- $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \
269 ++ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
270 ++ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
271 +@@ -376 +375 @@ install-nodist_includesHEADERS: $(nodist_includes_HEADERS)
272 +-uninstall-nodist_includesHEADERS:
273 ++uninstall-nodist_includeHEADERS:
274 +@@ -378 +377 @@ uninstall-nodist_includesHEADERS:
275 +- @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \
276 ++ @list='$(nodist_include_HEADERS)'; test -n "$(includedir)" || list=; \
277 +@@ -380 +379 @@ uninstall-nodist_includesHEADERS:
278 +- dir='$(DESTDIR)$(includesdir)'; $(am__uninstall_files_from_dir)
279 ++ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
280 +@@ -468 +467 @@ installdirs:
281 +- for dir in "$(DESTDIR)$(includesdir)"; do \
282 ++ for dir in "$(DESTDIR)$(includedir)"; do \
283 +@@ -522 +521 @@ info-am:
284 +-install-data-am: install-nodist_includesHEADERS
285 ++install-data-am: install-nodist_includeHEADERS
286 +@@ -566 +565 @@ ps-am:
287 +-uninstall-am: uninstall-nodist_includesHEADERS
288 ++uninstall-am: uninstall-nodist_includeHEADERS
289 +@@ -577 +576 @@ uninstall-am: uninstall-nodist_includesHEADERS
290 +- install-nodist_includesHEADERS install-pdf install-pdf-am \
291 ++ install-nodist_includeHEADERS install-pdf install-pdf-am \
292 +@@ -582 +581 @@ uninstall-am: uninstall-nodist_includesHEADERS
293 +- uninstall-am uninstall-nodist_includesHEADERS
294 ++ uninstall-am uninstall-nodist_includeHEADERS
295
296 diff --git a/dev-libs/libffi-compat/files/libffi-3.2.1-include-path.patch b/dev-libs/libffi-compat/files/libffi-3.2.1-include-path.patch
297 new file mode 100644
298 index 00000000000..e1269b2398a
299 --- /dev/null
300 +++ b/dev-libs/libffi-compat/files/libffi-3.2.1-include-path.patch
301 @@ -0,0 +1,39 @@
302 +https://bugs.gentoo.org/643582
303 +
304 +From 982b89c01aca99c7bc229914fc1521f96930919b Mon Sep 17 00:00:00 2001
305 +From: Yen Chi Hsuan <yan12125@×××××.com>
306 +Date: Sun, 13 Nov 2016 19:17:19 +0800
307 +Subject: [PATCH] Install public headers in the standard path
308 +
309 +---
310 + include/Makefile.am | 3 +--
311 + libffi.pc.in | 2 +-
312 + 2 files changed, 2 insertions(+), 3 deletions(-)
313 +
314 +diff --git a/include/Makefile.am b/include/Makefile.am
315 +index bb241e8..c59df9f 100644
316 +--- a/include/Makefile.am
317 ++++ b/include/Makefile.am
318 +@@ -6,5 +6,4 @@ DISTCLEANFILES=ffitarget.h
319 + noinst_HEADERS=ffi_common.h ffi_cfi.h
320 + EXTRA_DIST=ffi.h.in
321 +
322 +-includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
323 +-nodist_includes_HEADERS = ffi.h ffitarget.h
324 ++nodist_include_HEADERS = ffi.h ffitarget.h
325 +diff --git a/libffi.pc.in b/libffi.pc.in
326 +index edf6fde..6fad83b 100644
327 +--- a/libffi.pc.in
328 ++++ b/libffi.pc.in
329 +@@ -2,7 +2,7 @@ prefix=@prefix@
330 + exec_prefix=@exec_prefix@
331 + libdir=@libdir@
332 + toolexeclibdir=@toolexeclibdir@
333 +-includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include
334 ++includedir=@includedir@
335 +
336 + Name: @PACKAGE_NAME@
337 + Description: Library supporting Foreign Function Interfaces
338 +--
339 +2.15.1
340 +
341
342 diff --git a/dev-libs/libffi-compat/files/libffi-3.2.1-musl-emutramp.patch b/dev-libs/libffi-compat/files/libffi-3.2.1-musl-emutramp.patch
343 new file mode 100644
344 index 00000000000..7c011d2b6d0
345 --- /dev/null
346 +++ b/dev-libs/libffi-compat/files/libffi-3.2.1-musl-emutramp.patch
347 @@ -0,0 +1,31 @@
348 +https://github.com/libffi/libffi/commit/e169ba2b83c780058fe626856cfdb5903a85cb97.patch
349 +https://bugs.gentoo.org/694916
350 +
351 +From e169ba2b83c780058fe626856cfdb5903a85cb97 Mon Sep 17 00:00:00 2001
352 +From: Kylie McClain <somasis@×××××××.org>
353 +Date: Fri, 29 Apr 2016 21:04:07 -0400
354 +Subject: [PATCH] Fix usage on musl libc
355 +
356 +A gcc compiled on musl does not define __gnu_linux__, it defines __linux__.
357 +Only on glibc does __gnu_linux__ get defined, but both define __linux__, so
358 +we should check for that instead.
359 +
360 +With this patch, libffi works perfectly, and passes its testsuite entirely
361 +on musl libc systems.
362 +---
363 + src/closures.c | 2 +-
364 + 1 file changed, 1 insertion(+), 1 deletion(-)
365 +
366 +diff --git a/src/closures.c b/src/closures.c
367 +index 3dec0e31..05849e06 100644
368 +--- a/src/closures.c
369 ++++ b/src/closures.c
370 +@@ -35,7 +35,7 @@
371 + #include <ffi_common.h>
372 +
373 + #if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE
374 +-# if __gnu_linux__ && !defined(__ANDROID__)
375 ++# if __linux__ && !defined(__ANDROID__)
376 + /* This macro indicates it may be forbidden to map anonymous memory
377 + with both write and execute permission. Code compiled when this
378 + option is defined will attempt to map such pages once, but if it
379
380 diff --git a/dev-libs/libffi-compat/files/libffi-3.2.1-o-tmpfile-eacces.patch b/dev-libs/libffi-compat/files/libffi-3.2.1-o-tmpfile-eacces.patch
381 new file mode 100644
382 index 00000000000..92a733cbe82
383 --- /dev/null
384 +++ b/dev-libs/libffi-compat/files/libffi-3.2.1-o-tmpfile-eacces.patch
385 @@ -0,0 +1,17 @@
386 +https://bugs.gentoo.org/529044
387 +
388 +deploy this workaround until newer versions of the kernel/C library/libsandbox
389 +are rolled out into general circulation
390 +
391 +--- a/src/closures.c
392 ++++ b/src/closures.c
393 +@@ -301,7 +301,8 @@ open_temp_exec_file_dir (const char *dir)
394 + #ifdef O_TMPFILE
395 + fd = open (dir, flags | O_RDWR | O_EXCL | O_TMPFILE, 0700);
396 + /* If the running system does not support the O_TMPFILE flag then retry without it. */
397 +- if (fd != -1 || (errno != EINVAL && errno != EISDIR && errno != EOPNOTSUPP)) {
398 ++ if (fd != -1 || (errno != EINVAL && errno != EISDIR && errno != EOPNOTSUPP &&
399 ++ errno != EACCES)) {
400 + return fd;
401 + } else {
402 + errno = 0;
403
404 diff --git a/dev-libs/libffi-compat/libffi-compat-3.2.1-r3.ebuild b/dev-libs/libffi-compat/libffi-compat-3.2.1-r3.ebuild
405 new file mode 100644
406 index 00000000000..f8eebf3461e
407 --- /dev/null
408 +++ b/dev-libs/libffi-compat/libffi-compat-3.2.1-r3.ebuild
409 @@ -0,0 +1,52 @@
410 +# Copyright 1999-2019 Gentoo Authors
411 +# Distributed under the terms of the GNU General Public License v2
412 +
413 +EAPI=7
414 +inherit eutils libtool multilib multilib-minimal toolchain-funcs
415 +
416 +DESCRIPTION="a portable, high level programming interface to various calling conventions"
417 +HOMEPAGE="https://sourceware.org/libffi/"
418 +SRC_URI="ftp://sourceware.org/pub/libffi/libffi-${PV}.tar.gz"
419 +
420 +LICENSE="MIT"
421 +SLOT="6" # libffi.so.6
422 +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"
423 +IUSE="debug pax_kernel test"
424 +
425 +RDEPEND="!dev-libs/libffi:0/0" # conflicts on libffi.so.6
426 +DEPEND="test? ( dev-util/dejagnu )"
427 +
428 +DOCS="ChangeLog* README"
429 +
430 +PATCHES=(
431 + "${FILESDIR}"/libffi-3.2.1-o-tmpfile-eacces.patch #529044
432 + "${FILESDIR}"/libffi-3.2.1-complex_alpha.patch
433 + "${FILESDIR}"/libffi-3.1-darwin-x32.patch
434 + "${FILESDIR}"/libffi-3.2.1-complex-ia64.patch
435 + "${FILESDIR}"/libffi-3.2.1-include-path.patch
436 + "${FILESDIR}"/libffi-3.2.1-include-path-autogen.patch
437 + "${FILESDIR}"/libffi-3.2.1-ia64-small-struct.patch #634190
438 + "${FILESDIR}"/libffi-3.2.1-musl-emutramp.patch #694916
439 +)
440 +
441 +S=${WORKDIR}/libffi-${PV}
442 +ECONF_SOURCE=${S}
443 +
444 +src_prepare() {
445 + default
446 +
447 + sed -i -e 's:@toolexeclibdir@:$(libdir):g' Makefile.in || die #462814
448 + elibtoolize
449 +}
450 +
451 +multilib_src_configure() {
452 + use userland_BSD && export HOST="${CHOST}"
453 + econf \
454 + --disable-static \
455 + $(use_enable pax_kernel pax_emutramp) \
456 + $(use_enable debug)
457 +}
458 +
459 +multilib_src_install() {
460 + dolib.so .libs/libffi.so.${SLOT}*
461 +}
462
463 diff --git a/dev-libs/libffi-compat/metadata.xml b/dev-libs/libffi-compat/metadata.xml
464 new file mode 100644
465 index 00000000000..6e9a28c5ac8
466 --- /dev/null
467 +++ b/dev-libs/libffi-compat/metadata.xml
468 @@ -0,0 +1,42 @@
469 +<?xml version="1.0" encoding="UTF-8"?>
470 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
471 +<pkgmetadata>
472 + <maintainer type="project">
473 + <email>toolchain@g.o</email>
474 + <name>Gentoo Toolchain Project</name>
475 + </maintainer>
476 + <longdescription lang="en">
477 + Compilers for high level languages generate code that follow certain
478 + conventions. These conventions are necessary, in part, for separate
479 + compilation to work. One such convention is the "calling
480 + convention". The "calling convention" is essentially a set of
481 + assumptions made by the compiler about where function arguments will
482 + be found on entry to a function. A "calling convention" also specifies
483 + where the return value for a function is found.
484 +
485 + Some programs may not know at the time of compilation what arguments
486 + are to be passed to a function. For instance, an interpreter may be
487 + told at run-time about the number and types of arguments used to call
488 + a given function. Libffi can be used in such programs to provide a
489 + bridge from the interpreter program to compiled code.
490 +
491 + The libffi library provides a portable, high level programming
492 + interface to various calling conventions. This allows a programmer to
493 + call any function specified by a call interface description at run
494 + time.
495 +
496 + Ffi stands for Foreign Function Interface. A foreign function
497 + interface is the popular name for the interface that allows code
498 + written in one language to call code written in another language. The
499 + libffi library really only provides the lowest, machine dependent
500 + layer of a fully featured foreign function interface. A layer must
501 + exist above libffi that handles type conversions for values passed
502 + between the two languages.
503 + </longdescription>
504 + <use>
505 + <flag name="pax_kernel">Use PaX emulated trampolines, for we can't use PROT_EXEC</flag>
506 + </use>
507 + <upstream>
508 + <remote-id type="cpe">cpe:/a:libffi_project:libffi</remote-id>
509 + </upstream>
510 +</pkgmetadata>