Skip to content
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

use gcc::Build rather than deprecated gcc::Config #43975

Merged
merged 2 commits into from
Sep 6, 2017
Merged
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
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
@@ -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();

10 changes: 5 additions & 5 deletions src/bootstrap/cc.rs
Original file line number Diff line number Diff line change
@@ -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);
@@ -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()) {
@@ -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>,
3 changes: 2 additions & 1 deletion src/bootstrap/native.rs
Original file line number Diff line number Diff line change
@@ -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
@@ -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");
4 changes: 2 additions & 2 deletions src/liballoc_jemalloc/build.rs
Original file line number Diff line number Diff line change
@@ -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()
@@ -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");
2 changes: 1 addition & 1 deletion src/libprofiler_builtins/build.rs
Original file line number Diff line number Diff line change
@@ -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",
3 changes: 2 additions & 1 deletion src/librustc_llvm/build.rs
Original file line number Diff line number Diff line change
@@ -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") {
2 changes: 1 addition & 1 deletion src/librustdoc/build.rs
Original file line number Diff line number Diff line change
@@ -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")
2 changes: 1 addition & 1 deletion src/libstd/build.rs
Original file line number Diff line number Diff line change
@@ -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())