mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-07-21 02:29:22 +00:00
34 lines
1.0 KiB
INI
34 lines
1.0 KiB
INI
|
import distutils.spawn
|
||
|
import os
|
||
|
import pipes
|
||
|
import shlex
|
||
|
|
||
|
if not 'go' in config.root.llvm_bindings:
|
||
|
config.unsupported = True
|
||
|
|
||
|
# Resolve certain symlinks in the first word of compiler.
|
||
|
#
|
||
|
# This is a Go-specific hack. cgo and other Go tools check $CC and $CXX for the
|
||
|
# substring 'clang' to determine if the compiler is Clang. This won't work if
|
||
|
# $CC is cc and cc is a symlink pointing to clang, as it is on Darwin.
|
||
|
def fixup_compiler_path(compiler):
|
||
|
args = shlex.split(compiler)
|
||
|
path = distutils.spawn.find_executable(args[0])
|
||
|
|
||
|
try:
|
||
|
if path.endswith('/cc') and os.readlink(path) == 'clang':
|
||
|
args[0] = path[:len(path)-2] + 'clang'
|
||
|
except OSError:
|
||
|
skip
|
||
|
|
||
|
try:
|
||
|
if path.endswith('/c++') and os.readlink(path) == 'clang++':
|
||
|
args[0] = path[:len(path)-3] + 'clang++'
|
||
|
except OSError:
|
||
|
skip
|
||
|
|
||
|
return ' '.join([pipes.quote(arg) for arg in args])
|
||
|
|
||
|
config.environment['CC'] = fixup_compiler_path(config.host_cc)
|
||
|
config.environment['CXX'] = fixup_compiler_path(config.host_cxx)
|