libffi
This commit is contained in:
37
devel/libffi/Makefile
Normal file
37
devel/libffi/Makefile
Normal file
@ -0,0 +1,37 @@
|
||||
# Created by: Horance Chou <horance@freedom.ie.cycu.edu.tw>
|
||||
# $FreeBSD$
|
||||
|
||||
PORTNAME= libffi
|
||||
PORTVERSION= 3.3
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= devel
|
||||
MASTER_SITES= SOURCEWARE/${PORTNAME}
|
||||
|
||||
PATCH_SITES= https://github.com/${PORTNAME}/${PORTNAME}/commit/
|
||||
PATCHFILES+= 01a75ed76ea7e57f1b7a5c183e2b1e890e6aa0fd.diff:-p1
|
||||
# This patch is for configure.ac.
|
||||
# A local patch against configure has been created in files/patch-configure.
|
||||
#PATCHFILES+= 8c50837f0b58ba5b2bcb1b424a2a4bfa01559fb2.diff:-p1
|
||||
|
||||
MAINTAINER= zeising@FreeBSD.org
|
||||
COMMENT= Foreign Function Interface
|
||||
|
||||
LICENSE= MIT
|
||||
LICENSE_FILE= ${WRKSRC}/LICENSE
|
||||
|
||||
TEST_DEPENDS= runtest:misc/dejagnu
|
||||
|
||||
USES= compiler:c11 libtool pathfix
|
||||
USE_LDCONFIG= yes
|
||||
GNU_CONFIGURE= yes
|
||||
|
||||
CONFIGURE_ARGS= --disable-multi-os-directory
|
||||
INSTALL_TARGET= install-strip
|
||||
INFO= libffi
|
||||
TEST_TARGET= check
|
||||
|
||||
post-patch:
|
||||
@${REINPLACE_CMD} -e 's| -Wno-psabi||g' \
|
||||
${WRKSRC}/testsuite/lib/libffi.exp
|
||||
|
||||
.include <bsd.port.mk>
|
||||
5
devel/libffi/distinfo
Normal file
5
devel/libffi/distinfo
Normal file
@ -0,0 +1,5 @@
|
||||
TIMESTAMP = 1597921173
|
||||
SHA256 (libffi-3.3.tar.gz) = 72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056
|
||||
SIZE (libffi-3.3.tar.gz) = 1305466
|
||||
SHA256 (01a75ed76ea7e57f1b7a5c183e2b1e890e6aa0fd.diff) = 627aac849e93debaa21cd85feb82b1a28cf481687a14717cf522eaec2a2b19aa
|
||||
SIZE (01a75ed76ea7e57f1b7a5c183e2b1e890e6aa0fd.diff) = 412
|
||||
16
devel/libffi/files/patch-Makefile.in
Normal file
16
devel/libffi/files/patch-Makefile.in
Normal file
@ -0,0 +1,16 @@
|
||||
This patch is based on the following upstream patch
|
||||
From 0027b072627aa9d3ada71c4374561966064ecd5a Mon Sep 17 00:00:00 2001
|
||||
From: "M. Herdiansyah"
|
||||
Date: Thu, 11 Jun 2020 19:40:24 +0700
|
||||
Subject: [PATCH] Makefile: increase compatibility with bmake (#551)
|
||||
--- Makefile.in.orig 2020-07-04 16:53:39 UTC
|
||||
+++ Makefile.in
|
||||
@@ -2012,7 +2012,7 @@ uninstall-am: uninstall-pkgconfigDATA uninstall-toolex
|
||||
@LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@ > $@ || (rm -f $@ ; exit 1)
|
||||
|
||||
libffi.map: $(top_srcdir)/libffi.map.in
|
||||
- $(COMPILE) -D$(TARGET) -E -x assembler-with-cpp -o $@ $<
|
||||
+ $(COMPILE) -D$(TARGET) -E -x assembler-with-cpp -o $@ $(top_srcdir)/libffi.map.in
|
||||
|
||||
dist-hook:
|
||||
d=`(cd $(distdir); pwd)`; (cd doc; make pdf; cp *.pdf $$d/doc)
|
||||
23
devel/libffi/files/patch-configure
Normal file
23
devel/libffi/files/patch-configure
Normal file
@ -0,0 +1,23 @@
|
||||
--- configure.orig 2020-08-20 10:54:03 UTC
|
||||
+++ configure
|
||||
@@ -18545,17 +18545,11 @@ if ${libffi_cv_ro_eh_frame+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
- libffi_cv_ro_eh_frame=no
|
||||
+ libffi_cv_ro_eh_frame=yes
|
||||
echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c
|
||||
if $CC $CFLAGS -c -fpic -fexceptions -o conftest.o conftest.c > /dev/null 2>&1; then
|
||||
- objdump -h conftest.o > conftest.dump 2>&1
|
||||
- libffi_eh_frame_line=`grep -n eh_frame conftest.dump | cut -d: -f 1`
|
||||
- if test "x$libffi_eh_frame_line" != "x"; then
|
||||
- libffi_test_line=`expr $libffi_eh_frame_line + 1`p
|
||||
- sed -n $libffi_test_line conftest.dump > conftest.line
|
||||
- if grep READONLY conftest.line > /dev/null; then
|
||||
- libffi_cv_ro_eh_frame=yes
|
||||
- fi
|
||||
+ if readelf -WS conftest.o | grep -q -n 'eh_frame .* WA'; then
|
||||
+ libffi_cv_ro_eh_frame=no
|
||||
fi
|
||||
fi
|
||||
rm -f conftest.*
|
||||
24
devel/libffi/files/patch-configure.host
Normal file
24
devel/libffi/files/patch-configure.host
Normal file
@ -0,0 +1,24 @@
|
||||
--- configure.host.orig 2019-11-22 17:55:36.000000000 -0600
|
||||
+++ configure.host 2020-08-28 12:48:23.259024000 -0500
|
||||
@@ -167,7 +167,7 @@ case "${host}" in
|
||||
mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*)
|
||||
TARGET=MIPS; TARGETDIR=mips
|
||||
;;
|
||||
- mips*-*linux* | mips*-*-openbsd*)
|
||||
+ mips*-*linux* | mips*-*-openbsd* | mips*-*-freebsd*)
|
||||
# Support 128-bit long double for NewABI.
|
||||
HAVE_LONG_DOUBLE='defined(__mips64)'
|
||||
TARGET=MIPS; TARGETDIR=mips
|
||||
@@ -203,7 +203,11 @@ case "${host}" in
|
||||
TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
|
||||
HAVE_LONG_DOUBLE_VARIANT=1
|
||||
;;
|
||||
- powerpc64-*-freebsd*)
|
||||
+ powerpcspe-*-freebsd*)
|
||||
+ TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc
|
||||
+ CFLAGS="$CFLAGS -D__NO_FPRS__"
|
||||
+ ;;
|
||||
+ powerpc64-*-freebsd* | powerpc64le-*-freebsd*)
|
||||
TARGET=POWERPC; TARGETDIR=powerpc
|
||||
;;
|
||||
powerpc*-*-rtems*)
|
||||
36
devel/libffi/files/patch-src__arm__ffi.c
Normal file
36
devel/libffi/files/patch-src__arm__ffi.c
Normal file
@ -0,0 +1,36 @@
|
||||
# Description: Fix abort() on ARM related to __clear_cache(). This is an issue
|
||||
# for anything !apple that is using the libcompiler_rt provided by clang on ARM
|
||||
# PR: ports/149167 ports/184517
|
||||
# Patch by: cognet@ (to be upstreamed @ LLVM)
|
||||
|
||||
--- src/arm/ffi.c.orig 2019-10-31 14:49:54 UTC
|
||||
+++ src/arm/ffi.c
|
||||
@@ -55,6 +55,11 @@ extern unsigned int ffi_arm_trampoline[3] FFI_HIDDEN;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+#if defined(__FreeBSD__) && defined(__arm__)
|
||||
+#include <sys/types.h>
|
||||
+#include <machine/sysarch.h>
|
||||
+#endif
|
||||
+
|
||||
/* Forward declares. */
|
||||
static int vfp_type_p (const ffi_type *);
|
||||
static void layout_vfp_args (ffi_cif *);
|
||||
@@ -568,6 +573,16 @@ void ffi_go_closure_SYSV (void) FFI_HIDDEN;
|
||||
void ffi_go_closure_VFP (void) FFI_HIDDEN;
|
||||
|
||||
/* the cif must already be prep'ed */
|
||||
+
|
||||
+#if defined(__FreeBSD__) && defined(__arm__)
|
||||
+#define __clear_cache(start, end) do { \
|
||||
+ struct arm_sync_icache_args ua; \
|
||||
+ \
|
||||
+ ua.addr = (uintptr_t)(start); \
|
||||
+ ua.len = (char *)(end) - (char *)start; \
|
||||
+ sysarch(ARM_SYNC_ICACHE, &ua); \
|
||||
+ } while (0);
|
||||
+#endif
|
||||
|
||||
ffi_status
|
||||
ffi_prep_closure_loc (ffi_closure * closure,
|
||||
29
devel/libffi/files/patch-src__mips__ffi.c
Normal file
29
devel/libffi/files/patch-src__mips__ffi.c
Normal file
@ -0,0 +1,29 @@
|
||||
diff --git ./src/mips/ffi.c.orig ./src/mips/ffi.c
|
||||
index 03121e3..8b7881f 100644
|
||||
--- ./src/mips/ffi.c.orig
|
||||
+++ ./src/mips/ffi.c
|
||||
@@ -38,7 +38,9 @@
|
||||
#endif
|
||||
|
||||
#ifndef USE__BUILTIN___CLEAR_CACHE
|
||||
-# if defined(__OpenBSD__)
|
||||
+# if defined(__FreeBSD__)
|
||||
+# include <machine/sysarch.h>
|
||||
+# elif defined(__OpenBSD__)
|
||||
# include <mips64/sysarch.h>
|
||||
# else
|
||||
# include <sys/cachectl.h>
|
||||
@@ -729,11 +731,13 @@ ffi_prep_closure_loc (ffi_closure *closure,
|
||||
closure->fun = fun;
|
||||
closure->user_data = user_data;
|
||||
|
||||
+#if !defined(__FreeBSD__)
|
||||
#ifdef USE__BUILTIN___CLEAR_CACHE
|
||||
__builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE);
|
||||
#else
|
||||
cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE);
|
||||
#endif
|
||||
+#endif /* ! __FreeBSD__ */
|
||||
return FFI_OK;
|
||||
}
|
||||
|
||||
13
devel/libffi/files/patch-src__mips__ffitarget.h
Normal file
13
devel/libffi/files/patch-src__mips__ffitarget.h
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git ./src/mips/ffitarget.h.orig ./src/mips/ffitarget.h
|
||||
index 717d659..5a0c2b1 100644
|
||||
--- ./src/mips/ffitarget.h.orig
|
||||
+++ ./src/mips/ffitarget.h
|
||||
@@ -41,7 +41,7 @@
|
||||
#define _MIPS_SIM_ABI32 1
|
||||
#define _MIPS_SIM_NABI32 2
|
||||
#define _MIPS_SIM_ABI64 3
|
||||
-#elif !defined(__OpenBSD__)
|
||||
+#elif !defined(__OpenBSD__) && !defined(__FreeBSD__)
|
||||
# include <sgidefs.h>
|
||||
#endif
|
||||
|
||||
12
devel/libffi/files/patch-src_riscv_ffi.c
Normal file
12
devel/libffi/files/patch-src_riscv_ffi.c
Normal file
@ -0,0 +1,12 @@
|
||||
--- src/riscv/ffi.c.orig 2019-10-31 14:49:54 UTC
|
||||
+++ src/riscv/ffi.c
|
||||
@@ -417,7 +417,9 @@ ffi_status ffi_prep_closure_loc(ffi_clos
|
||||
closure->fun = fun;
|
||||
closure->user_data = user_data;
|
||||
|
||||
+#if !defined(__FreeBSD__)
|
||||
__builtin___clear_cache(codeloc, codeloc + FFI_TRAMPOLINE_SIZE);
|
||||
+#endif
|
||||
|
||||
return FFI_OK;
|
||||
}
|
||||
6
devel/libffi/pkg-descr
Normal file
6
devel/libffi/pkg-descr
Normal file
@ -0,0 +1,6 @@
|
||||
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.
|
||||
|
||||
WWW: https://sourceware.org/libffi/
|
||||
11
devel/libffi/pkg-plist
Normal file
11
devel/libffi/pkg-plist
Normal file
@ -0,0 +1,11 @@
|
||||
include/ffi.h
|
||||
include/ffitarget.h
|
||||
lib/libffi.a
|
||||
lib/libffi.so
|
||||
lib/libffi.so.7
|
||||
lib/libffi.so.7.1.0
|
||||
libdata/pkgconfig/libffi.pc
|
||||
man/man3/ffi.3.gz
|
||||
man/man3/ffi_call.3.gz
|
||||
man/man3/ffi_prep_cif.3.gz
|
||||
man/man3/ffi_prep_cif_var.3.gz
|
||||
Reference in New Issue
Block a user