Skip to content

Commit 716569b

Browse files
committed
[GR-20673] Use toolchain's LLVM AR and RANLIB.
PullRequest: graalpython/811
2 parents 5952c32 + 0782531 commit 716569b

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

graalpython/lib-python/3/distutils/sysconfig_graalpython.py

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ def _init_posix():
8989
g['EXT_SUFFIX'] = "." + so_abi + so_ext
9090
g['SHLIB_SUFFIX'] = so_ext
9191
g['SO'] = "." + so_abi + so_ext # deprecated in Python 3, for backward compatibility
92-
g['AR'] = "ar"
92+
g['AR'] = sys.__graal_get_toolchain_path('AR')
93+
g['RANLIB'] = sys.__graal_get_toolchain_path('RANLIB')
9394
g['ARFLAGS'] = "rc"
9495
g['EXE'] = ""
9596
g['LIBDIR'] = os.path.join(sys.prefix, 'lib')
@@ -171,9 +172,11 @@ def customize_compiler(compiler):
171172
_osx_support.customize_compiler(_config_vars)
172173
_config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
173174

174-
(cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
175+
# TRUFFLE CHANGE BEGIN: added 'ranlib'
176+
(cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags, ranlib) = \
175177
get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
176-
'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
178+
'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS', 'RANLIB')
179+
# TRUFFLE CHANGE END
177180

178181
if 'CC' in os.environ:
179182
newcc = os.environ['CC']
@@ -207,6 +210,13 @@ def customize_compiler(compiler):
207210
archiver = ar + ' ' + os.environ['ARFLAGS']
208211
else:
209212
archiver = ar + ' ' + ar_flags
213+
# TRUFFLE CHANGE BEGIN: added 'ranlib'
214+
if compiler.executables['ranlib']:
215+
if 'RANLIB' in os.environ:
216+
ranlib = os.environ['RANLIB']
217+
else:
218+
ranlib = None
219+
# TRUFFLE CHANGE END
210220

211221
cc_cmd = cc + ' ' + cflags
212222
compiler.set_executables(
@@ -216,6 +226,11 @@ def customize_compiler(compiler):
216226
compiler_cxx=cxx,
217227
linker_so=ldshared,
218228
linker_exe=cc,
219-
archiver=archiver)
229+
archiver=archiver,
230+
# TRUFFLE CHANGE BEGIN: added 'ranlib'
231+
# Note: it will only be !=None if compiler already had a default indicating that it needs ranlib
232+
ranlib=ranlib
233+
# TRUFFLE CHANGE END
234+
)
220235

221236
compiler.shared_lib_extension = shlib_suffix

0 commit comments

Comments
 (0)