Add a configure to disable libstd version injection
We'll use this when building snapshots so we can upgrade freely, but all compilers will inject a version by default.
This commit is contained in:
parent
7bebdbd968
commit
7a37294acc
|
@ -418,6 +418,7 @@ export CFG_PREFIX
|
||||||
export CFG_LIBDIR
|
export CFG_LIBDIR
|
||||||
export CFG_RUSTLIBDIR
|
export CFG_RUSTLIBDIR
|
||||||
export CFG_LIBDIR_RELATIVE
|
export CFG_LIBDIR_RELATIVE
|
||||||
|
export CFG_DISABLE_INJECT_STD_VERSION
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
# Subprograms
|
# Subprograms
|
||||||
|
|
|
@ -381,6 +381,7 @@ opt clang 0 "prefer clang to gcc for building the runtime"
|
||||||
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
|
opt ccache 0 "invoke gcc/clang via ccache to reuse object files between builds"
|
||||||
opt local-rust 0 "use an installed rustc rather than downloading a snapshot"
|
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 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"
|
||||||
valopt prefix "/usr/local" "set installation prefix"
|
valopt prefix "/usr/local" "set installation prefix"
|
||||||
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
|
valopt local-rust-root "/usr/local" "set prefix for local rust binary"
|
||||||
valopt llvm-root "" "set LLVM root"
|
valopt llvm-root "" "set LLVM root"
|
||||||
|
@ -1042,6 +1043,7 @@ putvar CFG_DISABLE_MANAGE_SUBMODULES
|
||||||
putvar CFG_ANDROID_CROSS_PATH
|
putvar CFG_ANDROID_CROSS_PATH
|
||||||
putvar CFG_MINGW32_CROSS_PATH
|
putvar CFG_MINGW32_CROSS_PATH
|
||||||
putvar CFG_MANDIR
|
putvar CFG_MANDIR
|
||||||
|
putvar CFG_DISABLE_INJECT_STD_VERSION
|
||||||
|
|
||||||
# Avoid spurious warnings from clang by feeding it original source on
|
# Avoid spurious warnings from clang by feeding it original source on
|
||||||
# ccache-miss rather than preprocessed input.
|
# ccache-miss rather than preprocessed input.
|
||||||
|
|
|
@ -20,7 +20,8 @@ Rust extras are part of the standard Rust distribution.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#[crate_id = "extra#0.10-pre"];
|
// NOTE: upgrade to 0.10-pre after the next snapshot
|
||||||
|
#[crate_id = "extra#0.9"];
|
||||||
#[comment = "Rust extras"];
|
#[comment = "Rust extras"];
|
||||||
#[license = "MIT/ASL2"];
|
#[license = "MIT/ASL2"];
|
||||||
#[crate_type = "rlib"];
|
#[crate_type = "rlib"];
|
||||||
|
|
|
@ -21,6 +21,9 @@ use syntax::fold;
|
||||||
use syntax::opt_vec;
|
use syntax::opt_vec;
|
||||||
use syntax::util::small_vector::SmallVector;
|
use syntax::util::small_vector::SmallVector;
|
||||||
|
|
||||||
|
// NOTE: upgrade to 0.10-pre after the next snapshot
|
||||||
|
pub static VERSION: &'static str = "0.9";
|
||||||
|
|
||||||
pub fn maybe_inject_libstd_ref(sess: Session, crate: ast::Crate)
|
pub fn maybe_inject_libstd_ref(sess: Session, crate: ast::Crate)
|
||||||
-> ast::Crate {
|
-> ast::Crate {
|
||||||
if use_std(&crate) {
|
if use_std(&crate) {
|
||||||
|
@ -53,11 +56,21 @@ struct StandardLibraryInjector {
|
||||||
sess: Session,
|
sess: Session,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn with_version(crate: &str) -> Option<(@str, ast::StrStyle)> {
|
||||||
|
match option_env!("CFG_DISABLE_INJECT_STD_VERSION") {
|
||||||
|
Some("1") => None,
|
||||||
|
_ => {
|
||||||
|
Some((format!("{}\\#{}", crate, VERSION).to_managed(),
|
||||||
|
ast::CookedStr))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl fold::Folder for StandardLibraryInjector {
|
impl fold::Folder for StandardLibraryInjector {
|
||||||
fn fold_crate(&mut self, crate: ast::Crate) -> ast::Crate {
|
fn fold_crate(&mut self, crate: ast::Crate) -> ast::Crate {
|
||||||
let mut vis = ~[ast::ViewItem {
|
let mut vis = ~[ast::ViewItem {
|
||||||
node: ast::ViewItemExternMod(self.sess.ident_of("std"),
|
node: ast::ViewItemExternMod(self.sess.ident_of("std"),
|
||||||
None,
|
with_version("std"),
|
||||||
ast::DUMMY_NODE_ID),
|
ast::DUMMY_NODE_ID),
|
||||||
attrs: ~[],
|
attrs: ~[],
|
||||||
vis: ast::Private,
|
vis: ast::Private,
|
||||||
|
@ -67,7 +80,7 @@ impl fold::Folder for StandardLibraryInjector {
|
||||||
if use_uv(&crate) && !self.sess.building_library.get() {
|
if use_uv(&crate) && !self.sess.building_library.get() {
|
||||||
vis.push(ast::ViewItem {
|
vis.push(ast::ViewItem {
|
||||||
node: ast::ViewItemExternMod(self.sess.ident_of("green"),
|
node: ast::ViewItemExternMod(self.sess.ident_of("green"),
|
||||||
None,
|
with_version("green"),
|
||||||
ast::DUMMY_NODE_ID),
|
ast::DUMMY_NODE_ID),
|
||||||
attrs: ~[],
|
attrs: ~[],
|
||||||
vis: ast::Private,
|
vis: ast::Private,
|
||||||
|
@ -75,7 +88,7 @@ impl fold::Folder for StandardLibraryInjector {
|
||||||
});
|
});
|
||||||
vis.push(ast::ViewItem {
|
vis.push(ast::ViewItem {
|
||||||
node: ast::ViewItemExternMod(self.sess.ident_of("rustuv"),
|
node: ast::ViewItemExternMod(self.sess.ident_of("rustuv"),
|
||||||
None,
|
with_version("rustuv"),
|
||||||
ast::DUMMY_NODE_ID),
|
ast::DUMMY_NODE_ID),
|
||||||
attrs: ~[],
|
attrs: ~[],
|
||||||
vis: ast::Private,
|
vis: ast::Private,
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
use driver::session;
|
use driver::session;
|
||||||
use front::config;
|
use front::config;
|
||||||
|
use front::std_inject::with_version;
|
||||||
|
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::vec;
|
use std::vec;
|
||||||
|
@ -292,7 +293,7 @@ fn mk_std(cx: &TestCtxt) -> ast::ViewItem {
|
||||||
ast::DUMMY_NODE_ID))])
|
ast::DUMMY_NODE_ID))])
|
||||||
} else {
|
} else {
|
||||||
ast::ViewItemExternMod(id_extra,
|
ast::ViewItemExternMod(id_extra,
|
||||||
None,
|
with_version("extra"),
|
||||||
ast::DUMMY_NODE_ID)
|
ast::DUMMY_NODE_ID)
|
||||||
};
|
};
|
||||||
ast::ViewItem {
|
ast::ViewItem {
|
||||||
|
|
Loading…
Reference in New Issue