diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-04-16 10:45:04 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-04-17 11:39:51 -0700 |
| commit | acdee8b904178e13616cea8c31bcdb1f063ddef5 (patch) | |
| tree | 94f61225760e85142266ed53cdf3d27295ced683 /src | |
| parent | 36d5635273f7759b9aedce04bc8b111edb9c0742 (diff) | |
| download | rust-acdee8b904178e13616cea8c31bcdb1f063ddef5.tar.gz rust-acdee8b904178e13616cea8c31bcdb1f063ddef5.zip | |
llvm: Add an option to statically link libstdc++
The goal of the snapshot bots is to produce binaries which can run in as many locations as possible. Currently we build on Centos 6 for this reason, but with LLVM's update to C++11, this reduces the number of platforms that we could possibly run on. This adds a --enable-llvm-static-stdcpp option to the ./configure script for Rust which will enable building a librustc with a static dependence on libstdc++. This normally isn't necessary, but this option can be used on the snapshot builders in order to continue to make binaries which should be able to run in as many locations as possible.
Diffstat (limited to 'src')
| -rw-r--r-- | src/etc/mklldeps.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/etc/mklldeps.py b/src/etc/mklldeps.py index 364564168a5..f745f5d61cb 100644 --- a/src/etc/mklldeps.py +++ b/src/etc/mklldeps.py @@ -11,11 +11,14 @@ 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 @@ -41,7 +44,7 @@ def run(args): 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']) @@ -94,9 +97,13 @@ for llconfig in sys.argv[3:]: # 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 |
