Files
Michael Forney c25f7fac36 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.
2026-05-07 23:29:49 -07:00

48 lines
1.0 KiB
Lua

local targets = {
aarch64={name='AARCH64', dir='aarch64'},
riscv64={name='RISCV', dir='riscv64'},
x86_64={name='X86_64', dir='x86'},
}
local arch = config.target.platform:match('[^-]*')
local targ = targets[arch]
if not targ then return end
cflags{
'-Wall', '-Wno-deprecated-declarations',
'-I $dir',
'-I $outdir/include',
'-I $srcdir/include',
}
build('sed', '$outdir/include/ffi.h', '$srcdir/include/ffi.h.in', {
expr={
'-e s,@VERSION@,3.3,',
string.format('-e s,@TARGET@,%s,', targ.name),
'-e s,@HAVE_LONG_DOUBLE@,1,',
'-e s,@HAVE_LONG_DOUBLE_VARIANT@,0,',
'-e s,@FFI_EXEC_TRAMPOLINE_TABLE@,0,',
},
})
pkg.hdrs = {
copy('$outdir/include', '$srcdir/src/'..targ.dir, {'ffitarget.h'}),
'$outdir/include/ffi.h',
install=true,
}
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)
@riscv64 riscv/(ffi.c sysv.S)
)
]])
file('lib/libffi.a', '644', '$outdir/libffi.a')
fetch 'git'