summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2020-02-29 14:58:12 -0800
committerMichael Forney <mforney@mforney.org>2020-03-01 19:24:52 -0800
commitd2e28f93b38666ec241c679e404398d32a9a18ae (patch)
treed804b35978ed065a27a996a6f1277fdc2c298d9d
parent29e6bebb30f68df596b88f85866ba2928c0dfc2e (diff)
libffi: Add support for aarch64
-rw-r--r--pkg/libffi/fficonfig.h2
-rw-r--r--pkg/libffi/gen.lua20
2 files changed, 16 insertions, 6 deletions
diff --git a/pkg/libffi/fficonfig.h b/pkg/libffi/fficonfig.h
index a77dc4f5..88901507 100644
--- 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
index 8fd4e729..0ae314eb 100644
--- 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'