-
Notifications
You must be signed in to change notification settings - Fork 6
/
SConscript.ffi
79 lines (74 loc) · 1.62 KB
/
SConscript.ffi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Import('env')
ffiarch = {
'i386' : 'X86',
'x64' : 'X86',
'powerpc' : 'POWERPC',
'mips': 'MIPS',
}[env['ARCH']]
ffios = {
'netbsd' : '_FREEBSD',
'freebsd' : '_FREEBSD',
'openbsd' : '_FREEBSD',
'dragonfly' : '_FREEBSD',
'darwin' : '_DARWIN',
'linux' : '',
'win32' : '',
}[env['OS']]
env.Append(CPPDEFINES=[
['TARGET', ffiarch + ffios],
[ffiarch + ffios, 1],
['HAVE_LONG_DOUBLE', 1],
])
ffiarchbase = {
'i386' : 'x86',
'x64' : 'x86',
'powerpc': 'powerpc',
'mips': 'mips',
}[env['ARCH']]
bsdfiles = {
'powerpc' : 'freebsd.S',
'mips' : 'freebsd.S',
'i386' : 'freebsd.S',
'x64' : 'unix64.S',
}[env['ARCH']]
ffiossrc = {
'darwin' : {
'x64': 'darwin64.S',
'i386': 'darwin.S',
}[env['ARCH']],
'linux' : {
'powerpc' : 'sysv.S ppc_closure.S',
'i386' : 'sysv.S',
'x64' : 'unix64.S',
}[env['ARCH']],
'freebsd' : bsdfiles,
'openbsd' : bsdfiles,
'netbsd' : bsdfiles,
'dragonfly' : bsdfiles,
'win32' : 'win32.S',
}[env['OS']]
if env['ARCH'] == 'mips' and ffiossrc == 'freebsd.S':
ffiossrc = 'o32.S'
env.Append(CPPDEFINES=[['FFI_MIPS_O32', 1]])
if ffiossrc in ['unix64.S', 'darwin64.S']:
plat = ffiarchbase + '/ffi64.c '
else:
plat = ffiarchbase + '/ffi.c '
fficpppath = [
'libs/libffi/include',
'libs/libffi/src/',
'libs/libffi/src/' + ffiarchbase,
'libs/libffi/',
]
env.Append(CPPPATH=fficpppath)
platasm = []
for i in Split(ffiossrc):
e = env.Clone()
e.Append(CPPDEFINES=[['LIBFFI_ASM', 1]])
platasm += e.CppAsm(i + '.o', 'libs/libffi/src/' + ffiarchbase + '/' + i)
env.Library('ffi', ['libs/libffi/src/' + i for i in Split('''
debug.c
prep_cif.c
types.c
closures.c
''' + plat)] + platasm)