57
57
so_ext = get_config_var ("EXT_SUFFIX" )
58
58
59
59
60
- if darwin_native :
61
- get_config_vars ()["LDSHARED" ] = get_config_vars ()['LDSHARED_LINUX' ] + " -L" + sys .graal_python_capi_home + " -lpython." + get_config_vars ()["SOABI" ] + " -rpath '@loader_path/../'"
62
-
63
-
64
60
def system (cmd , msg = "" ):
65
61
logger .debug ("Running command: " + cmd )
66
62
status = os .system (cmd )
@@ -230,7 +226,7 @@ def __init__(self, name, subdir="modules", files=None, deps=[]):
230
226
self .files = [name + ".c" ]
231
227
232
228
def __call__ (self ):
233
- libs = ["polyglot-mock" ] if darwin_native else [ ]
229
+ libs = []
234
230
library_dirs = []
235
231
include_dirs = []
236
232
runtime_library_dirs = []
@@ -247,8 +243,6 @@ def __call__(self):
247
243
if dep .lib_install_dir :
248
244
libs .append (dep .lib_name )
249
245
library_dirs .append (dep .lib_install_dir )
250
- #runtime_library_dirs.append(dep.lib_install_dir)
251
- extra_link_args .append ("-Wl,-rpath," + dep .lib_install_dir )
252
246
253
247
# If the dependency provides a header file, add the include path
254
248
if dep .include_install_dir :
@@ -276,40 +270,22 @@ def __call__(self):
276
270
)
277
271
278
272
279
- class BootstrapContextManager :
280
- def __enter__ (self ):
281
- # Very special case on Darwin native: for building 'libpython*.dylib' we must not try to link against i
282
- # 'libpython', of course. It is special for Darwin because we don't link against it on Linux.
283
- if darwin_native :
284
- self .default_link_args = get_config_var ("LDSHARED" )
285
- assert get_config_vars ()["LDSHARED" ] == get_config_var ("LDSHARED" )
286
- get_config_vars ()["LDSHARED" ] = get_config_vars ()["LDSHARED_LINUX" ]
287
-
288
- def __exit__ (self , typ = None , val = None , tb = None ):
289
- if darwin_native :
290
- get_config_vars ()["LDSHARED" ] = self .default_link_args
291
-
292
-
293
273
def build_libpython (capi_home ):
294
274
src_dir = os .path .join (__dir__ , "src" )
295
275
files = [os .path .abspath (os .path .join (src_dir , f )) for f in os .listdir (src_dir ) if f .endswith (".c" )]
296
276
module = Extension (libpython_name ,
297
277
sources = files ,
298
278
extra_compile_args = cflags_warnings ,
299
- # Darwin's linker is pretty pedantic so we need to avoid any unresolved syms. To do so, we use
300
- # 'libpolyglot-mock' that provides definitions for polyglot functions and we define an install name for this lib.
301
- extra_link_args = ["-lpolyglot-mock" , "-Wl,-install_name,@rpath/" + libpython_name + so_ext ] if darwin_native else [],
302
279
)
303
280
args = [verbosity , 'build' , 'install_lib' , '-f' , '--install-dir=%s' % capi_home , "clean" ]
304
- with BootstrapContextManager ():
305
- setup (
306
- script_name = 'setup' + libpython_name ,
307
- script_args = args ,
308
- name = libpython_name ,
309
- version = '1.0' ,
310
- description = "Graal Python's C API" ,
311
- ext_modules = [module ],
312
- )
281
+ setup (
282
+ script_name = 'setup' + libpython_name ,
283
+ script_args = args ,
284
+ name = libpython_name ,
285
+ version = '1.0' ,
286
+ description = "Graal Python's C API" ,
287
+ ext_modules = [module ],
288
+ )
313
289
314
290
def build_builtin_exts (capi_home ):
315
291
args = [verbosity , 'build' , 'install_lib' , '-f' , '--install-dir=%s/modules' % capi_home , "clean" ]
0 commit comments