Skip to content

LLVM build cleanup #26822

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 6, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion mk/main.mk
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ LLVM_BINDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --bindir)
LLVM_INCDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --includedir)
LLVM_LIBDIR_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libdir)
LLVM_LIBDIR_RUSTFLAGS_$(1)=-L "$$(LLVM_LIBDIR_$(1))"
LLVM_LIBS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --libs $$(LLVM_COMPONENTS))
LLVM_LDFLAGS_$(1)=$$(shell "$$(LLVM_CONFIG_$(1))" --ldflags)
ifeq ($$(findstring freebsd,$(1)),freebsd)
# On FreeBSD, it may search wrong headers (that are for pre-installed LLVM),
Expand Down
13 changes: 6 additions & 7 deletions src/etc/mklldeps.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

f = open(sys.argv[1], 'wb')

components = sys.argv[2].split(' ')
components = [i for i in components if i] # ignore extra whitespaces
components = sys.argv[2].split() # splits on whitespace
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
// file at the top-level directory of this distribution and at
Expand All @@ -39,15 +38,15 @@ def run(args):
out, err = proc.communicate()

if err:
print("failed to run llconfig: args = `{}`".format(args))
print("failed to run llvm_config: args = `{}`".format(args))
print(err)
sys.exit(1)
return out

f.write("\n")

# LLVM libs
args = [llconfig, '--libs', '--system-libs']
args = [llvm_config, '--libs', '--system-libs']

args.extend(components)
out = run(args)
Expand All @@ -69,13 +68,13 @@ def run(args):
f.write(")]\n")

# LLVM ldflags
out = run([llconfig, '--ldflags'])
out = run([llvm_config, '--ldflags'])
for lib in out.strip().split(' '):
if lib[:2] == "-l":
f.write("#[link(name = \"" + lib[2:] + "\")]\n")

# C++ runtime library
out = run([llconfig, '--cxxflags'])
out = run([llvm_config, '--cxxflags'])
if enable_static == '1':
assert('stdlib=libc++' not in out)
f.write("#[link(name = \"stdc++\", kind = \"static\")]\n")
Expand Down