From 9bf295a421866bfc1090a1ed8d90766f87ee07b2 Mon Sep 17 00:00:00 2001 From: jasper Date: Wed, 23 Sep 2009 20:55:46 +0000 Subject: [PATCH] import libffi 3.0.8 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. successfully tested on seven arches by me. other arches are disabled for now as they need more work (mips64) or haven't been tested yet. --- devel/libffi/Makefile | 30 ++++++++ devel/libffi/distinfo | 5 ++ devel/libffi/patches/patch-configure | 15 ++++ .../libffi/patches/patch-include_Makefile_in | 15 ++++ devel/libffi/patches/patch-libffi_pc_in | 15 ++++ devel/libffi/patches/patch-src_arm_sysv_S | 77 +++++++++++++++++++ .../patch-testsuite_libffi_call_float2_c | 17 ++++ .../patch-testsuite_libffi_call_return_uc_c | 15 ++++ devel/libffi/pkg/DESCR | 7 ++ devel/libffi/pkg/PFRAG.shared | 2 + devel/libffi/pkg/PLIST | 13 ++++ 11 files changed, 211 insertions(+) create mode 100644 devel/libffi/Makefile create mode 100644 devel/libffi/distinfo create mode 100644 devel/libffi/patches/patch-configure create mode 100644 devel/libffi/patches/patch-include_Makefile_in create mode 100644 devel/libffi/patches/patch-libffi_pc_in create mode 100644 devel/libffi/patches/patch-src_arm_sysv_S create mode 100644 devel/libffi/patches/patch-testsuite_libffi_call_float2_c create mode 100644 devel/libffi/patches/patch-testsuite_libffi_call_return_uc_c create mode 100644 devel/libffi/pkg/DESCR create mode 100644 devel/libffi/pkg/PFRAG.shared create mode 100644 devel/libffi/pkg/PLIST diff --git a/devel/libffi/Makefile b/devel/libffi/Makefile new file mode 100644 index 00000000000..107612abce2 --- /dev/null +++ b/devel/libffi/Makefile @@ -0,0 +1,30 @@ +# $OpenBSD: Makefile,v 1.1.1.1 2009/09/23 20:55:46 jasper Exp $ + +# hppa, m88k, vax - not tested yet +# mips64 - OpenBSD doesn't provide a cacheflush/cachectl (yet) +NOT_FOR_ARCHS= hppa, m88k, mips64, vax + +COMMENT= Foreign Function Interface + +DISTNAME= libffi-3.0.8 +SHARED_LIBS += ffi 0.0 # .5.9 +CATEGORIES= devel + +HOMEPAGE= http://sources.redhat.com/libffi/ + +# MIT +PERMIT_PACKAGE_CDROM= Yes +PERMIT_PACKAGE_FTP= Yes +PERMIT_DISTFILES_CDROM= Yes +PERMIT_DISTFILES_FTP= Yes + +MASTER_SITES= ftp://sourceware.org/pub/libffi/ + +REGRESS_DEPENDS= ::devel/dejagnu + +USE_LIBTOOL= Yes + +CONFIGURE_STYLE= gnu +CONFIGURE_ARGS+= ${CONFIGURE_SHARED} + +.include diff --git a/devel/libffi/distinfo b/devel/libffi/distinfo new file mode 100644 index 00000000000..246cb274491 --- /dev/null +++ b/devel/libffi/distinfo @@ -0,0 +1,5 @@ +MD5 (libffi-3.0.8.tar.gz) = GIpPef2sIxAES0S305GO+Q== +RMD160 (libffi-3.0.8.tar.gz) = QUT2Tnnr+VFhpq/VjOru+DcrXlc= +SHA1 (libffi-3.0.8.tar.gz) = zkTRDDnZo3R5yHd+IGysDzbEhxI= +SHA256 (libffi-3.0.8.tar.gz) = LHxbiKaPs2ImKIm6Je8l3CeGS3u/A1R6ija41WdWlAY= +SIZE (libffi-3.0.8.tar.gz) = 722834 diff --git a/devel/libffi/patches/patch-configure b/devel/libffi/patches/patch-configure new file mode 100644 index 00000000000..1064f44b33f --- /dev/null +++ b/devel/libffi/patches/patch-configure @@ -0,0 +1,15 @@ +$OpenBSD: patch-configure,v 1.1.1.1 2009/09/23 20:55:46 jasper Exp $ + +Enable libffi on powerpc platforms. + +--- configure.orig Fri Dec 19 09:12:45 2008 ++++ configure Sun Sep 20 13:15:28 2009 +@@ -21033,7 +21033,7 @@ case "$host" in + powerpc-*-aix* | rs6000-*-aix*) + TARGET=POWERPC_AIX; TARGETDIR=powerpc + ;; +- powerpc-*-freebsd*) ++ powerpc-*-freebsd* | powerpc-*-openbsd*) + TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc + ;; + powerpc*-*-rtems*) diff --git a/devel/libffi/patches/patch-include_Makefile_in b/devel/libffi/patches/patch-include_Makefile_in new file mode 100644 index 00000000000..509f0ad74de --- /dev/null +++ b/devel/libffi/patches/patch-include_Makefile_in @@ -0,0 +1,15 @@ +$OpenBSD: patch-include_Makefile_in,v 1.1.1.1 2009/09/23 20:55:46 jasper Exp $ + +Install headers into a standard directory. + +--- include/Makefile.in.orig Sat Sep 19 15:03:06 2009 ++++ include/Makefile.in Sat Sep 19 15:03:49 2009 +@@ -185,7 +185,7 @@ top_srcdir = @top_srcdir@ + AUTOMAKE_OPTIONS = foreign + DISTCLEANFILES = ffitarget.h + EXTRA_DIST = ffi.h.in ffi_common.h +-includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include ++includesdir = $(includedir) + nodist_includes_HEADERS = ffi.h ffitarget.h + all: all-am + diff --git a/devel/libffi/patches/patch-libffi_pc_in b/devel/libffi/patches/patch-libffi_pc_in new file mode 100644 index 00000000000..16fd50e52dd --- /dev/null +++ b/devel/libffi/patches/patch-libffi_pc_in @@ -0,0 +1,15 @@ +$OpenBSD: patch-libffi_pc_in,v 1.1.1.1 2009/09/23 20:55:46 jasper Exp $ + +Install headers into a standard directory. + +--- libffi.pc.in.orig Sat Sep 19 15:10:14 2009 ++++ libffi.pc.in Sat Sep 19 15:10:31 2009 +@@ -1,7 +1,7 @@ + prefix=@prefix@ + exec_prefix=@exec_prefix@ + libdir=@libdir@ +-includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include ++includedir=@includedir@ + + Name: @PACKAGE_NAME@ + Description: Library supporting Foreign Function Interfaces diff --git a/devel/libffi/patches/patch-src_arm_sysv_S b/devel/libffi/patches/patch-src_arm_sysv_S new file mode 100644 index 00000000000..e5919dd5cc1 --- /dev/null +++ b/devel/libffi/patches/patch-src_arm_sysv_S @@ -0,0 +1,77 @@ +$OpenBSD: patch-src_arm_sysv_S,v 1.1.1.1 2009/09/23 20:55:46 jasper Exp $ + +Fix build on arm. Patch from FreeBSD. + +--- src/arm/sysv.S.orig Mon Jun 29 13:08:57 2009 ++++ src/arm/sysv.S Mon Jun 29 13:11:11 2009 +@@ -83,13 +83,6 @@ + # define call_reg(x) mov lr, pc ; mov pc, x + #endif + +-/* Conditionally compile unwinder directives. */ +-#ifdef __ARM_EABI__ +-#define UNWIND +-#else +-#define UNWIND @ +-#endif +- + + #if defined(__thumb__) && !defined(__THUMB_INTERWORK__) + .macro ARM_FUNC_START name +@@ -101,7 +94,6 @@ + bx pc + nop + .arm +- UNWIND .fnstart + /* A hook to tell gdb that we've switched to ARM mode. Also used to call + directly from other local arm routines. */ + _L__\name: +@@ -112,7 +104,6 @@ _L__\name: + .align 0 + .arm + ENTRY(\name) +- UNWIND .fnstart + .endm + #endif + +@@ -145,11 +136,8 @@ _L__\name: + ARM_FUNC_START ffi_call_SYSV + @ Save registers + stmfd sp!, {r0-r3, fp, lr} +- UNWIND .save {r0-r3, fp, lr} + mov fp, sp + +- UNWIND .setfp fp, sp +- + @ Make room for all of the new args. + sub sp, fp, r2 + +@@ -219,7 +207,6 @@ LSYM(Lepilogue): + RETLDM "r0-r3,fp" + + .ffi_call_SYSV_end: +- UNWIND .fnend + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + + /* +@@ -231,12 +218,9 @@ LSYM(Lepilogue): + */ + + ARM_FUNC_START ffi_closure_SYSV +- UNWIND .pad #16 + add ip, sp, #16 + stmfd sp!, {ip, lr} +- UNWIND .save {r0, lr} + add r2, sp, #8 +- .pad #16 + sub sp, sp, #16 + str sp, [sp, #8] + add r1, sp, #8 +@@ -291,7 +275,6 @@ ARM_FUNC_START ffi_closure_SYSV + #endif + + .ffi_closure_SYSV_end: +- UNWIND .fnend + .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + + #if defined __ELF__ && defined __linux__ diff --git a/devel/libffi/patches/patch-testsuite_libffi_call_float2_c b/devel/libffi/patches/patch-testsuite_libffi_call_float2_c new file mode 100644 index 00000000000..af4cbd2b86d --- /dev/null +++ b/devel/libffi/patches/patch-testsuite_libffi_call_float2_c @@ -0,0 +1,17 @@ +$OpenBSD: patch-testsuite_libffi_call_float2_c,v 1.1.1.1 2009/09/23 20:55:46 jasper Exp $ + +The %Lf printf format expects "long double", so cast args accordingly. + +Patch from NetBSD. + +--- testsuite/libffi.call/float2.c.orig Sat Sep 19 15:40:48 2009 ++++ testsuite/libffi.call/float2.c Sat Sep 19 15:41:30 2009 +@@ -44,7 +44,7 @@ int main (void) + /* This is ifdef'd out for now. long double support under SunOS/gcc + is pretty much non-existent. You'll get the odd bus error in library + routines like printf(). */ +- printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON); ++ printf ("%Lf, %Lf, %Lf, %Lf\n", (long double)ld, (long double)ldblit(f), (long double)ld - ldblit(f), (long double)LDBL_EPSILON); + #endif + + /* These are not always the same!! Check for a reasonable delta */ diff --git a/devel/libffi/patches/patch-testsuite_libffi_call_return_uc_c b/devel/libffi/patches/patch-testsuite_libffi_call_return_uc_c new file mode 100644 index 00000000000..4fdd9e63889 --- /dev/null +++ b/devel/libffi/patches/patch-testsuite_libffi_call_return_uc_c @@ -0,0 +1,15 @@ +$OpenBSD: patch-testsuite_libffi_call_return_uc_c,v 1.1.1.1 2009/09/23 20:55:46 jasper Exp $ + +Fix regression test, due to "comparison between signed and unsigned" + +--- testsuite/libffi.call/return_uc.c.orig Sat Sep 19 16:11:15 2009 ++++ testsuite/libffi.call/return_uc.c Sat Sep 19 16:11:19 2009 +@@ -32,7 +32,7 @@ int main (void) + uc < (unsigned char) '\xff'; uc++) + { + ffi_call(&cif, FFI_FN(return_uc), &rint, values); +- CHECK(rint == (signed int) uc); ++ CHECK(rint == (unsigned int) uc); + } + exit(0); + } diff --git a/devel/libffi/pkg/DESCR b/devel/libffi/pkg/DESCR new file mode 100644 index 00000000000..a54fda63811 --- /dev/null +++ b/devel/libffi/pkg/DESCR @@ -0,0 +1,7 @@ +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. diff --git a/devel/libffi/pkg/PFRAG.shared b/devel/libffi/pkg/PFRAG.shared new file mode 100644 index 00000000000..7cc605a2986 --- /dev/null +++ b/devel/libffi/pkg/PFRAG.shared @@ -0,0 +1,2 @@ +@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2009/09/23 20:55:46 jasper Exp $ +@lib lib/libffi.so.${LIBffi_VERSION} diff --git a/devel/libffi/pkg/PLIST b/devel/libffi/pkg/PLIST new file mode 100644 index 00000000000..5ad2b4959e8 --- /dev/null +++ b/devel/libffi/pkg/PLIST @@ -0,0 +1,13 @@ +@comment $OpenBSD: PLIST,v 1.1.1.1 2009/09/23 20:55:46 jasper Exp $ +@conflict gcj-* +%%SHARED%% +include/ffi.h +include/ffitarget.h +@info info/libffi.info +lib/libffi.a +lib/libffi.la +lib/pkgconfig/ +lib/pkgconfig/libffi.pc +@man man/man3/ffi.3 +@man man/man3/ffi_call.3 +@man man/man3/ffi_prep_cif.3