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.
This commit is contained in:
jasper 2009-09-23 20:55:46 +00:00
parent 303d50c328
commit 9bf295a421
11 changed files with 211 additions and 0 deletions

30
devel/libffi/Makefile Normal file
View File

@ -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 <bsd.port.mk>

5
devel/libffi/distinfo Normal file
View File

@ -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

View File

@ -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*)

View File

@ -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

View File

@ -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

View File

@ -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__

View File

@ -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 */

View File

@ -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);
}

7
devel/libffi/pkg/DESCR Normal file
View File

@ -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.

View File

@ -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}

13
devel/libffi/pkg/PLIST Normal file
View File

@ -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