@@ -18,30 +18,42 @@ def newer(*files):
18
18
if not os .path .exists (rh ):
19
19
return True
20
20
for lh in files [:- 1 ]:
21
- if os .stat (lh ).st_ctime > os .stat (rh ).st_ctime :
21
+ if os .stat (lh ).st_mtime > os .stat (rh ).st_mtime :
22
22
return True
23
23
return False
24
24
25
25
26
26
if newer ("../blst.h" , "../libblst.a" ):
27
27
print ("building libblst.a..." ) or sys .stdout .flush ()
28
- subprocess .check_call (["../build.sh" , "-fvisibility=hidden" ] + sys .argv [1 :], cwd = ".." )
28
+ cmd = ["../build.sh" , "-fvisibility=hidden" ] + sys .argv [1 :]
29
+ if sysconfig .get_config_var ('MACHDEP' ) == 'darwin' :
30
+ cmd .extend (["-arch" , "arm64" , "-arch" , "x86_64" ])
31
+ try :
32
+ subprocess .check_call (cmd , cwd = ".." )
33
+ except :
34
+ subprocess .check_call (["sh" ] + cmd , cwd = ".." )
29
35
30
36
if newer ("../blst.swg" , "../blst.h" , "../blst.hpp" , "blst_wrap.cpp" ):
31
37
print ("swig-ing..." ) or sys .stdout .flush ()
32
38
subprocess .check_call (["swig" , "-c++" , "-python" , "-O" ,
33
39
"-o" , "blst_wrap.cpp" , "-outdir" , "." ,
34
40
"../blst.swg" ])
35
41
36
- if newer ("blst_wrap.cpp" , "../libblst.a" , "_blst.so" ):
37
- print ("compiling _blst.so..." ) or sys .stdout .flush ()
42
+ blst_so = "_blst" + sysconfig .get_config_var ('EXT_SUFFIX' )
43
+
44
+ if newer ("blst_wrap.cpp" , "../libblst.a" , blst_so ):
45
+ print ("compiling %s..." % blst_so ) or sys .stdout .flush ()
38
46
if sysconfig .get_config_var ('MACHDEP' ) == 'darwin' :
39
- cmd = ["c++" , "-bundle" , "-undefined" , "dynamic_lookup" ]
47
+ cmd = ["c++" , "-bundle" , "-undefined" , "dynamic_lookup" ,
48
+ "-arch" , "arm64" , "-arch" , "x86_64" ]
40
49
else :
41
50
cmd = ["c++" , "-shared" , "-Wl,-Bsymbolic" ]
42
- cmd .extend (["-o" , "_blst.so" , "-fPIC" , "-fvisibility=hidden" ,
51
+ cmd .extend (["-o" , blst_so , "-fPIC" , "-fvisibility=hidden" ,
43
52
"-I" + sysconfig .get_config_var ('INCLUDEPY' ), "-I.." ,
44
53
"-O" , "-Wall" , "blst_wrap.cpp" , "../libblst.a" ])
54
+ if sysconfig .get_config_var ('LIBPYTHON' ):
55
+ cmd .extend (["-L" + sysconfig .get_config_var ('LIBDIR' ),
56
+ sysconfig .get_config_var ('LIBPYTHON' )])
45
57
try :
46
58
pre = subprocess .check_output (["c++" , "-dM" , "-E" , "-x" , "c++" , "/dev/null" ],
47
59
stderr = subprocess .STDOUT )
0 commit comments