diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cdbabeaddfb..429996126f9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -93,11 +93,6 @@ system internals, try asking in [`#rust-internals`][pound-rust-internals]. [bootstrap]: https://github.com/rust-lang/rust/tree/master/src/bootstrap/ -> **Note**: the build system was recently rewritten from a jungle of makefiles -> to the current incarnation you'll see in `src/bootstrap`. If you experience -> bugs you can temporarily revert back to the makefiles with -> `--disable-rustbuild` passed to `./configure`. - ### Configuration Before you can start building the compiler you need to configure the build for diff --git a/src/liballoc_jemalloc/build.rs b/src/liballoc_jemalloc/build.rs index cb7852995f3..a3402bf3994 100644 --- a/src/liballoc_jemalloc/build.rs +++ b/src/liballoc_jemalloc/build.rs @@ -21,7 +21,6 @@ use std::process::Command; use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date}; fn main() { - println!("cargo:rustc-cfg=cargobuild"); println!("cargo:rerun-if-changed=build.rs"); // FIXME: This is a hack to support building targets that don't diff --git a/src/liballoc_jemalloc/lib.rs b/src/liballoc_jemalloc/lib.rs index fc8a5455d1d..8d81a09f5af 100644 --- a/src/liballoc_jemalloc/lib.rs +++ b/src/liballoc_jemalloc/lib.rs @@ -30,22 +30,6 @@ pub use imp::*; mod imp { use libc::{c_int, c_void, size_t}; - // Linkage directives to pull in jemalloc and its dependencies. - // - // On some platforms we need to be sure to link in `pthread` which jemalloc - // depends on, and specifically on android we need to also link to libgcc. - // Currently jemalloc is compiled with gcc which will generate calls to - // intrinsics that are libgcc specific (e.g. those intrinsics aren't present in - // libcompiler-rt), so link that in to get that support. - #[link(name = "jemalloc", kind = "static")] - #[cfg_attr(target_os = "android", link(name = "gcc"))] - #[cfg_attr(all(not(windows), - not(target_os = "android"), - not(target_env = "musl")), - link(name = "pthread"))] - #[cfg(not(cargobuild))] - extern "C" {} - // Note that the symbols here are prefixed by default on OSX and Windows (we // don't explicitly request it), and on Android and DragonFly we explicitly // request it as unprefixing cause segfaults (mismatches in allocators). diff --git a/src/libflate/build.rs b/src/libflate/build.rs index 245c705dfcc..12016980a2c 100644 --- a/src/libflate/build.rs +++ b/src/libflate/build.rs @@ -11,7 +11,6 @@ extern crate gcc; fn main() { - println!("cargo:rustc-cfg=cargobuild"); gcc::Config::new() .file("../rt/miniz.c") .compile("libminiz.a"); diff --git a/src/libflate/lib.rs b/src/libflate/lib.rs index 8365e9db2a9..dedec7b1609 100644 --- a/src/libflate/lib.rs +++ b/src/libflate/lib.rs @@ -74,10 +74,6 @@ impl Drop for Bytes { } } -#[link(name = "miniz", kind = "static")] -#[cfg(not(cargobuild))] -extern "C" {} - extern "C" { /// Raw miniz compression function. fn tdefl_compress_mem_to_heap(psrc_buf: *const c_void, diff --git a/src/libpanic_unwind/gcc.rs b/src/libpanic_unwind/gcc.rs index e8b3a9a42c2..84abc6bc4a5 100644 --- a/src/libpanic_unwind/gcc.rs +++ b/src/libpanic_unwind/gcc.rs @@ -301,10 +301,6 @@ unsafe extern "C" fn rust_eh_unwind_resume(panic_ctx: *mut u8) -> ! { // with any GCC runtime. #[cfg(all(target_os="windows", target_arch = "x86", target_env="gnu"))] pub mod eh_frame_registry { - #[link(name = "gcc_eh")] - #[cfg(not(cargobuild))] - extern "C" {} - extern "C" { fn __register_frame_info(eh_frame_begin: *const u8, object: *mut u8); fn __deregister_frame_info(eh_frame_begin: *const u8, object: *mut u8); diff --git a/src/librustc_llvm/build.rs b/src/librustc_llvm/build.rs index 2ee4cc49435..c74a9308e4e 100644 --- a/src/librustc_llvm/build.rs +++ b/src/librustc_llvm/build.rs @@ -47,8 +47,6 @@ fn detect_llvm_link(llvm_config: &Path) -> (&'static str, Option<&'static str>) } fn main() { - println!("cargo:rustc-cfg=cargobuild"); - let target = env::var("TARGET").expect("TARGET was not set"); let llvm_config = env::var_os("LLVM_CONFIG") .map(PathBuf::from) diff --git a/src/librustc_llvm/lib.rs b/src/librustc_llvm/lib.rs index b1615b9e38b..f300bf16145 100644 --- a/src/librustc_llvm/lib.rs +++ b/src/librustc_llvm/lib.rs @@ -422,13 +422,3 @@ impl Drop for OperandBundleDef { } } } - -// The module containing the native LLVM dependencies, generated by the build system -// Note that this must come after the rustllvm extern declaration so that -// parts of LLVM that rustllvm depends on aren't thrown away by the linker. -// Works to the above fix for #15460 to ensure LLVM dependencies that -// are only used by rustllvm don't get stripped by the linker. -#[cfg(not(cargobuild))] -mod llvmdeps { - include! { env!("CFG_LLVM_LINKAGE_FILE") } -} diff --git a/src/librustdoc/build.rs b/src/librustdoc/build.rs index 171954f325a..fcb7af11dce 100644 --- a/src/librustdoc/build.rs +++ b/src/librustdoc/build.rs @@ -11,7 +11,6 @@ extern crate gcc; fn main() { - println!("cargo:rustc-cfg=cargobuild"); let mut cfg = gcc::Config::new(); cfg.file("../rt/hoedown/src/autolink.c") .file("../rt/hoedown/src/buffer.c") diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index e8ff8930bdd..a0f4a3a8743 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -162,11 +162,6 @@ struct hoedown_buffer { unit: libc::size_t, } -// hoedown FFI -#[link(name = "hoedown", kind = "static")] -#[cfg(not(cargobuild))] -extern {} - extern { fn hoedown_html_renderer_new(render_flags: libc::c_uint, nesting_level: libc::c_int) diff --git a/src/libstd/build.rs b/src/libstd/build.rs index a0844821709..0fca374f6e6 100644 --- a/src/libstd/build.rs +++ b/src/libstd/build.rs @@ -21,7 +21,6 @@ use std::process::Command; use build_helper::{run, rerun_if_changed_anything_in_dir, up_to_date}; fn main() { - println!("cargo:rustc-cfg=cargobuild"); println!("cargo:rerun-if-changed=build.rs"); let target = env::var("TARGET").expect("TARGET was not set"); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 9bcecebf693..4279db7754a 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -463,9 +463,6 @@ mod panicking; mod rand; mod memchr; -// This module just defines per-platform native library dependencies -mod rtdeps; - // The runtime entry point and a few unstable public functions used by the // compiler pub mod rt; diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs index e5edea241e1..d76e8816ca4 100644 --- a/src/libstd/panicking.rs +++ b/src/libstd/panicking.rs @@ -311,12 +311,12 @@ impl<'a> Location<'a> { } fn default_hook(info: &PanicInfo) { - #[cfg(any(not(cargobuild), feature = "backtrace"))] + #[cfg(feature = "backtrace")] use sys_common::backtrace; // If this is a double panic, make sure that we print a backtrace // for this panic. Otherwise only print it if logging is enabled. - #[cfg(any(not(cargobuild), feature = "backtrace"))] + #[cfg(feature = "backtrace")] let log_backtrace = { let panics = update_panic_count(0); @@ -341,7 +341,7 @@ fn default_hook(info: &PanicInfo) { let _ = writeln!(err, "thread '{}' panicked at '{}', {}:{}", name, msg, file, line); - #[cfg(any(not(cargobuild), feature = "backtrace"))] + #[cfg(feature = "backtrace")] { use sync::atomic::{AtomicBool, Ordering}; diff --git a/src/libstd/rtdeps.rs b/src/libstd/rtdeps.rs deleted file mode 100644 index 5dc6ee2bc8c..00000000000 --- a/src/libstd/rtdeps.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -//! This module contains the linkage attributes to all runtime dependencies of -//! the standard library This varies per-platform, but these libraries are -//! necessary for running libstd. - -#![cfg(not(cargobuild))] - -// LLVM implements the `frem` instruction as a call to `fmod`, which lives in -// libm. Hence, we must explicitly link to it. -// -// On Linux, librt and libdl are indirect dependencies via std, -// and binutils 2.22+ won't add them automatically -#[cfg(all(target_os = "linux", not(target_env = "musl")))] -#[link(name = "dl")] -#[link(name = "pthread")] -extern {} - -#[cfg(target_os = "android")] -#[link(name = "dl")] -#[link(name = "log")] -extern {} - -#[cfg(target_os = "freebsd")] -#[link(name = "execinfo")] -#[link(name = "pthread")] -extern {} - -#[cfg(any(target_os = "dragonfly", - target_os = "bitrig", - target_os = "netbsd", - target_os = "openbsd"))] -#[link(name = "pthread")] -extern {} - -#[cfg(target_os = "solaris")] -#[link(name = "socket")] -#[link(name = "posix4")] -#[link(name = "pthread")] -extern {} - -// For PNaCl targets, nacl_io is a Pepper wrapper for some IO functions -// missing (ie always error) in Newlib. -#[cfg(all(target_os = "nacl", not(test)))] -#[link(name = "nacl_io", kind = "static")] -#[link(name = "c++", kind = "static")] // for `nacl_io` and EH. -#[link(name = "pthread", kind = "static")] -extern {} - -#[cfg(target_os = "macos")] -#[link(name = "System")] -extern {} - -#[cfg(target_os = "ios")] -#[link(name = "System")] -extern {} - -#[cfg(target_os = "haiku")] -#[link(name = "network")] -extern {} diff --git a/src/libstd/sys/unix/args.rs b/src/libstd/sys/unix/args.rs index 0f447ff4ec4..6e35a472792 100644 --- a/src/libstd/sys/unix/args.rs +++ b/src/libstd/sys/unix/args.rs @@ -189,11 +189,6 @@ mod imp { fn objc_msgSend_ul(obj: NsId, sel: Sel, ...) -> NsId; } - #[link(name = "Foundation", kind = "framework")] - #[link(name = "objc")] - #[cfg(not(cargobuild))] - extern {} - type Sel = *const libc::c_void; type NsId = *const libc::c_void; diff --git a/src/libstd/sys/unix/mod.rs b/src/libstd/sys/unix/mod.rs index fd7dc17cccd..c57751a01d7 100644 --- a/src/libstd/sys/unix/mod.rs +++ b/src/libstd/sys/unix/mod.rs @@ -33,7 +33,7 @@ pub mod weak; pub mod args; pub mod android; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] pub mod backtrace; pub mod condvar; pub mod env; diff --git a/src/libstd/sys/unix/rand.rs b/src/libstd/sys/unix/rand.rs index 9b1cf6ffd0e..77ebad4e344 100644 --- a/src/libstd/sys/unix/rand.rs +++ b/src/libstd/sys/unix/rand.rs @@ -257,10 +257,6 @@ mod imp { #[allow(non_upper_case_globals)] const kSecRandomDefault: *const SecRandom = ptr::null(); - #[link(name = "Security", kind = "framework")] - #[cfg(not(cargobuild))] - extern {} - extern { fn SecRandomCopyBytes(rnd: *const SecRandom, count: size_t, bytes: *mut u8) -> c_int; diff --git a/src/libstd/sys/windows/c.rs b/src/libstd/sys/windows/c.rs index 850d6f49612..e5010ca3564 100644 --- a/src/libstd/sys/windows/c.rs +++ b/src/libstd/sys/windows/c.rs @@ -833,13 +833,6 @@ pub struct CONSOLE_READCONSOLE_CONTROL { } pub type PCONSOLE_READCONSOLE_CONTROL = *mut CONSOLE_READCONSOLE_CONTROL; -#[link(name = "ws2_32")] -#[link(name = "userenv")] -#[link(name = "shell32")] -#[link(name = "advapi32")] -#[cfg(not(cargobuild))] -extern {} - extern "system" { pub fn WSAStartup(wVersionRequested: WORD, lpWSAData: LPWSADATA) -> c_int; diff --git a/src/libstd/sys_common/gnu/libbacktrace.rs b/src/libstd/sys_common/gnu/libbacktrace.rs index d464a13ad1d..0bdbeddb112 100644 --- a/src/libstd/sys_common/gnu/libbacktrace.rs +++ b/src/libstd/sys_common/gnu/libbacktrace.rs @@ -39,9 +39,6 @@ pub fn print(w: &mut Write, idx: isize, addr: *mut libc::c_void, msg: *const libc::c_char, errnum: libc::c_int); enum backtrace_state {} - #[link(name = "backtrace", kind = "static")] - #[cfg(all(not(test), not(cargobuild)))] - extern {} extern { fn backtrace_create_state(filename: *const libc::c_char, diff --git a/src/libstd/sys_common/mod.rs b/src/libstd/sys_common/mod.rs index 634d6258885..d4d3365dc01 100644 --- a/src/libstd/sys_common/mod.rs +++ b/src/libstd/sys_common/mod.rs @@ -29,7 +29,7 @@ use sync::Once; use sys; pub mod at_exit_imp; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] pub mod backtrace; pub mod condvar; pub mod io; @@ -50,7 +50,7 @@ pub use sys::net; #[cfg(not(target_os = "redox"))] pub mod net; -#[cfg(any(not(cargobuild), feature = "backtrace"))] +#[cfg(feature = "backtrace")] #[cfg(any(all(unix, not(any(target_os = "macos", target_os = "ios", target_os = "emscripten"))), all(windows, target_env = "gnu")))] pub mod gnu; diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs index db41a368a16..f18b694d3d0 100644 --- a/src/libunwind/build.rs +++ b/src/libunwind/build.rs @@ -11,8 +11,6 @@ use std::env; fn main() { - println!("cargo:rustc-cfg=cargobuild"); - let target = env::var("TARGET").expect("TARGET was not set"); if target.contains("linux") { diff --git a/src/libunwind/libunwind.rs b/src/libunwind/libunwind.rs index 269c2d65b63..7fb58373251 100644 --- a/src/libunwind/libunwind.rs +++ b/src/libunwind/libunwind.rs @@ -240,34 +240,3 @@ if #[cfg(not(all(target_os = "ios", target_arch = "arm")))] { } } } // cfg_if! - -#[cfg_attr(any(all(target_os = "linux", not(target_env = "musl")), - target_os = "freebsd", - target_os = "solaris", - target_os = "haiku", - all(target_os = "linux", - target_env = "musl", - not(target_arch = "x86"), - not(target_arch = "x86_64"))), - link(name = "gcc_s"))] -#[cfg_attr(all(target_os = "linux", - target_env = "musl", - any(target_arch = "x86", target_arch = "x86_64"), - not(test)), - link(name = "unwind", kind = "static"))] -#[cfg_attr(target_os = "fuchsia", - link(name = "unwind"))] -#[cfg_attr(any(target_os = "android", target_os = "openbsd"), - link(name = "gcc"))] -#[cfg_attr(all(target_os = "netbsd", not(target_vendor = "rumprun")), - link(name = "gcc"))] -#[cfg_attr(all(target_os = "netbsd", target_vendor = "rumprun"), - link(name = "unwind"))] -#[cfg_attr(target_os = "dragonfly", - link(name = "gcc_pic"))] -#[cfg_attr(target_os = "bitrig", - link(name = "c++abi"))] -#[cfg_attr(all(target_os = "windows", target_env = "gnu"), - link(name = "gcc_eh"))] -#[cfg(not(cargobuild))] -extern "C" {} diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml index 2982f29f931..3049875e86e 100644 --- a/src/tools/compiletest/Cargo.toml +++ b/src/tools/compiletest/Cargo.toml @@ -2,7 +2,6 @@ authors = ["The Rust Project Developers"] name = "compiletest" version = "0.0.0" -build = "build.rs" [dependencies] log = "0.3" diff --git a/src/tools/compiletest/build.rs b/src/tools/compiletest/build.rs deleted file mode 100644 index d5164b9b759..00000000000 --- a/src/tools/compiletest/build.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn main() { - println!("cargo:rustc-cfg=cargobuild"); -} diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 43d02479fb1..c2997c8c160 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -21,16 +21,9 @@ extern crate libc; extern crate test; extern crate getopts; - -#[cfg(cargobuild)] extern crate rustc_serialize; -#[cfg(not(cargobuild))] -extern crate serialize as rustc_serialize; - #[macro_use] extern crate log; - -#[cfg(cargobuild)] extern crate env_logger; use std::env; @@ -58,11 +51,7 @@ mod raise_fd_limit; mod uidiff; fn main() { - #[cfg(cargobuild)] - fn log_init() { env_logger::init().unwrap(); } - #[cfg(not(cargobuild))] - fn log_init() {} - log_init(); + env_logger::init().unwrap(); let config = parse_config(env::args().collect());