1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 //! Serialized configuration of a build.
13 //! This module implements parsing `config.mk` and `config.toml` configuration
14 //! files to tweak how the build runs.
16 use std::collections::HashMap;
18 use std::fs::{self, File};
19 use std::io::prelude::*;
20 use std::path::PathBuf;
26 use util::{exe, push_exe_path};
27 use cache::{INTERNER, Interned};
29 pub use flags::Subcommand;
31 /// Global configuration for the entire build and/or bootstrap.
33 /// This structure is derived from a combination of both `config.toml` and
34 /// `config.mk`. As of the time of this writing it's unlikely that `config.toml`
35 /// is used all that much, so this is primarily filled out by `config.mk` which
36 /// is generated from `./configure`.
38 /// Note that this structure is not decoded directly into, but rather it is
39 /// filled out from the decoded forms of the structs below. For documentation
40 /// each field, see the corresponding fields in
41 /// `config.toml.example`.
44 pub ccache: Option<String>,
48 pub compiler_docs: bool,
50 pub locked_deps: bool,
52 pub target_config: HashMap<Interned<String>, Target>,
53 pub full_bootstrap: bool,
58 pub on_fail: Option<String>,
59 pub stage: Option<u32>,
60 pub keep_stage: Option<u32>,
62 pub jobs: Option<u32>,
64 pub incremental: bool,
66 // llvm codegen options
67 pub llvm_enabled: bool,
68 pub llvm_assertions: bool,
69 pub llvm_optimize: bool,
70 pub llvm_release_debuginfo: bool,
71 pub llvm_version_check: bool,
72 pub llvm_static_stdcpp: bool,
73 pub llvm_link_shared: bool,
74 pub llvm_targets: Option<String>,
75 pub llvm_experimental_targets: Option<String>,
76 pub llvm_link_jobs: Option<u32>,
78 // rust codegen options
79 pub rust_optimize: bool,
80 pub rust_codegen_units: u32,
81 pub rust_debug_assertions: bool,
82 pub rust_debuginfo: bool,
83 pub rust_debuginfo_lines: bool,
84 pub rust_debuginfo_only_std: bool,
86 pub rustc_default_linker: Option<String>,
87 pub rustc_default_ar: Option<String>,
88 pub rust_optimize_tests: bool,
89 pub rust_debuginfo_tests: bool,
90 pub rust_dist_src: bool,
92 pub build: Interned<String>,
93 pub hosts: Vec<Interned<String>>,
94 pub targets: Vec<Interned<String>>,
95 pub local_rebuild: bool,
98 pub dist_sign_folder: Option<PathBuf>,
99 pub dist_upload_addr: Option<String>,
100 pub dist_gpg_password_file: Option<PathBuf>,
103 pub debug_jemalloc: bool,
104 pub use_jemalloc: bool,
105 pub backtrace: bool, // support for RUST_BACKTRACE
108 pub low_priority: bool,
110 pub quiet_tests: bool,
111 // Fallback musl-root for all targets
112 pub musl_root: Option<PathBuf>,
113 pub prefix: Option<PathBuf>,
114 pub sysconfdir: Option<PathBuf>,
115 pub docdir: Option<PathBuf>,
116 pub bindir: Option<PathBuf>,
117 pub libdir: Option<PathBuf>,
118 pub libdir_relative: Option<PathBuf>,
119 pub mandir: Option<PathBuf>,
120 pub codegen_tests: bool,
121 pub nodejs: Option<PathBuf>,
122 pub gdb: Option<PathBuf>,
123 pub python: Option<PathBuf>,
124 pub configure_args: Vec<String>,
125 pub openssl_static: bool,
128 // These are either the stage0 downloaded binaries or the locally installed ones.
129 pub initial_cargo: PathBuf,
130 pub initial_rustc: PathBuf,
134 /// Per-target configuration stored in the global configuration structure.
137 /// Some(path to llvm-config) if using an external LLVM.
138 pub llvm_config: Option<PathBuf>,
139 pub jemalloc: Option<PathBuf>,
140 pub cc: Option<PathBuf>,
141 pub cxx: Option<PathBuf>,
142 pub ndk: Option<PathBuf>,
143 pub musl_root: Option<PathBuf>,
144 pub qemu_rootfs: Option<PathBuf>,
147 /// Structure of the `config.toml` file that configuration is read from.
149 /// This structure uses `Decodable` to automatically decode a TOML configuration
150 /// file into this format, and then this is traversed and written into the above
151 /// `Config` structure.
152 #[derive(Deserialize, Default)]
153 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
155 build: Option<Build>,
156 install: Option<Install>,
159 target: Option<HashMap<String, TomlTarget>>,
163 /// TOML representation of various global build decisions.
164 #[derive(Deserialize, Default, Clone)]
165 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
167 build: Option<String>,
172 cargo: Option<String>,
173 rustc: Option<String>,
174 low_priority: Option<bool>,
175 compiler_docs: Option<bool>,
177 submodules: Option<bool>,
179 locked_deps: Option<bool>,
180 vendor: Option<bool>,
181 nodejs: Option<String>,
182 python: Option<String>,
183 full_bootstrap: Option<bool>,
184 extended: Option<bool>,
185 verbose: Option<usize>,
186 sanitizers: Option<bool>,
187 profiler: Option<bool>,
188 openssl_static: Option<bool>,
191 /// TOML representation of various global install decisions.
192 #[derive(Deserialize, Default, Clone)]
193 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
195 prefix: Option<String>,
196 sysconfdir: Option<String>,
197 docdir: Option<String>,
198 bindir: Option<String>,
199 libdir: Option<String>,
200 mandir: Option<String>,
203 /// TOML representation of how the LLVM build is configured.
204 #[derive(Deserialize, Default)]
205 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
207 enabled: Option<bool>,
208 ccache: Option<StringOrBool>,
210 assertions: Option<bool>,
211 optimize: Option<bool>,
212 release_debuginfo: Option<bool>,
213 version_check: Option<bool>,
214 static_libstdcpp: Option<bool>,
215 targets: Option<String>,
216 experimental_targets: Option<String>,
217 link_jobs: Option<u32>,
220 #[derive(Deserialize, Default, Clone)]
221 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
223 sign_folder: Option<String>,
224 gpg_password_file: Option<String>,
225 upload_addr: Option<String>,
226 src_tarball: Option<bool>,
229 #[derive(Deserialize)]
236 impl Default for StringOrBool {
237 fn default() -> StringOrBool {
238 StringOrBool::Bool(false)
242 /// TOML representation of how the Rust build is configured.
243 #[derive(Deserialize, Default)]
244 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
246 optimize: Option<bool>,
247 codegen_units: Option<u32>,
248 debug_assertions: Option<bool>,
249 debuginfo: Option<bool>,
250 debuginfo_lines: Option<bool>,
251 debuginfo_only_std: Option<bool>,
252 debug_jemalloc: Option<bool>,
253 use_jemalloc: Option<bool>,
254 backtrace: Option<bool>,
255 default_linker: Option<String>,
256 default_ar: Option<String>,
257 channel: Option<String>,
258 musl_root: Option<String>,
260 optimize_tests: Option<bool>,
261 debuginfo_tests: Option<bool>,
262 codegen_tests: Option<bool>,
265 /// TOML representation of how each build target is configured.
266 #[derive(Deserialize, Default)]
267 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
269 llvm_config: Option<String>,
270 jemalloc: Option<String>,
273 android_ndk: Option<String>,
274 musl_root: Option<String>,
275 qemu_rootfs: Option<String>,
279 pub fn parse(args: &[String]) -> Config {
280 let flags = Flags::parse(&args);
281 let file = flags.config.clone();
282 let mut config = Config::default();
283 config.llvm_enabled = true;
284 config.llvm_optimize = true;
285 config.use_jemalloc = true;
286 config.backtrace = true;
287 config.rust_optimize = true;
288 config.rust_optimize_tests = true;
289 config.submodules = true;
291 config.rust_rpath = true;
292 config.rust_codegen_units = 1;
293 config.build = flags.build;
294 config.channel = "dev".to_string();
295 config.codegen_tests = true;
296 config.rust_dist_src = true;
298 config.on_fail = flags.on_fail;
299 config.stage = flags.stage;
300 config.src = flags.src;
301 config.jobs = flags.jobs;
302 config.cmd = flags.cmd;
303 config.incremental = flags.incremental;
304 config.keep_stage = flags.keep_stage;
306 let toml = file.map(|file| {
307 let mut f = t!(File::open(&file));
308 let mut contents = String::new();
309 t!(f.read_to_string(&mut contents));
310 match toml::from_str(&contents) {
313 println!("failed to parse TOML configuration '{}': {}",
314 file.display(), err);
318 }).unwrap_or_else(|| TomlConfig::default());
320 let build = toml.build.clone().unwrap_or(Build::default());
321 set(&mut config.build, build.build.clone().map(|x| INTERNER.intern_string(x)));
322 config.hosts.push(config.build.clone());
323 for host in build.host.iter() {
324 let host = INTERNER.intern_str(host);
325 if !config.hosts.contains(&host) {
326 config.hosts.push(host);
329 for target in config.hosts.iter().cloned()
330 .chain(build.target.iter().map(|s| INTERNER.intern_str(s)))
332 if !config.targets.contains(&target) {
333 config.targets.push(target);
336 config.hosts = if !flags.host.is_empty() {
337 for host in flags.host.iter() {
338 if !config.hosts.contains(host) {
339 panic!("specified host `{}` is not in configuration", host);
346 config.targets = if !flags.target.is_empty() {
347 for target in flags.target.iter() {
348 if !config.targets.contains(target) {
349 panic!("specified target `{}` is not in configuration", target);
357 config.nodejs = build.nodejs.map(PathBuf::from);
358 config.gdb = build.gdb.map(PathBuf::from);
359 config.python = build.python.map(PathBuf::from);
360 set(&mut config.low_priority, build.low_priority);
361 set(&mut config.compiler_docs, build.compiler_docs);
362 set(&mut config.docs, build.docs);
363 set(&mut config.submodules, build.submodules);
364 set(&mut config.locked_deps, build.locked_deps);
365 set(&mut config.vendor, build.vendor);
366 set(&mut config.full_bootstrap, build.full_bootstrap);
367 set(&mut config.extended, build.extended);
368 set(&mut config.verbose, build.verbose);
369 set(&mut config.sanitizers, build.sanitizers);
370 set(&mut config.profiler, build.profiler);
371 set(&mut config.openssl_static, build.openssl_static);
372 config.verbose = cmp::max(config.verbose, flags.verbose);
374 if let Some(ref install) = toml.install {
375 config.prefix = install.prefix.clone().map(PathBuf::from);
376 config.sysconfdir = install.sysconfdir.clone().map(PathBuf::from);
377 config.docdir = install.docdir.clone().map(PathBuf::from);
378 config.bindir = install.bindir.clone().map(PathBuf::from);
379 config.libdir = install.libdir.clone().map(PathBuf::from);
380 config.mandir = install.mandir.clone().map(PathBuf::from);
383 if let Some(ref llvm) = toml.llvm {
385 Some(StringOrBool::String(ref s)) => {
386 config.ccache = Some(s.to_string())
388 Some(StringOrBool::Bool(true)) => {
389 config.ccache = Some("ccache".to_string());
391 Some(StringOrBool::Bool(false)) | None => {}
393 set(&mut config.ninja, llvm.ninja);
394 set(&mut config.llvm_enabled, llvm.enabled);
395 set(&mut config.llvm_assertions, llvm.assertions);
396 set(&mut config.llvm_optimize, llvm.optimize);
397 set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
398 set(&mut config.llvm_version_check, llvm.version_check);
399 set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
400 config.llvm_targets = llvm.targets.clone();
401 config.llvm_experimental_targets = llvm.experimental_targets.clone();
402 config.llvm_link_jobs = llvm.link_jobs;
405 if let Some(ref rust) = toml.rust {
406 set(&mut config.rust_debug_assertions, rust.debug_assertions);
407 set(&mut config.rust_debuginfo, rust.debuginfo);
408 set(&mut config.rust_debuginfo_lines, rust.debuginfo_lines);
409 set(&mut config.rust_debuginfo_only_std, rust.debuginfo_only_std);
410 set(&mut config.rust_optimize, rust.optimize);
411 set(&mut config.rust_optimize_tests, rust.optimize_tests);
412 set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
413 set(&mut config.codegen_tests, rust.codegen_tests);
414 set(&mut config.rust_rpath, rust.rpath);
415 set(&mut config.debug_jemalloc, rust.debug_jemalloc);
416 set(&mut config.use_jemalloc, rust.use_jemalloc);
417 set(&mut config.backtrace, rust.backtrace);
418 set(&mut config.channel, rust.channel.clone());
419 config.rustc_default_linker = rust.default_linker.clone();
420 config.rustc_default_ar = rust.default_ar.clone();
421 config.musl_root = rust.musl_root.clone().map(PathBuf::from);
423 match rust.codegen_units {
424 Some(0) => config.rust_codegen_units = num_cpus::get() as u32,
425 Some(n) => config.rust_codegen_units = n,
430 if let Some(ref t) = toml.target {
431 for (triple, cfg) in t {
432 let mut target = Target::default();
434 if let Some(ref s) = cfg.llvm_config {
435 target.llvm_config = Some(env::current_dir().unwrap().join(s));
437 if let Some(ref s) = cfg.jemalloc {
438 target.jemalloc = Some(env::current_dir().unwrap().join(s));
440 if let Some(ref s) = cfg.android_ndk {
441 target.ndk = Some(env::current_dir().unwrap().join(s));
443 target.cxx = cfg.cxx.clone().map(PathBuf::from);
444 target.cc = cfg.cc.clone().map(PathBuf::from);
445 target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
446 target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
448 config.target_config.insert(INTERNER.intern_string(triple.clone()), target);
452 if let Some(ref t) = toml.dist {
453 config.dist_sign_folder = t.sign_folder.clone().map(PathBuf::from);
454 config.dist_gpg_password_file = t.gpg_password_file.clone().map(PathBuf::from);
455 config.dist_upload_addr = t.upload_addr.clone();
456 set(&mut config.rust_dist_src, t.src_tarball);
459 let cwd = t!(env::current_dir());
460 let out = cwd.join("build");
462 let stage0_root = out.join(&config.build).join("stage0/bin");
463 config.initial_rustc = match build.rustc {
464 Some(s) => PathBuf::from(s),
465 None => stage0_root.join(exe("rustc", &config.build)),
467 config.initial_cargo = match build.cargo {
468 Some(s) => PathBuf::from(s),
469 None => stage0_root.join(exe("cargo", &config.build)),
472 // compat with `./configure` while we're still using that
473 if fs::metadata("config.mk").is_ok() {
474 config.update_with_config_mk();
480 /// "Temporary" routine to parse `config.mk` into this configuration.
482 /// While we still have `./configure` this implements the ability to decode
483 /// that configuration into this. This isn't exactly a full-blown makefile
484 /// parser, but hey it gets the job done!
485 fn update_with_config_mk(&mut self) {
486 let mut config = String::new();
487 File::open("config.mk").unwrap().read_to_string(&mut config).unwrap();
488 for line in config.lines() {
489 let mut parts = line.splitn(2, ":=").map(|s| s.trim());
490 let key = parts.next().unwrap();
491 let value = match parts.next() {
492 Some(n) if n.starts_with('\"') => &n[1..n.len() - 1],
498 ($(($name:expr, $val:expr),)*) => {
501 if key == concat!("CFG_ENABLE_", $name) {
505 if key == concat!("CFG_DISABLE_", $name) {
515 ("MANAGE_SUBMODULES", self.submodules),
516 ("COMPILER_DOCS", self.compiler_docs),
518 ("LLVM_ASSERTIONS", self.llvm_assertions),
519 ("LLVM_RELEASE_DEBUGINFO", self.llvm_release_debuginfo),
520 ("OPTIMIZE_LLVM", self.llvm_optimize),
521 ("LLVM_VERSION_CHECK", self.llvm_version_check),
522 ("LLVM_STATIC_STDCPP", self.llvm_static_stdcpp),
523 ("LLVM_LINK_SHARED", self.llvm_link_shared),
524 ("OPTIMIZE", self.rust_optimize),
525 ("DEBUG_ASSERTIONS", self.rust_debug_assertions),
526 ("DEBUGINFO", self.rust_debuginfo),
527 ("DEBUGINFO_LINES", self.rust_debuginfo_lines),
528 ("DEBUGINFO_ONLY_STD", self.rust_debuginfo_only_std),
529 ("JEMALLOC", self.use_jemalloc),
530 ("DEBUG_JEMALLOC", self.debug_jemalloc),
531 ("RPATH", self.rust_rpath),
532 ("OPTIMIZE_TESTS", self.rust_optimize_tests),
533 ("DEBUGINFO_TESTS", self.rust_debuginfo_tests),
534 ("QUIET_TESTS", self.quiet_tests),
535 ("LOCAL_REBUILD", self.local_rebuild),
536 ("NINJA", self.ninja),
537 ("CODEGEN_TESTS", self.codegen_tests),
538 ("LOCKED_DEPS", self.locked_deps),
539 ("VENDOR", self.vendor),
540 ("FULL_BOOTSTRAP", self.full_bootstrap),
541 ("EXTENDED", self.extended),
542 ("SANITIZERS", self.sanitizers),
543 ("PROFILER", self.profiler),
544 ("DIST_SRC", self.rust_dist_src),
545 ("CARGO_OPENSSL_STATIC", self.openssl_static),
549 "CFG_BUILD" if value.len() > 0 => self.build = INTERNER.intern_str(value),
550 "CFG_HOST" if value.len() > 0 => {
551 self.hosts.extend(value.split(" ").map(|s| INTERNER.intern_str(s)));
554 "CFG_TARGET" if value.len() > 0 => {
555 self.targets.extend(value.split(" ").map(|s| INTERNER.intern_str(s)));
557 "CFG_EXPERIMENTAL_TARGETS" if value.len() > 0 => {
558 self.llvm_experimental_targets = Some(value.to_string());
560 "CFG_MUSL_ROOT" if value.len() > 0 => {
561 self.musl_root = Some(parse_configure_path(value));
563 "CFG_MUSL_ROOT_X86_64" if value.len() > 0 => {
564 let target = INTERNER.intern_str("x86_64-unknown-linux-musl");
565 let target = self.target_config.entry(target).or_insert(Target::default());
566 target.musl_root = Some(parse_configure_path(value));
568 "CFG_MUSL_ROOT_I686" if value.len() > 0 => {
569 let target = INTERNER.intern_str("i686-unknown-linux-musl");
570 let target = self.target_config.entry(target).or_insert(Target::default());
571 target.musl_root = Some(parse_configure_path(value));
573 "CFG_MUSL_ROOT_ARM" if value.len() > 0 => {
574 let target = INTERNER.intern_str("arm-unknown-linux-musleabi");
575 let target = self.target_config.entry(target).or_insert(Target::default());
576 target.musl_root = Some(parse_configure_path(value));
578 "CFG_MUSL_ROOT_ARMHF" if value.len() > 0 => {
579 let target = INTERNER.intern_str("arm-unknown-linux-musleabihf");
580 let target = self.target_config.entry(target).or_insert(Target::default());
581 target.musl_root = Some(parse_configure_path(value));
583 "CFG_MUSL_ROOT_ARMV7" if value.len() > 0 => {
584 let target = INTERNER.intern_str("armv7-unknown-linux-musleabihf");
585 let target = self.target_config.entry(target).or_insert(Target::default());
586 target.musl_root = Some(parse_configure_path(value));
588 "CFG_DEFAULT_AR" if value.len() > 0 => {
589 self.rustc_default_ar = Some(value.to_string());
591 "CFG_DEFAULT_LINKER" if value.len() > 0 => {
592 self.rustc_default_linker = Some(value.to_string());
594 "CFG_GDB" if value.len() > 0 => {
595 self.gdb = Some(parse_configure_path(value));
597 "CFG_RELEASE_CHANNEL" => {
598 self.channel = value.to_string();
601 self.prefix = Some(PathBuf::from(value));
603 "CFG_SYSCONFDIR" => {
604 self.sysconfdir = Some(PathBuf::from(value));
607 self.docdir = Some(PathBuf::from(value));
610 self.bindir = Some(PathBuf::from(value));
613 self.libdir = Some(PathBuf::from(value));
615 "CFG_LIBDIR_RELATIVE" => {
616 self.libdir_relative = Some(PathBuf::from(value));
619 self.mandir = Some(PathBuf::from(value));
621 "CFG_LLVM_ROOT" if value.len() > 0 => {
622 let target = self.target_config.entry(self.build.clone())
623 .or_insert(Target::default());
624 let root = parse_configure_path(value);
625 target.llvm_config = Some(push_exe_path(root, &["bin", "llvm-config"]));
627 "CFG_JEMALLOC_ROOT" if value.len() > 0 => {
628 let target = self.target_config.entry(self.build.clone())
629 .or_insert(Target::default());
630 target.jemalloc = Some(parse_configure_path(value).join("libjemalloc_pic.a"));
632 "CFG_ARM_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
633 let target = INTERNER.intern_str("arm-linux-androideabi");
634 let target = self.target_config.entry(target).or_insert(Target::default());
635 target.ndk = Some(parse_configure_path(value));
637 "CFG_ARMV7_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
638 let target = INTERNER.intern_str("armv7-linux-androideabi");
639 let target = self.target_config.entry(target).or_insert(Target::default());
640 target.ndk = Some(parse_configure_path(value));
642 "CFG_I686_LINUX_ANDROID_NDK" if value.len() > 0 => {
643 let target = INTERNER.intern_str("i686-linux-android");
644 let target = self.target_config.entry(target).or_insert(Target::default());
645 target.ndk = Some(parse_configure_path(value));
647 "CFG_AARCH64_LINUX_ANDROID_NDK" if value.len() > 0 => {
648 let target = INTERNER.intern_str("aarch64-linux-android");
649 let target = self.target_config.entry(target).or_insert(Target::default());
650 target.ndk = Some(parse_configure_path(value));
652 "CFG_X86_64_LINUX_ANDROID_NDK" if value.len() > 0 => {
653 let target = INTERNER.intern_str("x86_64-linux-android");
654 let target = self.target_config.entry(target).or_insert(Target::default());
655 target.ndk = Some(parse_configure_path(value));
657 "CFG_LOCAL_RUST_ROOT" if value.len() > 0 => {
658 let path = parse_configure_path(value);
659 self.initial_rustc = push_exe_path(path.clone(), &["bin", "rustc"]);
660 self.initial_cargo = push_exe_path(path, &["bin", "cargo"]);
662 "CFG_PYTHON" if value.len() > 0 => {
663 let path = parse_configure_path(value);
664 self.python = Some(path);
666 "CFG_ENABLE_CCACHE" if value == "1" => {
667 self.ccache = Some(exe("ccache", &self.build));
669 "CFG_ENABLE_SCCACHE" if value == "1" => {
670 self.ccache = Some(exe("sccache", &self.build));
672 "CFG_CONFIGURE_ARGS" if value.len() > 0 => {
673 self.configure_args = value.split_whitespace()
674 .map(|s| s.to_string())
677 "CFG_QEMU_ARMHF_ROOTFS" if value.len() > 0 => {
678 let target = INTERNER.intern_str("arm-unknown-linux-gnueabihf");
679 let target = self.target_config.entry(target).or_insert(Target::default());
680 target.qemu_rootfs = Some(parse_configure_path(value));
682 "CFG_QEMU_AARCH64_ROOTFS" if value.len() > 0 => {
683 let target = INTERNER.intern_str("aarch64-unknown-linux-gnu");
684 let target = self.target_config.entry(target).or_insert(Target::default());
685 target.qemu_rootfs = Some(parse_configure_path(value));
692 pub fn verbose(&self) -> bool {
696 pub fn very_verbose(&self) -> bool {
702 fn parse_configure_path(path: &str) -> PathBuf {
707 fn parse_configure_path(path: &str) -> PathBuf {
708 // on windows, configure produces unix style paths e.g. /c/some/path but we
709 // only want real windows paths
711 use std::process::Command;
714 // '/' is invalid in windows paths, so we can detect unix paths by the presence of it
715 if !path.contains('/') {
719 let win_path = build_helper::output(Command::new("cygpath").arg("-w").arg(path));
720 let win_path = win_path.trim();
725 fn set<T>(field: &mut T, val: Option<T>) {
726 if let Some(v) = val {