2015-11-19 15:20:12 -08:00
|
|
|
// Copyright 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 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2016-05-02 15:16:15 -07:00
|
|
|
//! Serialized configuration of a build.
|
|
|
|
//!
|
2017-08-26 15:01:48 -07:00
|
|
|
//! This module implements parsing `config.toml` configuration files to tweak
|
|
|
|
//! how the build runs.
|
2016-05-02 15:16:15 -07:00
|
|
|
|
2018-02-05 20:10:05 +03:00
|
|
|
use std::collections::{HashMap, HashSet};
|
2015-11-19 15:20:12 -08:00
|
|
|
use std::env;
|
2018-03-27 16:06:47 +02:00
|
|
|
use std::fs::{self, File};
|
2015-11-19 15:20:12 -08:00
|
|
|
use std::io::prelude::*;
|
2018-02-19 16:08:36 -08:00
|
|
|
use std::path::{Path, PathBuf};
|
2015-11-19 15:20:12 -08:00
|
|
|
use std::process;
|
2017-07-29 22:12:53 -06:00
|
|
|
use std::cmp;
|
2015-11-19 15:20:12 -08:00
|
|
|
|
|
|
|
use num_cpus;
|
2017-07-04 10:03:01 -06:00
|
|
|
use toml;
|
2017-07-13 18:48:44 -06:00
|
|
|
use cache::{INTERNER, Interned};
|
2017-07-29 22:12:53 -06:00
|
|
|
use flags::Flags;
|
|
|
|
pub use flags::Subcommand;
|
2015-11-19 15:20:12 -08:00
|
|
|
|
|
|
|
/// Global configuration for the entire build and/or bootstrap.
|
|
|
|
///
|
|
|
|
/// This structure is derived from a combination of both `config.toml` and
|
|
|
|
/// `config.mk`. As of the time of this writing it's unlikely that `config.toml`
|
|
|
|
/// is used all that much, so this is primarily filled out by `config.mk` which
|
|
|
|
/// is generated from `./configure`.
|
|
|
|
///
|
|
|
|
/// Note that this structure is not decoded directly into, but rather it is
|
2016-05-02 15:16:15 -07:00
|
|
|
/// filled out from the decoded forms of the structs below. For documentation
|
|
|
|
/// each field, see the corresponding fields in
|
2017-08-11 22:24:25 -07:00
|
|
|
/// `config.toml.example`.
|
2015-11-19 15:20:12 -08:00
|
|
|
#[derive(Default)]
|
|
|
|
pub struct Config {
|
2016-12-12 11:36:52 -08:00
|
|
|
pub ccache: Option<String>,
|
2016-04-10 00:27:32 -04:00
|
|
|
pub ninja: bool,
|
2016-11-16 18:02:56 -05:00
|
|
|
pub verbose: usize,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub submodules: bool,
|
2018-03-30 16:42:57 -07:00
|
|
|
pub fast_submodules: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub compiler_docs: bool,
|
|
|
|
pub docs: bool,
|
2017-02-10 22:59:40 +02:00
|
|
|
pub locked_deps: bool,
|
2016-11-01 13:46:38 -07:00
|
|
|
pub vendor: bool,
|
2017-07-13 18:48:44 -06:00
|
|
|
pub target_config: HashMap<Interned<String>, Target>,
|
rustbuild: Compile rustc twice, not thrice
This commit switches the rustbuild build system to compiling the
compiler twice for a normal bootstrap rather than the historical three
times.
Rust is a bootstrapped language which means that a previous version of
the compiler is used to build the next version of the compiler. Over
time, however, we change many parts of compiler artifacts such as the
metadata format, symbol names, etc. These changes make artifacts from
one compiler incompatible from another compiler. Consequently if a
compiler wants to be able to use some artifacts then it itself must have
compiled the artifacts.
Historically the rustc build system has achieved this by compiling the
compiler three times:
* An older compiler (stage0) is downloaded to kick off the chain.
* This compiler now compiles a new compiler (stage1)
* The stage1 compiler then compiles another compiler (stage2)
* Finally, the stage2 compiler needs libraries to link against, so it
compiles all the libraries again.
This entire process amounts in compiling the compiler three times.
Additionally, this process always guarantees that the Rust source tree
can compile itself because the stage2 compiler (created by a freshly
created compiler) would successfully compile itself again. This
property, ensuring Rust can compile itself, is quite important!
In general, though, this third compilation is not required for general
purpose development on the compiler. The third compiler (stage2) can
reuse the libraries that were created during the second compile. In
other words, the second compilation can produce both a compiler and the
libraries that compiler will use. These artifacts *must* be compatible
due to the way plugins work today anyway, and they were created by the
same source code so they *should* be compatible as well.
So given all that, this commit switches the default build process to
only compile the compiler three times, avoiding this third compilation
by copying artifacts from the previous one. Along the way a new entry in
the Travis matrix was also added to ensure that our full bootstrap can
succeed. This entry does not run tests, though, as it should not be
necessary.
To restore the old behavior of a full bootstrap (three compiles) you can
either pass:
./configure --enable-full-bootstrap
or if you're using config.toml:
[build]
full-bootstrap = true
Overall this will hopefully be an easy 33% win in build times of the
compiler. If we do 33% less work we should be 33% faster! This in turn
should affect cycle times and such on Travis and AppVeyor positively as
well as making it easier to work on the compiler itself.
2016-12-25 15:20:33 -08:00
|
|
|
pub full_bootstrap: bool,
|
2017-01-20 17:03:06 -08:00
|
|
|
pub extended: bool,
|
2018-02-05 20:10:05 +03:00
|
|
|
pub tools: Option<HashSet<String>>,
|
2017-02-03 18:58:47 -05:00
|
|
|
pub sanitizers: bool,
|
2017-02-13 09:57:50 +00:00
|
|
|
pub profiler: bool,
|
2017-08-03 10:53:56 -06:00
|
|
|
pub ignore_git: bool,
|
2018-02-09 13:40:23 -07:00
|
|
|
pub exclude: Vec<PathBuf>,
|
2018-02-24 15:56:33 -07:00
|
|
|
pub rustc_error_format: Option<String>,
|
2015-11-19 15:20:12 -08:00
|
|
|
|
2017-08-10 21:17:42 +05:00
|
|
|
pub run_host_only: bool,
|
|
|
|
|
2017-07-29 22:12:53 -06:00
|
|
|
pub on_fail: Option<String>,
|
|
|
|
pub stage: Option<u32>,
|
2018-07-14 10:58:10 -06:00
|
|
|
pub keep_stage: Vec<u32>,
|
2017-07-29 22:12:53 -06:00
|
|
|
pub src: PathBuf,
|
|
|
|
pub jobs: Option<u32>,
|
|
|
|
pub cmd: Subcommand,
|
|
|
|
pub incremental: bool,
|
2018-03-27 16:06:47 +02:00
|
|
|
pub dry_run: bool,
|
2017-07-29 22:12:53 -06:00
|
|
|
|
2018-04-01 09:35:53 -06:00
|
|
|
pub deny_warnings: bool,
|
2018-04-08 13:44:29 +02:00
|
|
|
pub backtrace_on_ice: bool,
|
2018-04-01 09:35:53 -06:00
|
|
|
|
2015-11-19 15:20:12 -08:00
|
|
|
// llvm codegen options
|
2017-06-18 16:00:10 +02:00
|
|
|
pub llvm_enabled: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub llvm_assertions: bool,
|
|
|
|
pub llvm_optimize: bool,
|
2018-08-10 12:23:48 +02:00
|
|
|
pub llvm_thin_lto: bool,
|
2016-11-10 17:30:06 +01:00
|
|
|
pub llvm_release_debuginfo: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub llvm_version_check: bool,
|
|
|
|
pub llvm_static_stdcpp: bool,
|
2016-11-16 23:28:14 -08:00
|
|
|
pub llvm_link_shared: bool,
|
2018-04-24 08:34:14 -07:00
|
|
|
pub llvm_clang_cl: Option<String>,
|
2016-12-29 02:23:38 +08:00
|
|
|
pub llvm_targets: Option<String>,
|
2017-11-20 06:22:17 -08:00
|
|
|
pub llvm_experimental_targets: String,
|
2017-03-05 16:11:11 +01:00
|
|
|
pub llvm_link_jobs: Option<u32>,
|
2018-09-06 11:06:32 +02:00
|
|
|
pub llvm_version_suffix: Option<String>,
|
2015-11-19 15:20:12 -08:00
|
|
|
|
rust: Import LLD for linking wasm objects
This commit imports the LLD project from LLVM to serve as the default linker for
the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently
removed along with "binaryen linker" support in rustc.
Moving to LLD brings with it a number of benefits for wasm code:
* LLD is itself an actual linker, so there's no need to compile all wasm code
with LTO any more. As a result builds should be *much* speedier as LTO is no
longer forcibly enabled for all builds of the wasm target.
* LLD is quickly becoming an "official solution" for linking wasm code together.
This, I believe at least, is intended to be the main supported linker for
native code and wasm moving forward. Picking up support early on should help
ensure that we can help LLD identify bugs and otherwise prove that it works
great for all our use cases!
* Improvements to the wasm toolchain are currently primarily focused around LLVM
and LLD (from what I can tell at least), so it's in general much better to be
on this bandwagon for bugfixes and new features.
* Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD
will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which
means a postprocessor is no longer needed to show off Rust's "small wasm
binary size".
LLD is added in a pretty standard way to rustc right now. A new rustbuild target
was defined for building LLD, and this is executed when a compiler's sysroot is
being assembled. LLD is compiled against the LLVM that we've got in tree, which
means we're currently on the `release_60` branch, but this may get upgraded in
the near future!
LLD is placed into rustc's sysroot in a `bin` directory. This is similar to
where `gcc.exe` can be found on Windows. This directory is automatically added
to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd`
linker which implements the interface that `wasm-ld`, LLD's frontend, expects.
Like Emscripten the LLD target is currently only enabled for Tier 1 platforms,
notably OSX/Windows/Linux, and will need to be installed manually for compiling
to wasm on other platforms. LLD is by default turned off in rustbuild, and
requires a `config.toml` option to be enabled to turn it on.
Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD
has a native option for controlling this.
[gc]: https://reviews.llvm.org/D42511
2017-08-26 18:30:12 -07:00
|
|
|
pub lld_enabled: bool,
|
2018-07-03 12:24:24 -06:00
|
|
|
pub lldb_enabled: bool,
|
2018-05-30 08:01:35 +02:00
|
|
|
pub llvm_tools_enabled: bool,
|
rust: Import LLD for linking wasm objects
This commit imports the LLD project from LLVM to serve as the default linker for
the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently
removed along with "binaryen linker" support in rustc.
Moving to LLD brings with it a number of benefits for wasm code:
* LLD is itself an actual linker, so there's no need to compile all wasm code
with LTO any more. As a result builds should be *much* speedier as LTO is no
longer forcibly enabled for all builds of the wasm target.
* LLD is quickly becoming an "official solution" for linking wasm code together.
This, I believe at least, is intended to be the main supported linker for
native code and wasm moving forward. Picking up support early on should help
ensure that we can help LLD identify bugs and otherwise prove that it works
great for all our use cases!
* Improvements to the wasm toolchain are currently primarily focused around LLVM
and LLD (from what I can tell at least), so it's in general much better to be
on this bandwagon for bugfixes and new features.
* Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD
will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which
means a postprocessor is no longer needed to show off Rust's "small wasm
binary size".
LLD is added in a pretty standard way to rustc right now. A new rustbuild target
was defined for building LLD, and this is executed when a compiler's sysroot is
being assembled. LLD is compiled against the LLVM that we've got in tree, which
means we're currently on the `release_60` branch, but this may get upgraded in
the near future!
LLD is placed into rustc's sysroot in a `bin` directory. This is similar to
where `gcc.exe` can be found on Windows. This directory is automatically added
to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd`
linker which implements the interface that `wasm-ld`, LLD's frontend, expects.
Like Emscripten the LLD target is currently only enabled for Tier 1 platforms,
notably OSX/Windows/Linux, and will need to be installed manually for compiling
to wasm on other platforms. LLD is by default turned off in rustbuild, and
requires a `config.toml` option to be enabled to turn it on.
Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD
has a native option for controlling this.
[gc]: https://reviews.llvm.org/D42511
2017-08-26 18:30:12 -07:00
|
|
|
|
2015-11-19 15:20:12 -08:00
|
|
|
// rust codegen options
|
|
|
|
pub rust_optimize: bool,
|
2017-10-19 20:02:46 -07:00
|
|
|
pub rust_codegen_units: Option<u32>,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub rust_debug_assertions: bool,
|
|
|
|
pub rust_debuginfo: bool,
|
2016-10-19 09:48:46 -07:00
|
|
|
pub rust_debuginfo_lines: bool,
|
2017-01-10 20:01:54 -08:00
|
|
|
pub rust_debuginfo_only_std: bool,
|
2018-04-13 16:52:54 -07:00
|
|
|
pub rust_debuginfo_tools: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub rust_rpath: bool,
|
2017-12-03 13:49:01 +01:00
|
|
|
pub rustc_parallel_queries: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub rustc_default_linker: Option<String>,
|
2016-05-13 15:26:41 -07:00
|
|
|
pub rust_optimize_tests: bool,
|
|
|
|
pub rust_debuginfo_tests: bool,
|
2017-02-14 09:54:58 -08:00
|
|
|
pub rust_dist_src: bool,
|
rustc: Split Emscripten to a separate codegen backend
This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.
A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.
There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:
* A *second* LLVM submodule was added in this commit. The main LLVM submodule
will soon start to drift from the Emscripten submodule, but currently they're
both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
This is gated behind a `--enable-emscripten` flag to the configure script. By
default users should neither check out the emscripten submodule nor compile
it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
platforms, though. All cross-compiled platforms will not be receiving an
Emscripten backend yet.
This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.
Closes #46819
2018-01-24 08:22:34 -08:00
|
|
|
pub rust_codegen_backends: Vec<Interned<String>>,
|
2018-03-02 09:19:50 +01:00
|
|
|
pub rust_codegen_backends_dir: String,
|
2018-06-12 21:21:29 +02:00
|
|
|
pub rust_verify_llvm_ir: bool,
|
2018-08-30 10:25:07 -07:00
|
|
|
pub rust_remap_debuginfo: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
|
2017-07-13 18:48:44 -06:00
|
|
|
pub build: Interned<String>,
|
2017-07-29 22:12:53 -06:00
|
|
|
pub hosts: Vec<Interned<String>>,
|
|
|
|
pub targets: Vec<Interned<String>>,
|
2016-05-23 09:49:46 -07:00
|
|
|
pub local_rebuild: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
|
2017-01-24 14:37:04 -08:00
|
|
|
// dist misc
|
|
|
|
pub dist_sign_folder: Option<PathBuf>,
|
|
|
|
pub dist_upload_addr: Option<String>,
|
|
|
|
pub dist_gpg_password_file: Option<PathBuf>,
|
|
|
|
|
2015-11-19 15:20:12 -08:00
|
|
|
// libstd features
|
|
|
|
pub debug_jemalloc: bool,
|
|
|
|
pub use_jemalloc: bool,
|
2016-07-26 15:21:25 -05:00
|
|
|
pub backtrace: bool, // support for RUST_BACKTRACE
|
2018-01-11 17:51:49 +00:00
|
|
|
pub wasm_syscall: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
|
|
|
|
// misc
|
2017-03-23 22:57:29 +01:00
|
|
|
pub low_priority: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub channel: String,
|
2018-06-07 14:40:36 +02:00
|
|
|
pub verbose_tests: bool,
|
2017-08-28 16:54:50 +02:00
|
|
|
pub test_miri: bool,
|
2017-11-30 18:18:47 +08:00
|
|
|
pub save_toolstates: Option<PathBuf>,
|
2018-03-16 12:10:47 -07:00
|
|
|
pub print_step_timings: bool,
|
2018-09-28 00:19:56 -05:00
|
|
|
pub missing_tools: bool,
|
2017-11-30 18:18:47 +08:00
|
|
|
|
2016-09-06 01:04:41 -05:00
|
|
|
// Fallback musl-root for all targets
|
2015-11-19 15:20:12 -08:00
|
|
|
pub musl_root: Option<PathBuf>,
|
2016-12-28 09:18:54 -08:00
|
|
|
pub prefix: Option<PathBuf>,
|
2017-04-28 11:03:58 +02:00
|
|
|
pub sysconfdir: Option<PathBuf>,
|
2018-02-17 09:54:11 +01:00
|
|
|
pub datadir: Option<PathBuf>,
|
2016-12-28 09:18:54 -08:00
|
|
|
pub docdir: Option<PathBuf>,
|
2017-04-28 11:01:15 +02:00
|
|
|
pub bindir: Option<PathBuf>,
|
2016-12-28 09:18:54 -08:00
|
|
|
pub libdir: Option<PathBuf>,
|
|
|
|
pub mandir: Option<PathBuf>,
|
2016-08-27 17:12:37 -05:00
|
|
|
pub codegen_tests: bool,
|
2016-09-07 13:13:37 -07:00
|
|
|
pub nodejs: Option<PathBuf>,
|
2016-10-29 20:11:53 +02:00
|
|
|
pub gdb: Option<PathBuf>,
|
2016-11-14 08:04:39 -08:00
|
|
|
pub python: Option<PathBuf>,
|
2017-02-15 15:57:06 -08:00
|
|
|
pub openssl_static: bool,
|
2017-08-26 15:01:48 -07:00
|
|
|
pub configure_args: Vec<String>,
|
2017-06-27 13:32:04 -06:00
|
|
|
|
|
|
|
// These are either the stage0 downloaded binaries or the locally installed ones.
|
|
|
|
pub initial_cargo: PathBuf,
|
|
|
|
pub initial_rustc: PathBuf,
|
2018-03-09 18:14:35 -07:00
|
|
|
pub out: PathBuf,
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Per-target configuration stored in the global configuration structure.
|
|
|
|
#[derive(Default)]
|
|
|
|
pub struct Target {
|
2017-06-21 17:03:14 -06:00
|
|
|
/// Some(path to llvm-config) if using an external LLVM.
|
2015-11-19 15:20:12 -08:00
|
|
|
pub llvm_config: Option<PathBuf>,
|
2018-09-25 09:13:02 -06:00
|
|
|
/// Some(path to FileCheck) if one was specified.
|
|
|
|
pub llvm_filecheck: Option<PathBuf>,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub jemalloc: Option<PathBuf>,
|
|
|
|
pub cc: Option<PathBuf>,
|
|
|
|
pub cxx: Option<PathBuf>,
|
2017-10-10 23:06:22 +03:00
|
|
|
pub ar: Option<PathBuf>,
|
2018-05-30 16:36:18 +02:00
|
|
|
pub ranlib: Option<PathBuf>,
|
2017-10-10 23:06:22 +03:00
|
|
|
pub linker: Option<PathBuf>,
|
2015-11-19 15:20:12 -08:00
|
|
|
pub ndk: Option<PathBuf>,
|
2017-08-22 16:24:29 -05:00
|
|
|
pub crt_static: Option<bool>,
|
2016-09-06 01:04:41 -05:00
|
|
|
pub musl_root: Option<PathBuf>,
|
2017-01-28 13:38:06 -08:00
|
|
|
pub qemu_rootfs: Option<PathBuf>,
|
2018-04-01 18:50:21 +02:00
|
|
|
pub no_std: bool,
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// Structure of the `config.toml` file that configuration is read from.
|
|
|
|
///
|
|
|
|
/// This structure uses `Decodable` to automatically decode a TOML configuration
|
|
|
|
/// file into this format, and then this is traversed and written into the above
|
|
|
|
/// `Config` structure.
|
2017-07-04 10:03:01 -06:00
|
|
|
#[derive(Deserialize, Default)]
|
2017-07-18 16:14:44 -06:00
|
|
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
2015-11-19 15:20:12 -08:00
|
|
|
struct TomlConfig {
|
|
|
|
build: Option<Build>,
|
2016-12-19 15:49:57 -07:00
|
|
|
install: Option<Install>,
|
2015-11-19 15:20:12 -08:00
|
|
|
llvm: Option<Llvm>,
|
|
|
|
rust: Option<Rust>,
|
|
|
|
target: Option<HashMap<String, TomlTarget>>,
|
2017-01-24 14:37:04 -08:00
|
|
|
dist: Option<Dist>,
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// TOML representation of various global build decisions.
|
2017-07-04 10:03:01 -06:00
|
|
|
#[derive(Deserialize, Default, Clone)]
|
2017-07-18 16:14:44 -06:00
|
|
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
2015-11-19 15:20:12 -08:00
|
|
|
struct Build {
|
|
|
|
build: Option<String>,
|
2017-07-04 10:03:01 -06:00
|
|
|
#[serde(default)]
|
2015-11-19 15:20:12 -08:00
|
|
|
host: Vec<String>,
|
2017-07-04 10:03:01 -06:00
|
|
|
#[serde(default)]
|
2015-11-19 15:20:12 -08:00
|
|
|
target: Vec<String>,
|
|
|
|
cargo: Option<String>,
|
|
|
|
rustc: Option<String>,
|
2017-03-23 22:57:29 +01:00
|
|
|
low_priority: Option<bool>,
|
2015-11-19 15:20:12 -08:00
|
|
|
compiler_docs: Option<bool>,
|
|
|
|
docs: Option<bool>,
|
2016-10-07 09:43:26 -07:00
|
|
|
submodules: Option<bool>,
|
2018-03-30 16:42:57 -07:00
|
|
|
fast_submodules: Option<bool>,
|
2016-10-29 20:11:53 +02:00
|
|
|
gdb: Option<String>,
|
2017-02-10 22:59:40 +02:00
|
|
|
locked_deps: Option<bool>,
|
2016-11-01 13:46:38 -07:00
|
|
|
vendor: Option<bool>,
|
2016-11-10 16:04:53 -07:00
|
|
|
nodejs: Option<String>,
|
2016-11-14 08:04:39 -08:00
|
|
|
python: Option<String>,
|
rustbuild: Compile rustc twice, not thrice
This commit switches the rustbuild build system to compiling the
compiler twice for a normal bootstrap rather than the historical three
times.
Rust is a bootstrapped language which means that a previous version of
the compiler is used to build the next version of the compiler. Over
time, however, we change many parts of compiler artifacts such as the
metadata format, symbol names, etc. These changes make artifacts from
one compiler incompatible from another compiler. Consequently if a
compiler wants to be able to use some artifacts then it itself must have
compiled the artifacts.
Historically the rustc build system has achieved this by compiling the
compiler three times:
* An older compiler (stage0) is downloaded to kick off the chain.
* This compiler now compiles a new compiler (stage1)
* The stage1 compiler then compiles another compiler (stage2)
* Finally, the stage2 compiler needs libraries to link against, so it
compiles all the libraries again.
This entire process amounts in compiling the compiler three times.
Additionally, this process always guarantees that the Rust source tree
can compile itself because the stage2 compiler (created by a freshly
created compiler) would successfully compile itself again. This
property, ensuring Rust can compile itself, is quite important!
In general, though, this third compilation is not required for general
purpose development on the compiler. The third compiler (stage2) can
reuse the libraries that were created during the second compile. In
other words, the second compilation can produce both a compiler and the
libraries that compiler will use. These artifacts *must* be compatible
due to the way plugins work today anyway, and they were created by the
same source code so they *should* be compatible as well.
So given all that, this commit switches the default build process to
only compile the compiler three times, avoiding this third compilation
by copying artifacts from the previous one. Along the way a new entry in
the Travis matrix was also added to ensure that our full bootstrap can
succeed. This entry does not run tests, though, as it should not be
necessary.
To restore the old behavior of a full bootstrap (three compiles) you can
either pass:
./configure --enable-full-bootstrap
or if you're using config.toml:
[build]
full-bootstrap = true
Overall this will hopefully be an easy 33% win in build times of the
compiler. If we do 33% less work we should be 33% faster! This in turn
should affect cycle times and such on Travis and AppVeyor positively as
well as making it easier to work on the compiler itself.
2016-12-25 15:20:33 -08:00
|
|
|
full_bootstrap: Option<bool>,
|
2017-01-20 17:03:06 -08:00
|
|
|
extended: Option<bool>,
|
2018-02-05 20:10:05 +03:00
|
|
|
tools: Option<HashSet<String>>,
|
2017-02-06 18:03:26 +01:00
|
|
|
verbose: Option<usize>,
|
2017-02-03 18:58:47 -05:00
|
|
|
sanitizers: Option<bool>,
|
2017-02-13 09:57:50 +00:00
|
|
|
profiler: Option<bool>,
|
2017-02-15 15:57:06 -08:00
|
|
|
openssl_static: Option<bool>,
|
2017-08-26 15:01:48 -07:00
|
|
|
configure_args: Option<Vec<String>>,
|
|
|
|
local_rebuild: Option<bool>,
|
2018-03-16 12:10:47 -07:00
|
|
|
print_step_timings: Option<bool>,
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
|
2016-12-19 15:49:57 -07:00
|
|
|
/// TOML representation of various global install decisions.
|
2017-07-04 10:03:01 -06:00
|
|
|
#[derive(Deserialize, Default, Clone)]
|
2017-07-18 16:14:44 -06:00
|
|
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
2016-12-19 15:49:57 -07:00
|
|
|
struct Install {
|
|
|
|
prefix: Option<String>,
|
2017-04-28 11:03:58 +02:00
|
|
|
sysconfdir: Option<String>,
|
2018-02-17 09:54:11 +01:00
|
|
|
datadir: Option<String>,
|
2016-12-28 09:18:54 -08:00
|
|
|
docdir: Option<String>,
|
2017-04-28 11:01:15 +02:00
|
|
|
bindir: Option<String>,
|
2016-12-28 09:18:54 -08:00
|
|
|
libdir: Option<String>,
|
2017-04-28 11:01:15 +02:00
|
|
|
mandir: Option<String>,
|
2017-10-26 16:30:17 -07:00
|
|
|
|
|
|
|
// standard paths, currently unused
|
|
|
|
infodir: Option<String>,
|
|
|
|
localstatedir: Option<String>,
|
2016-12-19 15:49:57 -07:00
|
|
|
}
|
|
|
|
|
2015-11-19 15:20:12 -08:00
|
|
|
/// TOML representation of how the LLVM build is configured.
|
2017-07-04 10:03:01 -06:00
|
|
|
#[derive(Deserialize, Default)]
|
2017-07-18 16:14:44 -06:00
|
|
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
2015-11-19 15:20:12 -08:00
|
|
|
struct Llvm {
|
2017-06-18 16:00:10 +02:00
|
|
|
enabled: Option<bool>,
|
2016-12-12 11:36:52 -08:00
|
|
|
ccache: Option<StringOrBool>,
|
2016-04-10 00:27:32 -04:00
|
|
|
ninja: Option<bool>,
|
2015-11-19 15:20:12 -08:00
|
|
|
assertions: Option<bool>,
|
|
|
|
optimize: Option<bool>,
|
2018-08-10 12:23:48 +02:00
|
|
|
thin_lto: Option<bool>,
|
2016-11-10 17:30:06 +01:00
|
|
|
release_debuginfo: Option<bool>,
|
2015-11-19 15:20:12 -08:00
|
|
|
version_check: Option<bool>,
|
|
|
|
static_libstdcpp: Option<bool>,
|
2016-12-29 02:23:38 +08:00
|
|
|
targets: Option<String>,
|
2017-06-16 15:43:43 -07:00
|
|
|
experimental_targets: Option<String>,
|
2017-03-05 16:11:11 +01:00
|
|
|
link_jobs: Option<u32>,
|
2017-08-26 15:01:48 -07:00
|
|
|
link_shared: Option<bool>,
|
2018-09-06 11:06:32 +02:00
|
|
|
version_suffix: Option<String>,
|
2018-04-24 08:34:14 -07:00
|
|
|
clang_cl: Option<String>
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
|
2017-07-04 10:03:01 -06:00
|
|
|
#[derive(Deserialize, Default, Clone)]
|
2017-07-18 16:14:44 -06:00
|
|
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
2017-01-24 14:37:04 -08:00
|
|
|
struct Dist {
|
|
|
|
sign_folder: Option<String>,
|
|
|
|
gpg_password_file: Option<String>,
|
|
|
|
upload_addr: Option<String>,
|
2017-02-14 09:54:58 -08:00
|
|
|
src_tarball: Option<bool>,
|
2017-01-24 14:37:04 -08:00
|
|
|
}
|
|
|
|
|
2017-07-04 10:03:01 -06:00
|
|
|
#[derive(Deserialize)]
|
|
|
|
#[serde(untagged)]
|
2016-12-12 11:36:52 -08:00
|
|
|
enum StringOrBool {
|
|
|
|
String(String),
|
|
|
|
Bool(bool),
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Default for StringOrBool {
|
|
|
|
fn default() -> StringOrBool {
|
|
|
|
StringOrBool::Bool(false)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-19 15:20:12 -08:00
|
|
|
/// TOML representation of how the Rust build is configured.
|
2017-07-04 10:03:01 -06:00
|
|
|
#[derive(Deserialize, Default)]
|
2017-07-18 16:14:44 -06:00
|
|
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
2015-11-19 15:20:12 -08:00
|
|
|
struct Rust {
|
|
|
|
optimize: Option<bool>,
|
|
|
|
codegen_units: Option<u32>,
|
|
|
|
debug_assertions: Option<bool>,
|
|
|
|
debuginfo: Option<bool>,
|
2016-10-19 09:48:46 -07:00
|
|
|
debuginfo_lines: Option<bool>,
|
2017-01-10 20:01:54 -08:00
|
|
|
debuginfo_only_std: Option<bool>,
|
2018-04-13 16:52:54 -07:00
|
|
|
debuginfo_tools: Option<bool>,
|
2017-12-03 13:49:01 +01:00
|
|
|
experimental_parallel_queries: Option<bool>,
|
2015-11-19 15:20:12 -08:00
|
|
|
debug_jemalloc: Option<bool>,
|
|
|
|
use_jemalloc: Option<bool>,
|
2016-07-26 15:21:25 -05:00
|
|
|
backtrace: Option<bool>,
|
2015-11-19 15:20:12 -08:00
|
|
|
default_linker: Option<String>,
|
|
|
|
channel: Option<String>,
|
|
|
|
musl_root: Option<String>,
|
|
|
|
rpath: Option<bool>,
|
2016-05-13 15:26:41 -07:00
|
|
|
optimize_tests: Option<bool>,
|
|
|
|
debuginfo_tests: Option<bool>,
|
2016-09-03 01:29:12 +00:00
|
|
|
codegen_tests: Option<bool>,
|
2017-08-03 10:53:56 -06:00
|
|
|
ignore_git: Option<bool>,
|
2017-08-26 15:01:48 -07:00
|
|
|
debug: Option<bool>,
|
|
|
|
dist_src: Option<bool>,
|
2018-06-07 14:40:36 +02:00
|
|
|
verbose_tests: Option<bool>,
|
2017-08-28 16:54:50 +02:00
|
|
|
test_miri: Option<bool>,
|
2018-06-03 00:13:27 +02:00
|
|
|
incremental: Option<bool>,
|
2017-11-30 18:18:47 +08:00
|
|
|
save_toolstates: Option<String>,
|
rustc: Split Emscripten to a separate codegen backend
This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.
A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.
There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:
* A *second* LLVM submodule was added in this commit. The main LLVM submodule
will soon start to drift from the Emscripten submodule, but currently they're
both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
This is gated behind a `--enable-emscripten` flag to the configure script. By
default users should neither check out the emscripten submodule nor compile
it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
platforms, though. All cross-compiled platforms will not be receiving an
Emscripten backend yet.
This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.
Closes #46819
2018-01-24 08:22:34 -08:00
|
|
|
codegen_backends: Option<Vec<String>>,
|
2018-03-02 09:19:50 +01:00
|
|
|
codegen_backends_dir: Option<String>,
|
2018-01-11 17:51:49 +00:00
|
|
|
wasm_syscall: Option<bool>,
|
rust: Import LLD for linking wasm objects
This commit imports the LLD project from LLVM to serve as the default linker for
the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently
removed along with "binaryen linker" support in rustc.
Moving to LLD brings with it a number of benefits for wasm code:
* LLD is itself an actual linker, so there's no need to compile all wasm code
with LTO any more. As a result builds should be *much* speedier as LTO is no
longer forcibly enabled for all builds of the wasm target.
* LLD is quickly becoming an "official solution" for linking wasm code together.
This, I believe at least, is intended to be the main supported linker for
native code and wasm moving forward. Picking up support early on should help
ensure that we can help LLD identify bugs and otherwise prove that it works
great for all our use cases!
* Improvements to the wasm toolchain are currently primarily focused around LLVM
and LLD (from what I can tell at least), so it's in general much better to be
on this bandwagon for bugfixes and new features.
* Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD
will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which
means a postprocessor is no longer needed to show off Rust's "small wasm
binary size".
LLD is added in a pretty standard way to rustc right now. A new rustbuild target
was defined for building LLD, and this is executed when a compiler's sysroot is
being assembled. LLD is compiled against the LLVM that we've got in tree, which
means we're currently on the `release_60` branch, but this may get upgraded in
the near future!
LLD is placed into rustc's sysroot in a `bin` directory. This is similar to
where `gcc.exe` can be found on Windows. This directory is automatically added
to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd`
linker which implements the interface that `wasm-ld`, LLD's frontend, expects.
Like Emscripten the LLD target is currently only enabled for Tier 1 platforms,
notably OSX/Windows/Linux, and will need to be installed manually for compiling
to wasm on other platforms. LLD is by default turned off in rustbuild, and
requires a `config.toml` option to be enabled to turn it on.
Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD
has a native option for controlling this.
[gc]: https://reviews.llvm.org/D42511
2017-08-26 18:30:12 -07:00
|
|
|
lld: Option<bool>,
|
2018-07-03 12:24:24 -06:00
|
|
|
lldb: Option<bool>,
|
2018-04-30 10:15:48 +02:00
|
|
|
llvm_tools: Option<bool>,
|
2018-04-01 09:35:53 -06:00
|
|
|
deny_warnings: Option<bool>,
|
2018-04-08 13:44:29 +02:00
|
|
|
backtrace_on_ice: Option<bool>,
|
2018-06-12 21:21:29 +02:00
|
|
|
verify_llvm_ir: Option<bool>,
|
2018-08-30 10:25:07 -07:00
|
|
|
remap_debuginfo: Option<bool>,
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
/// TOML representation of how each build target is configured.
|
2017-07-04 10:03:01 -06:00
|
|
|
#[derive(Deserialize, Default)]
|
2017-07-18 16:14:44 -06:00
|
|
|
#[serde(deny_unknown_fields, rename_all = "kebab-case")]
|
2015-11-19 15:20:12 -08:00
|
|
|
struct TomlTarget {
|
|
|
|
llvm_config: Option<String>,
|
2018-09-25 09:13:02 -06:00
|
|
|
llvm_filecheck: Option<String>,
|
2015-11-19 15:20:12 -08:00
|
|
|
jemalloc: Option<String>,
|
|
|
|
cc: Option<String>,
|
|
|
|
cxx: Option<String>,
|
2017-10-10 23:06:22 +03:00
|
|
|
ar: Option<String>,
|
2018-05-30 16:36:18 +02:00
|
|
|
ranlib: Option<String>,
|
2017-10-10 23:06:22 +03:00
|
|
|
linker: Option<String>,
|
2015-11-19 15:20:12 -08:00
|
|
|
android_ndk: Option<String>,
|
2017-08-22 16:24:29 -05:00
|
|
|
crt_static: Option<bool>,
|
2016-10-04 20:17:53 -05:00
|
|
|
musl_root: Option<String>,
|
2017-01-28 13:38:06 -08:00
|
|
|
qemu_rootfs: Option<String>,
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
impl Config {
|
2018-05-01 21:25:38 +03:00
|
|
|
fn path_from_python(var_key: &str) -> PathBuf {
|
|
|
|
match env::var_os(var_key) {
|
|
|
|
// Do not trust paths from Python and normalize them slightly (#49785).
|
|
|
|
Some(var_val) => Path::new(&var_val).components().collect(),
|
|
|
|
_ => panic!("expected '{}' to be set", var_key),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-10 07:02:17 -07:00
|
|
|
pub fn default_opts() -> Config {
|
2015-11-19 15:20:12 -08:00
|
|
|
let mut config = Config::default();
|
2017-06-18 16:00:10 +02:00
|
|
|
config.llvm_enabled = true;
|
2015-11-19 15:20:12 -08:00
|
|
|
config.llvm_optimize = true;
|
2017-10-16 12:57:37 -07:00
|
|
|
config.llvm_version_check = true;
|
2015-11-19 15:20:12 -08:00
|
|
|
config.use_jemalloc = true;
|
2016-07-26 15:21:25 -05:00
|
|
|
config.backtrace = true;
|
2015-11-19 15:20:12 -08:00
|
|
|
config.rust_optimize = true;
|
2016-05-13 15:26:41 -07:00
|
|
|
config.rust_optimize_tests = true;
|
2015-11-19 15:20:12 -08:00
|
|
|
config.submodules = true;
|
2018-03-30 16:42:57 -07:00
|
|
|
config.fast_submodules = true;
|
2015-11-19 15:20:12 -08:00
|
|
|
config.docs = true;
|
|
|
|
config.rust_rpath = true;
|
|
|
|
config.channel = "dev".to_string();
|
2016-08-27 17:12:37 -05:00
|
|
|
config.codegen_tests = true;
|
2017-08-03 10:53:56 -06:00
|
|
|
config.ignore_git = false;
|
2017-02-14 09:54:58 -08:00
|
|
|
config.rust_dist_src = true;
|
2017-08-28 16:54:50 +02:00
|
|
|
config.test_miri = false;
|
rustc: Split Emscripten to a separate codegen backend
This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.
A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.
There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:
* A *second* LLVM submodule was added in this commit. The main LLVM submodule
will soon start to drift from the Emscripten submodule, but currently they're
both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
This is gated behind a `--enable-emscripten` flag to the configure script. By
default users should neither check out the emscripten submodule nor compile
it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
platforms, though. All cross-compiled platforms will not be receiving an
Emscripten backend yet.
This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.
Closes #46819
2018-01-24 08:22:34 -08:00
|
|
|
config.rust_codegen_backends = vec![INTERNER.intern_str("llvm")];
|
2018-03-02 09:19:50 +01:00
|
|
|
config.rust_codegen_backends_dir = "codegen-backends".to_owned();
|
2018-04-01 09:35:53 -06:00
|
|
|
config.deny_warnings = true;
|
2018-09-28 00:19:56 -05:00
|
|
|
config.missing_tools = false;
|
2015-11-19 15:20:12 -08:00
|
|
|
|
2018-03-10 07:02:17 -07:00
|
|
|
// set by bootstrap.py
|
|
|
|
config.build = INTERNER.intern_str(&env::var("BUILD").expect("'BUILD' to be set"));
|
2018-05-01 21:25:38 +03:00
|
|
|
config.src = Config::path_from_python("SRC");
|
|
|
|
config.out = Config::path_from_python("BUILD_DIR");
|
2018-03-10 07:02:17 -07:00
|
|
|
|
2018-07-02 01:45:35 +05:00
|
|
|
config.initial_rustc = Config::path_from_python("RUSTC");
|
|
|
|
config.initial_cargo = Config::path_from_python("CARGO");
|
2018-03-10 07:02:17 -07:00
|
|
|
|
|
|
|
config
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn parse(args: &[String]) -> Config {
|
|
|
|
let flags = Flags::parse(&args);
|
|
|
|
let file = flags.config.clone();
|
|
|
|
let mut config = Config::default_opts();
|
|
|
|
config.exclude = flags.exclude;
|
2018-02-24 15:56:33 -07:00
|
|
|
config.rustc_error_format = flags.rustc_error_format;
|
2017-07-29 22:12:53 -06:00
|
|
|
config.on_fail = flags.on_fail;
|
|
|
|
config.stage = flags.stage;
|
|
|
|
config.jobs = flags.jobs;
|
|
|
|
config.cmd = flags.cmd;
|
|
|
|
config.incremental = flags.incremental;
|
2018-03-27 16:06:47 +02:00
|
|
|
config.dry_run = flags.dry_run;
|
2017-07-29 22:12:53 -06:00
|
|
|
config.keep_stage = flags.keep_stage;
|
2018-04-01 09:35:53 -06:00
|
|
|
if let Some(value) = flags.warnings {
|
|
|
|
config.deny_warnings = value;
|
|
|
|
}
|
2017-07-29 22:12:53 -06:00
|
|
|
|
2018-03-27 16:06:47 +02:00
|
|
|
if config.dry_run {
|
|
|
|
let dir = config.out.join("tmp-dry-run");
|
|
|
|
t!(fs::create_dir_all(&dir));
|
|
|
|
config.out = dir;
|
|
|
|
}
|
|
|
|
|
2017-08-10 21:17:42 +05:00
|
|
|
// If --target was specified but --host wasn't specified, don't run any host-only tests.
|
2018-02-11 15:42:05 -07:00
|
|
|
config.run_host_only = !(flags.host.is_empty() && !flags.target.is_empty());
|
2017-08-10 21:17:42 +05:00
|
|
|
|
2015-11-19 15:20:12 -08:00
|
|
|
let toml = file.map(|file| {
|
|
|
|
let mut f = t!(File::open(&file));
|
2017-07-04 10:03:01 -06:00
|
|
|
let mut contents = String::new();
|
|
|
|
t!(f.read_to_string(&mut contents));
|
|
|
|
match toml::from_str(&contents) {
|
|
|
|
Ok(table) => table,
|
|
|
|
Err(err) => {
|
|
|
|
println!("failed to parse TOML configuration '{}': {}",
|
|
|
|
file.display(), err);
|
2015-11-19 15:20:12 -08:00
|
|
|
process::exit(2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).unwrap_or_else(|| TomlConfig::default());
|
|
|
|
|
|
|
|
let build = toml.build.clone().unwrap_or(Build::default());
|
2018-03-09 18:14:35 -07:00
|
|
|
// set by bootstrap.py
|
2017-07-29 22:12:53 -06:00
|
|
|
config.hosts.push(config.build.clone());
|
2015-11-19 15:20:12 -08:00
|
|
|
for host in build.host.iter() {
|
2017-07-13 18:48:44 -06:00
|
|
|
let host = INTERNER.intern_str(host);
|
2017-07-29 22:12:53 -06:00
|
|
|
if !config.hosts.contains(&host) {
|
|
|
|
config.hosts.push(host);
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
}
|
2017-07-29 22:12:53 -06:00
|
|
|
for target in config.hosts.iter().cloned()
|
2017-07-13 18:48:44 -06:00
|
|
|
.chain(build.target.iter().map(|s| INTERNER.intern_str(s)))
|
|
|
|
{
|
2017-07-29 22:12:53 -06:00
|
|
|
if !config.targets.contains(&target) {
|
|
|
|
config.targets.push(target);
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
}
|
2017-07-29 22:12:53 -06:00
|
|
|
config.hosts = if !flags.host.is_empty() {
|
|
|
|
flags.host
|
|
|
|
} else {
|
|
|
|
config.hosts
|
|
|
|
};
|
|
|
|
config.targets = if !flags.target.is_empty() {
|
|
|
|
flags.target
|
|
|
|
} else {
|
|
|
|
config.targets
|
|
|
|
};
|
|
|
|
|
2017-08-10 21:17:42 +05:00
|
|
|
|
2016-11-10 16:04:53 -07:00
|
|
|
config.nodejs = build.nodejs.map(PathBuf::from);
|
2016-10-29 20:11:53 +02:00
|
|
|
config.gdb = build.gdb.map(PathBuf::from);
|
2016-11-14 08:04:39 -08:00
|
|
|
config.python = build.python.map(PathBuf::from);
|
2017-03-23 22:57:29 +01:00
|
|
|
set(&mut config.low_priority, build.low_priority);
|
2015-11-19 15:20:12 -08:00
|
|
|
set(&mut config.compiler_docs, build.compiler_docs);
|
|
|
|
set(&mut config.docs, build.docs);
|
2016-10-07 09:43:26 -07:00
|
|
|
set(&mut config.submodules, build.submodules);
|
2018-03-30 16:42:57 -07:00
|
|
|
set(&mut config.fast_submodules, build.fast_submodules);
|
2017-02-10 22:59:40 +02:00
|
|
|
set(&mut config.locked_deps, build.locked_deps);
|
2016-11-01 13:46:38 -07:00
|
|
|
set(&mut config.vendor, build.vendor);
|
rustbuild: Compile rustc twice, not thrice
This commit switches the rustbuild build system to compiling the
compiler twice for a normal bootstrap rather than the historical three
times.
Rust is a bootstrapped language which means that a previous version of
the compiler is used to build the next version of the compiler. Over
time, however, we change many parts of compiler artifacts such as the
metadata format, symbol names, etc. These changes make artifacts from
one compiler incompatible from another compiler. Consequently if a
compiler wants to be able to use some artifacts then it itself must have
compiled the artifacts.
Historically the rustc build system has achieved this by compiling the
compiler three times:
* An older compiler (stage0) is downloaded to kick off the chain.
* This compiler now compiles a new compiler (stage1)
* The stage1 compiler then compiles another compiler (stage2)
* Finally, the stage2 compiler needs libraries to link against, so it
compiles all the libraries again.
This entire process amounts in compiling the compiler three times.
Additionally, this process always guarantees that the Rust source tree
can compile itself because the stage2 compiler (created by a freshly
created compiler) would successfully compile itself again. This
property, ensuring Rust can compile itself, is quite important!
In general, though, this third compilation is not required for general
purpose development on the compiler. The third compiler (stage2) can
reuse the libraries that were created during the second compile. In
other words, the second compilation can produce both a compiler and the
libraries that compiler will use. These artifacts *must* be compatible
due to the way plugins work today anyway, and they were created by the
same source code so they *should* be compatible as well.
So given all that, this commit switches the default build process to
only compile the compiler three times, avoiding this third compilation
by copying artifacts from the previous one. Along the way a new entry in
the Travis matrix was also added to ensure that our full bootstrap can
succeed. This entry does not run tests, though, as it should not be
necessary.
To restore the old behavior of a full bootstrap (three compiles) you can
either pass:
./configure --enable-full-bootstrap
or if you're using config.toml:
[build]
full-bootstrap = true
Overall this will hopefully be an easy 33% win in build times of the
compiler. If we do 33% less work we should be 33% faster! This in turn
should affect cycle times and such on Travis and AppVeyor positively as
well as making it easier to work on the compiler itself.
2016-12-25 15:20:33 -08:00
|
|
|
set(&mut config.full_bootstrap, build.full_bootstrap);
|
2017-01-20 17:03:06 -08:00
|
|
|
set(&mut config.extended, build.extended);
|
2018-02-05 20:10:05 +03:00
|
|
|
config.tools = build.tools;
|
2017-02-06 18:03:26 +01:00
|
|
|
set(&mut config.verbose, build.verbose);
|
2017-02-03 18:58:47 -05:00
|
|
|
set(&mut config.sanitizers, build.sanitizers);
|
2017-02-13 09:57:50 +00:00
|
|
|
set(&mut config.profiler, build.profiler);
|
2017-02-15 15:57:06 -08:00
|
|
|
set(&mut config.openssl_static, build.openssl_static);
|
2017-08-26 15:01:48 -07:00
|
|
|
set(&mut config.configure_args, build.configure_args);
|
|
|
|
set(&mut config.local_rebuild, build.local_rebuild);
|
2018-03-16 12:10:47 -07:00
|
|
|
set(&mut config.print_step_timings, build.print_step_timings);
|
2017-07-29 22:12:53 -06:00
|
|
|
config.verbose = cmp::max(config.verbose, flags.verbose);
|
2015-11-19 15:20:12 -08:00
|
|
|
|
2016-12-19 15:49:57 -07:00
|
|
|
if let Some(ref install) = toml.install {
|
2016-12-28 09:18:54 -08:00
|
|
|
config.prefix = install.prefix.clone().map(PathBuf::from);
|
2017-04-28 11:03:58 +02:00
|
|
|
config.sysconfdir = install.sysconfdir.clone().map(PathBuf::from);
|
2018-02-17 09:54:11 +01:00
|
|
|
config.datadir = install.datadir.clone().map(PathBuf::from);
|
2016-12-28 09:18:54 -08:00
|
|
|
config.docdir = install.docdir.clone().map(PathBuf::from);
|
2017-04-28 11:01:15 +02:00
|
|
|
config.bindir = install.bindir.clone().map(PathBuf::from);
|
2016-12-28 09:18:54 -08:00
|
|
|
config.libdir = install.libdir.clone().map(PathBuf::from);
|
2017-04-28 11:01:15 +02:00
|
|
|
config.mandir = install.mandir.clone().map(PathBuf::from);
|
2016-12-19 15:49:57 -07:00
|
|
|
}
|
|
|
|
|
2017-08-26 15:01:48 -07:00
|
|
|
// Store off these values as options because if they're not provided
|
|
|
|
// we'll infer default values for them later
|
|
|
|
let mut llvm_assertions = None;
|
|
|
|
let mut debuginfo_lines = None;
|
|
|
|
let mut debuginfo_only_std = None;
|
2018-04-13 16:52:54 -07:00
|
|
|
let mut debuginfo_tools = None;
|
2017-08-26 15:01:48 -07:00
|
|
|
let mut debug = None;
|
|
|
|
let mut debug_jemalloc = None;
|
|
|
|
let mut debuginfo = None;
|
|
|
|
let mut debug_assertions = None;
|
|
|
|
let mut optimize = None;
|
2017-08-28 20:44:40 -07:00
|
|
|
let mut ignore_git = None;
|
2017-08-26 15:01:48 -07:00
|
|
|
|
2015-11-19 15:20:12 -08:00
|
|
|
if let Some(ref llvm) = toml.llvm {
|
2016-12-12 11:36:52 -08:00
|
|
|
match llvm.ccache {
|
|
|
|
Some(StringOrBool::String(ref s)) => {
|
|
|
|
config.ccache = Some(s.to_string())
|
|
|
|
}
|
|
|
|
Some(StringOrBool::Bool(true)) => {
|
|
|
|
config.ccache = Some("ccache".to_string());
|
|
|
|
}
|
|
|
|
Some(StringOrBool::Bool(false)) | None => {}
|
|
|
|
}
|
2016-04-10 00:27:32 -04:00
|
|
|
set(&mut config.ninja, llvm.ninja);
|
2017-06-18 16:00:10 +02:00
|
|
|
set(&mut config.llvm_enabled, llvm.enabled);
|
2017-08-26 15:01:48 -07:00
|
|
|
llvm_assertions = llvm.assertions;
|
2015-11-19 15:20:12 -08:00
|
|
|
set(&mut config.llvm_optimize, llvm.optimize);
|
2018-08-10 12:23:48 +02:00
|
|
|
set(&mut config.llvm_thin_lto, llvm.thin_lto);
|
2016-11-10 17:30:06 +01:00
|
|
|
set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
|
2015-11-19 15:20:12 -08:00
|
|
|
set(&mut config.llvm_version_check, llvm.version_check);
|
|
|
|
set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
|
2017-08-26 15:01:48 -07:00
|
|
|
set(&mut config.llvm_link_shared, llvm.link_shared);
|
2016-12-29 02:23:38 +08:00
|
|
|
config.llvm_targets = llvm.targets.clone();
|
2017-11-20 06:22:17 -08:00
|
|
|
config.llvm_experimental_targets = llvm.experimental_targets.clone()
|
2018-07-26 13:40:40 +02:00
|
|
|
.unwrap_or("WebAssembly;RISCV".to_string());
|
2017-03-05 16:11:11 +01:00
|
|
|
config.llvm_link_jobs = llvm.link_jobs;
|
2018-09-06 11:06:32 +02:00
|
|
|
config.llvm_version_suffix = llvm.version_suffix.clone();
|
2018-04-24 08:34:14 -07:00
|
|
|
config.llvm_clang_cl = llvm.clang_cl.clone();
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
2016-12-19 17:42:07 -07:00
|
|
|
|
2015-11-19 15:20:12 -08:00
|
|
|
if let Some(ref rust) = toml.rust {
|
2017-08-26 15:01:48 -07:00
|
|
|
debug = rust.debug;
|
|
|
|
debug_assertions = rust.debug_assertions;
|
|
|
|
debuginfo = rust.debuginfo;
|
|
|
|
debuginfo_lines = rust.debuginfo_lines;
|
|
|
|
debuginfo_only_std = rust.debuginfo_only_std;
|
2018-04-13 16:52:54 -07:00
|
|
|
debuginfo_tools = rust.debuginfo_tools;
|
2017-08-26 15:01:48 -07:00
|
|
|
optimize = rust.optimize;
|
2017-08-28 20:44:40 -07:00
|
|
|
ignore_git = rust.ignore_git;
|
2017-08-26 15:01:48 -07:00
|
|
|
debug_jemalloc = rust.debug_jemalloc;
|
2016-05-13 15:26:41 -07:00
|
|
|
set(&mut config.rust_optimize_tests, rust.optimize_tests);
|
|
|
|
set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
|
2016-09-03 01:29:12 +00:00
|
|
|
set(&mut config.codegen_tests, rust.codegen_tests);
|
2015-11-19 15:20:12 -08:00
|
|
|
set(&mut config.rust_rpath, rust.rpath);
|
|
|
|
set(&mut config.use_jemalloc, rust.use_jemalloc);
|
2016-07-26 15:21:25 -05:00
|
|
|
set(&mut config.backtrace, rust.backtrace);
|
2015-11-19 15:20:12 -08:00
|
|
|
set(&mut config.channel, rust.channel.clone());
|
2017-08-26 15:01:48 -07:00
|
|
|
set(&mut config.rust_dist_src, rust.dist_src);
|
2018-06-07 14:40:36 +02:00
|
|
|
set(&mut config.verbose_tests, rust.verbose_tests);
|
2017-08-28 16:54:50 +02:00
|
|
|
set(&mut config.test_miri, rust.test_miri);
|
2018-06-03 08:44:56 +02:00
|
|
|
// in the case "false" is set explicitly, do not overwrite the command line args
|
|
|
|
if let Some(true) = rust.incremental {
|
|
|
|
config.incremental = true;
|
|
|
|
}
|
2018-01-11 17:51:49 +00:00
|
|
|
set(&mut config.wasm_syscall, rust.wasm_syscall);
|
rust: Import LLD for linking wasm objects
This commit imports the LLD project from LLVM to serve as the default linker for
the `wasm32-unknown-unknown` target. The `binaryen` submoule is consequently
removed along with "binaryen linker" support in rustc.
Moving to LLD brings with it a number of benefits for wasm code:
* LLD is itself an actual linker, so there's no need to compile all wasm code
with LTO any more. As a result builds should be *much* speedier as LTO is no
longer forcibly enabled for all builds of the wasm target.
* LLD is quickly becoming an "official solution" for linking wasm code together.
This, I believe at least, is intended to be the main supported linker for
native code and wasm moving forward. Picking up support early on should help
ensure that we can help LLD identify bugs and otherwise prove that it works
great for all our use cases!
* Improvements to the wasm toolchain are currently primarily focused around LLVM
and LLD (from what I can tell at least), so it's in general much better to be
on this bandwagon for bugfixes and new features.
* Historical "hacks" like `wasm-gc` will soon no longer be necessary, LLD
will [natively implement][gc] `--gc-sections` (better than `wasm-gc`!) which
means a postprocessor is no longer needed to show off Rust's "small wasm
binary size".
LLD is added in a pretty standard way to rustc right now. A new rustbuild target
was defined for building LLD, and this is executed when a compiler's sysroot is
being assembled. LLD is compiled against the LLVM that we've got in tree, which
means we're currently on the `release_60` branch, but this may get upgraded in
the near future!
LLD is placed into rustc's sysroot in a `bin` directory. This is similar to
where `gcc.exe` can be found on Windows. This directory is automatically added
to `PATH` whenever rustc executes the linker, allowing us to define a `WasmLd`
linker which implements the interface that `wasm-ld`, LLD's frontend, expects.
Like Emscripten the LLD target is currently only enabled for Tier 1 platforms,
notably OSX/Windows/Linux, and will need to be installed manually for compiling
to wasm on other platforms. LLD is by default turned off in rustbuild, and
requires a `config.toml` option to be enabled to turn it on.
Finally the unstable `#![wasm_import_memory]` attribute was also removed as LLD
has a native option for controlling this.
[gc]: https://reviews.llvm.org/D42511
2017-08-26 18:30:12 -07:00
|
|
|
set(&mut config.lld_enabled, rust.lld);
|
2018-07-03 12:24:24 -06:00
|
|
|
set(&mut config.lldb_enabled, rust.lldb);
|
2018-05-30 08:01:35 +02:00
|
|
|
set(&mut config.llvm_tools_enabled, rust.llvm_tools);
|
2017-12-03 13:49:01 +01:00
|
|
|
config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
|
2015-11-19 15:20:12 -08:00
|
|
|
config.rustc_default_linker = rust.default_linker.clone();
|
|
|
|
config.musl_root = rust.musl_root.clone().map(PathBuf::from);
|
2017-11-30 18:18:47 +08:00
|
|
|
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
|
2018-04-01 09:35:53 -06:00
|
|
|
set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
|
2018-04-08 13:44:29 +02:00
|
|
|
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
|
2018-06-12 21:21:29 +02:00
|
|
|
set(&mut config.rust_verify_llvm_ir, rust.verify_llvm_ir);
|
2018-08-30 10:25:07 -07:00
|
|
|
set(&mut config.rust_remap_debuginfo, rust.remap_debuginfo);
|
2015-11-19 15:20:12 -08:00
|
|
|
|
rustc: Split Emscripten to a separate codegen backend
This commit introduces a separately compiled backend for Emscripten, avoiding
compiling the `JSBackend` target in the main LLVM codegen backend. This builds
on the foundation provided by #47671 to create a new codegen backend dedicated
solely to Emscripten, removing the `JSBackend` of the main codegen backend in
the process.
A new field was added to each target for this commit which specifies the backend
to use for translation, the default being `llvm` which is the main backend that
we use. The Emscripten targets specify an `emscripten` backend instead of the
main `llvm` one.
There's a whole bunch of consequences of this change, but I'll try to enumerate
them here:
* A *second* LLVM submodule was added in this commit. The main LLVM submodule
will soon start to drift from the Emscripten submodule, but currently they're
both at the same revision.
* Logic was added to rustbuild to *not* build the Emscripten backend by default.
This is gated behind a `--enable-emscripten` flag to the configure script. By
default users should neither check out the emscripten submodule nor compile
it.
* The `init_repo.sh` script was updated to fetch the Emscripten submodule from
GitHub the same way we do the main LLVM submodule (a tarball fetch).
* The Emscripten backend, turned off by default, is still turned on for a number
of targets on CI. We'll only be shipping an Emscripten backend with Tier 1
platforms, though. All cross-compiled platforms will not be receiving an
Emscripten backend yet.
This commit means that when you download the `rustc` package in Rustup for Tier
1 platforms you'll be receiving two trans backends, one for Emscripten and one
that's the general LLVM backend. If you never compile for Emscripten you'll
never use the Emscripten backend, so we may update this one day to only download
the Emscripten backend when you add the Emscripten target. For now though it's
just an extra 10MB gzip'd.
Closes #46819
2018-01-24 08:22:34 -08:00
|
|
|
if let Some(ref backends) = rust.codegen_backends {
|
|
|
|
config.rust_codegen_backends = backends.iter()
|
|
|
|
.map(|s| INTERNER.intern_str(s))
|
|
|
|
.collect();
|
|
|
|
}
|
|
|
|
|
2018-03-02 09:19:50 +01:00
|
|
|
set(&mut config.rust_codegen_backends_dir, rust.codegen_backends_dir.clone());
|
|
|
|
|
2015-11-19 15:20:12 -08:00
|
|
|
match rust.codegen_units {
|
2017-10-19 20:02:46 -07:00
|
|
|
Some(0) => config.rust_codegen_units = Some(num_cpus::get() as u32),
|
|
|
|
Some(n) => config.rust_codegen_units = Some(n),
|
2015-11-19 15:20:12 -08:00
|
|
|
None => {}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if let Some(ref t) = toml.target {
|
|
|
|
for (triple, cfg) in t {
|
|
|
|
let mut target = Target::default();
|
|
|
|
|
|
|
|
if let Some(ref s) = cfg.llvm_config {
|
2018-03-09 18:14:35 -07:00
|
|
|
target.llvm_config = Some(config.src.join(s));
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
2018-09-25 09:13:02 -06:00
|
|
|
if let Some(ref s) = cfg.llvm_filecheck {
|
|
|
|
target.llvm_filecheck = Some(config.src.join(s));
|
|
|
|
}
|
2015-11-19 15:20:12 -08:00
|
|
|
if let Some(ref s) = cfg.jemalloc {
|
2018-03-09 18:14:35 -07:00
|
|
|
target.jemalloc = Some(config.src.join(s));
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
if let Some(ref s) = cfg.android_ndk {
|
2018-03-09 18:14:35 -07:00
|
|
|
target.ndk = Some(config.src.join(s));
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
target.cc = cfg.cc.clone().map(PathBuf::from);
|
2017-10-10 23:06:22 +03:00
|
|
|
target.cxx = cfg.cxx.clone().map(PathBuf::from);
|
|
|
|
target.ar = cfg.ar.clone().map(PathBuf::from);
|
2018-05-30 16:36:18 +02:00
|
|
|
target.ranlib = cfg.ranlib.clone().map(PathBuf::from);
|
2017-10-10 23:06:22 +03:00
|
|
|
target.linker = cfg.linker.clone().map(PathBuf::from);
|
2017-08-22 16:24:29 -05:00
|
|
|
target.crt_static = cfg.crt_static.clone();
|
2016-10-04 20:17:53 -05:00
|
|
|
target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
|
2017-01-28 13:38:06 -08:00
|
|
|
target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
|
2015-11-19 15:20:12 -08:00
|
|
|
|
2017-07-13 18:48:44 -06:00
|
|
|
config.target_config.insert(INTERNER.intern_string(triple.clone()), target);
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-24 14:37:04 -08:00
|
|
|
if let Some(ref t) = toml.dist {
|
|
|
|
config.dist_sign_folder = t.sign_folder.clone().map(PathBuf::from);
|
|
|
|
config.dist_gpg_password_file = t.gpg_password_file.clone().map(PathBuf::from);
|
|
|
|
config.dist_upload_addr = t.upload_addr.clone();
|
2017-02-14 09:54:58 -08:00
|
|
|
set(&mut config.rust_dist_src, t.src_tarball);
|
2017-01-24 14:37:04 -08:00
|
|
|
}
|
|
|
|
|
2017-08-26 15:01:48 -07:00
|
|
|
// Now that we've reached the end of our configuration, infer the
|
|
|
|
// default values for all options that we haven't otherwise stored yet.
|
2017-06-20 18:04:36 -06:00
|
|
|
|
2018-03-10 07:02:17 -07:00
|
|
|
set(&mut config.initial_rustc, build.rustc.map(PathBuf::from));
|
2018-04-07 15:10:36 +01:00
|
|
|
set(&mut config.initial_cargo, build.cargo.map(PathBuf::from));
|
2018-03-10 07:02:17 -07:00
|
|
|
|
2017-11-06 18:57:51 +01:00
|
|
|
let default = false;
|
2017-08-26 15:01:48 -07:00
|
|
|
config.llvm_assertions = llvm_assertions.unwrap_or(default);
|
2015-11-19 16:55:21 -08:00
|
|
|
|
2017-08-26 15:01:48 -07:00
|
|
|
let default = match &config.channel[..] {
|
|
|
|
"stable" | "beta" | "nightly" => true,
|
|
|
|
_ => false,
|
|
|
|
};
|
|
|
|
config.rust_debuginfo_lines = debuginfo_lines.unwrap_or(default);
|
|
|
|
config.rust_debuginfo_only_std = debuginfo_only_std.unwrap_or(default);
|
2018-04-13 21:58:21 -07:00
|
|
|
config.rust_debuginfo_tools = debuginfo_tools.unwrap_or(false);
|
2015-11-19 16:55:21 -08:00
|
|
|
|
2017-08-26 15:01:48 -07:00
|
|
|
let default = debug == Some(true);
|
|
|
|
config.debug_jemalloc = debug_jemalloc.unwrap_or(default);
|
|
|
|
config.rust_debuginfo = debuginfo.unwrap_or(default);
|
|
|
|
config.rust_debug_assertions = debug_assertions.unwrap_or(default);
|
|
|
|
config.rust_optimize = optimize.unwrap_or(!default);
|
2017-02-12 11:27:39 -08:00
|
|
|
|
2017-08-28 20:44:40 -07:00
|
|
|
let default = config.channel == "dev";
|
|
|
|
config.ignore_git = ignore_git.unwrap_or(default);
|
|
|
|
|
2017-08-26 15:01:48 -07:00
|
|
|
config
|
2015-11-19 16:55:21 -08:00
|
|
|
}
|
2016-11-16 18:02:56 -05:00
|
|
|
|
2018-02-19 16:08:36 -08:00
|
|
|
/// Try to find the relative path of `libdir`.
|
|
|
|
pub fn libdir_relative(&self) -> Option<&Path> {
|
|
|
|
let libdir = self.libdir.as_ref()?;
|
|
|
|
if libdir.is_relative() {
|
|
|
|
Some(libdir)
|
|
|
|
} else {
|
|
|
|
// Try to make it relative to the prefix.
|
|
|
|
libdir.strip_prefix(self.prefix.as_ref()?).ok()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-16 18:02:56 -05:00
|
|
|
pub fn verbose(&self) -> bool {
|
|
|
|
self.verbose > 0
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn very_verbose(&self) -> bool {
|
|
|
|
self.verbose > 1
|
|
|
|
}
|
2015-11-19 15:20:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
fn set<T>(field: &mut T, val: Option<T>) {
|
|
|
|
if let Some(v) = val {
|
|
|
|
*field = v;
|
|
|
|
}
|
|
|
|
}
|