commit: d2e28f93b38666ec241c679e404398d32a9a18ae
parent 29e6bebb30f68df596b88f85866ba2928c0dfc2e
Author: Michael Forney <mforney@mforney.org>
Date: Sat, 29 Feb 2020 14:58:12 -0800
libffi: Add support for aarch64
Diffstat:
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/pkg/libffi/fficonfig.h b/pkg/libffi/fficonfig.h
@@ -14,8 +14,10 @@
/* #undef HAVE_AS_REGISTER_PSEUDO_OP */
/* #undef HAVE_AS_S390_ZARCH */
/* #undef HAVE_AS_SPARC_UA_PCREL */
+#ifdef __x86_64__
#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1
#define HAVE_AS_X86_PCREL 1
+#endif
#define HAVE_DLFCN_H 1
#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1
#define HAVE_INTTYPES_H 1
diff --git a/pkg/libffi/gen.lua b/pkg/libffi/gen.lua
@@ -1,3 +1,4 @@
+local arch = config.target.platform:match('[^-]*')
cflags{
'-I $dir',
'-I $outdir/include',
@@ -7,7 +8,7 @@ cflags{
build('sed', '$outdir/include/ffi.h', '$srcdir/include/ffi.h.in', {
expr={
'-e s,@VERSION@,3.3,',
- '-e s,@TARGET@,X86_64,',
+ string.format('-e s,@TARGET@,%s,', arch:upper()),
'-e s,@HAVE_LONG_DOUBLE@,1,',
'-e s,@HAVE_LONG_DOUBLE_VARIANT@,0,',
'-e s,@FFI_EXEC_TRAMPOLINE_TABLE@,0,',
@@ -15,15 +16,22 @@ build('sed', '$outdir/include/ffi.h', '$srcdir/include/ffi.h.in', {
})
pkg.hdrs = {
- copy('$outdir/include', '$srcdir/src/x86', {'ffitarget.h'}),
+ copy('$outdir/include', '$srcdir/src/'..({x86_64='x86', aarch64='aarch64'})[arch], {'ffitarget.h'}),
'$outdir/include/ffi.h',
install=true,
}
-lib('libffi.a', [[src/(
- prep_cif.c types.c raw_api.c java_raw_api.c closures.c
- x86/(ffi64.c unix64.S ffiw64.c win64.S)
-)]], {'$gendir/headers'})
+pkg.deps = {
+ '$gendir/headers',
+}
+
+lib('libffi.a', [[
+ src/(
+ prep_cif.c types.c raw_api.c java_raw_api.c closures.c
+ @aarch64 aarch64/(ffi.c sysv.S)
+ @x86_64 x86/(ffi64.c unix64.S ffiw64.c win64.S)
+ )
+]])
file('lib/libffi.a', '644', '$outdir/libffi.a')
fetch 'git'