commit 98b8377
Michael Forney
·
2026-05-08 06:08:11 +0000 UTC
parent 38334e5
libffi: Add table with arch name and dir Although nothing checks for RISCV, riscv64 uses RISCV as the target define, not arch:upper() like the other targets.
1 files changed,
+10,
-2
+10,
-2
1@@ -1,4 +1,12 @@
2+local targets = {
3+ aarch64={name='AARCH64', dir='aarch64'},
4+ riscv64={name='RISCV', dir='riscv64'},
5+ x86_64={name='X86_64', dir='x86'},
6+}
7 local arch = config.target.platform:match('[^-]*')
8+local targ = targets[arch]
9+if not targ then return end
10+
11 cflags{
12 '-Wall', '-Wno-deprecated-declarations',
13 '-I $dir',
14@@ -9,7 +17,7 @@ cflags{
15 build('sed', '$outdir/include/ffi.h', '$srcdir/include/ffi.h.in', {
16 expr={
17 '-e s,@VERSION@,3.3,',
18- string.format('-e s,@TARGET@,%s,', arch:upper()),
19+ string.format('-e s,@TARGET@,%s,', targ.name),
20 '-e s,@HAVE_LONG_DOUBLE@,1,',
21 '-e s,@HAVE_LONG_DOUBLE_VARIANT@,0,',
22 '-e s,@FFI_EXEC_TRAMPOLINE_TABLE@,0,',
23@@ -17,7 +25,7 @@ build('sed', '$outdir/include/ffi.h', '$srcdir/include/ffi.h.in', {
24 })
25
26 pkg.hdrs = {
27- copy('$outdir/include', '$srcdir/src/'..({x86_64='x86', aarch64='aarch64', riscv64='riscv'})[arch], {'ffitarget.h'}),
28+ copy('$outdir/include', '$srcdir/src/'..targ.dir, {'ffitarget.h'}),
29 '$outdir/include/ffi.h',
30 install=true,
31 }