Skip to content

Commit

Permalink
Auto merge of #43975 - RalfJung:gcc, r=alexcrichton
Browse files Browse the repository at this point in the history
use gcc::Build rather than deprecated gcc::Config

I did `cargo update -p gcc` to upgrade only this package. Is there further process that should be follwoed when updating a build dependency from crates.io?

r? @alexcrichton
Fixes #43973
  • Loading branch information
bors committed Sep 6, 2017
2 parents a209539 + 13cf229 commit 3681220
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 31 deletions.
36 changes: 18 additions & 18 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/bootstrap/bin/sccache-plus-cl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ fn main() {
// Locate the actual compiler that we're invoking
env::remove_var("CC");
env::remove_var("CXX");
let mut cfg = gcc::Config::new();
let mut cfg = gcc::Build::new();
cfg.cargo_metadata(false)
.out_dir("/")
.target(&target)
.host(&target)
.opt_level(0)
.warnings(false)
.debug(false);
let compiler = cfg.get_compiler();

Expand Down
10 changes: 5 additions & 5 deletions src/bootstrap/cc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ pub fn find(build: &mut Build) {
// For all targets we're going to need a C compiler for building some shims
// and such as well as for being a linker for Rust code.
for target in build.targets.iter().chain(&build.hosts).cloned().chain(iter::once(build.build)) {
let mut cfg = gcc::Config::new();
cfg.cargo_metadata(false).opt_level(0).debug(false)
let mut cfg = gcc::Build::new();
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false)
.target(&target).host(&build.build);

let config = build.config.target_config.get(&target);
Expand All @@ -67,8 +67,8 @@ pub fn find(build: &mut Build) {

// For all host triples we need to find a C++ compiler as well
for host in build.hosts.iter().cloned().chain(iter::once(build.build)) {
let mut cfg = gcc::Config::new();
cfg.cargo_metadata(false).opt_level(0).debug(false).cpp(true)
let mut cfg = gcc::Build::new();
cfg.cargo_metadata(false).opt_level(0).warnings(false).debug(false).cpp(true)
.target(&host).host(&build.build);
let config = build.config.target_config.get(&host);
if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
Expand All @@ -82,7 +82,7 @@ pub fn find(build: &mut Build) {
}
}

fn set_compiler(cfg: &mut gcc::Config,
fn set_compiler(cfg: &mut gcc::Build,
gnu_compiler: &str,
target: Interned<String>,
config: Option<&Target>,
Expand Down
3 changes: 2 additions & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ impl Step for TestHelpers {
let _folder = build.fold_output(|| "build_test_helpers");
println!("Building test helpers");
t!(fs::create_dir_all(&dst));
let mut cfg = gcc::Config::new();
let mut cfg = gcc::Build::new();

// We may have found various cross-compilers a little differently due to our
// extra configuration, so inform gcc of these compilers. Note, though, that
Expand All @@ -306,6 +306,7 @@ impl Step for TestHelpers {
.target(&target)
.host(&build.build)
.opt_level(0)
.warnings(false)
.debug(false)
.file(build.src.join("src/rt/rust_test_helpers.c"))
.compile("librust_test_helpers.a");
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc_jemalloc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ fn main() {
_ => return,
};

let compiler = gcc::Config::new().get_compiler();
let compiler = gcc::Build::new().get_compiler();
// only msvc returns None for ar so unwrap is okay
let ar = build_helper::cc2ar(compiler.path(), &target).unwrap();
let cflags = compiler.args()
Expand Down Expand Up @@ -150,7 +150,7 @@ fn main() {
// sure the symbols are available.
if target.contains("androideabi") {
println!("cargo:rerun-if-changed=pthread_atfork_dummy.c");
gcc::Config::new()
gcc::Build::new()
.flag("-fvisibility=hidden")
.file("pthread_atfork_dummy.c")
.compile("libpthread_atfork_dummy.a");
Expand Down
2 changes: 1 addition & 1 deletion src/libprofiler_builtins/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use std::path::Path;

fn main() {
let target = env::var("TARGET").expect("TARGET was not set");
let cfg = &mut gcc::Config::new();
let cfg = &mut gcc::Build::new();

let mut profile_sources = vec!["GCDAProfiling.c",
"InstrProfiling.c",
Expand Down
3 changes: 2 additions & 1 deletion src/librustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ fn main() {
let mut cmd = Command::new(&llvm_config);
cmd.arg("--cxxflags");
let cxxflags = output(&mut cmd);
let mut cfg = gcc::Config::new();
let mut cfg = gcc::Build::new();
cfg.warnings(false);
for flag in cxxflags.split_whitespace() {
// Ignore flags like `-m64` when we're doing a cross build
if is_crossed && flag.starts_with("-m") {
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ extern crate gcc;
fn main() {
let src_dir = std::path::Path::new("../rt/hoedown/src");
build_helper::rerun_if_changed_anything_in_dir(src_dir);
let mut cfg = gcc::Config::new();
let mut cfg = gcc::Build::new();
cfg.file("../rt/hoedown/src/autolink.c")
.file("../rt/hoedown/src/buffer.c")
.file("../rt/hoedown/src/document.c")
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn main() {
fn build_libbacktrace(host: &str, target: &str) -> Result<(), ()> {
let native = native_lib_boilerplate("libbacktrace", "libbacktrace", "backtrace", ".libs")?;

let compiler = gcc::Config::new().get_compiler();
let compiler = gcc::Build::new().get_compiler();
// only msvc returns None for ar so unwrap is okay
let ar = build_helper::cc2ar(compiler.path(), target).unwrap();
let mut cflags = compiler.args().iter().map(|s| s.to_str().unwrap())
Expand Down

0 comments on commit 3681220

Please sign in to comment.