opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
opt pax-flags 0 "apply PaX flags to rustc binaries (required for GRSecurity/PaX-patched kernels)"
opt inject-std-version 1 "inject the current compiler version of libstd into programs"
+opt llvm-static-stdcpp 0 "statically link to libstdc++ for LLVM"
opt rpath 1 "build rpaths into rustc itself"
opt nightly 0 "build nightly packages"
opt verify-install 1 "verify installed binaries work"
@$$(call E, make: done cleaning llvm)
touch $$@
+ifeq ($$(CFG_ENABLE_LLVM_STATIC_STDCPP),1)
+LLVM_STDCPP_LOCATION_$(1) = $$(shell $$(CC_$(1)) $$(CFG_GCCISH_CFLAGS_$(1)) \
+ -print-file-name=libstdc++.a)
+else
+LLVM_STDCPP_LOCATION_$(1) =
+endif
+
endef
$(foreach host,$(CFG_HOST), \
- $(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
+ $(eval $(call DEF_LLVM_RULES,$(host))))
$(foreach host,$(CFG_HOST), \
- $(eval $(call DEF_LLVM_RULES,$(host))))
+ $(eval LLVM_CONFIGS := $(LLVM_CONFIGS) $(LLVM_CONFIG_$(host))))
$(S)src/librustc/lib/llvmdeps.rs: \
$(LLVM_CONFIGS) \
- $(S)src/etc/mklldeps.py
+ $(S)src/etc/mklldeps.py \
+ $(MKFILE_DEPS)
$(Q)$(CFG_PYTHON) $(S)src/etc/mklldeps.py \
- "$@" "$(LLVM_COMPONENTS)" $(LLVM_CONFIGS)
+ "$@" "$(LLVM_COMPONENTS)" "$(CFG_ENABLE_LLVM_STATIC_STDCPP)" \
+ $(LLVM_CONFIGS)
$$(WFLAGS_ST$(1)) \
-L "$$(RT_OUTPUT_DIR_$(2))" \
-L "$$(LLVM_LIBDIR_$(2))" \
+ -L "$$(dir $$(LLVM_STDCPP_LOCATION_$(2)))" \
--out-dir $$(@D) $$<
@touch $$@
$$(call LIST_ALL_OLD_GLOB_MATCHES,\
import os
import sys
import subprocess
+import itertools
+from os import path
f = open(sys.argv[1], 'wb')
components = sys.argv[2].split(' ')
components = [i for i in components if i] # ignore extra whitespaces
+enable_static = sys.argv[3]
f.write("""// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
sys.exit(1)
return out
-for llconfig in sys.argv[3:]:
+for llconfig in sys.argv[4:]:
f.write("\n")
out = run([llconfig, '--host-target'])
# C++ runtime library
out = run([llconfig, '--cxxflags'])
- if 'stdlib=libc++' in out:
- f.write("#[link(name = \"c++\")]\n")
+ if enable_static == '1':
+ assert('stdlib=libc++' not in out)
+ f.write("#[link(name = \"stdc++\", kind = \"static\")]\n")
else:
+ if 'stdlib=libc++' in out:
+ f.write("#[link(name = \"c++\")]\n")
+ else:
f.write("#[link(name = \"stdc++\")]\n")
# Attach everything to an extern block