llconfig is llvm-config

This commit is contained in:
Tamir Duberstein 2015-05-29 12:36:13 -04:00
parent 155c8f9fa8
commit 158fcbbdd6

View File

@ -16,7 +16,7 @@ f = open(sys.argv[1], 'wb')
components = sys.argv[2].split() # splits on whitespace components = sys.argv[2].split() # splits on whitespace
enable_static = sys.argv[3] enable_static = sys.argv[3]
llconfig = sys.argv[4] llvm_config = sys.argv[4]
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at // file at the top-level directory of this distribution and at
@ -38,7 +38,7 @@ def run(args):
out, err = proc.communicate() out, err = proc.communicate()
if err: if err:
print("failed to run llconfig: args = `{}`".format(args)) print("failed to run llvm_config: args = `{}`".format(args))
print(err) print(err)
sys.exit(1) sys.exit(1)
return out return out
@ -46,7 +46,7 @@ def run(args):
f.write("\n") f.write("\n")
# LLVM libs # LLVM libs
args = [llconfig, '--libs', '--system-libs'] args = [llvm_config, '--libs', '--system-libs']
args.extend(components) args.extend(components)
out = run(args) out = run(args)
@ -68,13 +68,13 @@ for lib in out.strip().replace("\n", ' ').split(' '):
f.write(")]\n") f.write(")]\n")
# LLVM ldflags # LLVM ldflags
out = run([llconfig, '--ldflags']) out = run([llvm_config, '--ldflags'])
for lib in out.strip().split(' '): for lib in out.strip().split(' '):
if lib[:2] == "-l": if lib[:2] == "-l":
f.write("#[link(name = \"" + lib[2:] + "\")]\n") f.write("#[link(name = \"" + lib[2:] + "\")]\n")
# C++ runtime library # C++ runtime library
out = run([llconfig, '--cxxflags']) out = run([llvm_config, '--cxxflags'])
if enable_static == '1': if enable_static == '1':
assert('stdlib=libc++' not in out) assert('stdlib=libc++' not in out)
f.write("#[link(name = \"stdc++\", kind = \"static\")]\n") f.write("#[link(name = \"stdc++\", kind = \"static\")]\n")