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,
59 pub run_host_only: bool,
61 pub on_fail: Option<String>,
62 pub stage: Option<u32>,
63 pub keep_stage: Option<u32>,
65 pub jobs: Option<u32>,
67 pub incremental: bool,
69 // llvm codegen options
70 pub llvm_enabled: bool,
71 pub llvm_assertions: bool,
72 pub llvm_optimize: bool,
73 pub llvm_release_debuginfo: bool,
74 pub llvm_version_check: bool,
75 pub llvm_static_stdcpp: bool,
76 pub llvm_link_shared: bool,
77 pub llvm_targets: Option<String>,
78 pub llvm_experimental_targets: Option<String>,
79 pub llvm_link_jobs: Option<u32>,
81 // rust codegen options
82 pub rust_optimize: bool,
83 pub rust_codegen_units: u32,
84 pub rust_debug_assertions: bool,
85 pub rust_debuginfo: bool,
86 pub rust_debuginfo_lines: bool,
87 pub rust_debuginfo_only_std: bool,
89 pub rustc_default_linker: Option<String>,
90 pub rustc_default_ar: Option<String>,
91 pub rust_optimize_tests: bool,
92 pub rust_debuginfo_tests: bool,
93 pub rust_dist_src: bool,
95 pub build: Interned<String>,
96 pub hosts: Vec<Interned<String>>,
97 pub targets: Vec<Interned<String>>,
98 pub local_rebuild: bool,
101 pub dist_sign_folder: Option<PathBuf>,
102 pub dist_upload_addr: Option<String>,
103 pub dist_gpg_password_file: Option<PathBuf>,
106 pub debug_jemalloc: bool,
107 pub use_jemalloc: bool,
108 pub backtrace: bool, // support for RUST_BACKTRACE
111 pub low_priority: bool,
113 pub quiet_tests: bool,
114 // Fallback musl-root for all targets
115 pub musl_root: Option<PathBuf>,
116 pub prefix: Option<PathBuf>,
117 pub sysconfdir: Option<PathBuf>,
118 pub docdir: Option<PathBuf>,
119 pub bindir: Option<PathBuf>,
120 pub libdir: Option<PathBuf>,
121 pub libdir_relative: Option<PathBuf>,
122 pub mandir: Option<PathBuf>,
123 pub codegen_tests: bool,
124 pub nodejs: Option<PathBuf>,
125 pub gdb: Option<PathBuf>,
126 pub python: Option<PathBuf>,
127 pub configure_args: Vec<String>,
128 pub openssl_static: bool,
131 // These are either the stage0 downloaded binaries or the locally installed ones.
132 pub initial_cargo: PathBuf,
133 pub initial_rustc: PathBuf,
137 /// Per-target configuration stored in the global configuration structure.
140 /// Some(path to llvm-config) if using an external LLVM.
141 pub llvm_config: Option<PathBuf>,
142 pub jemalloc: Option<PathBuf>,
143 pub cc: Option<PathBuf>,
144 pub cxx: Option<PathBuf>,
145 pub ndk: Option<PathBuf>,
146 pub musl_root: Option<PathBuf>,
147 pub qemu_rootfs: Option<PathBuf>,
150 /// Structure of the `config.toml` file that configuration is read from.
152 /// This structure uses `Decodable` to automatically decode a TOML configuration
153 /// file into this format, and then this is traversed and written into the above
154 /// `Config` structure.
155 #[derive(Deserialize, Default)]
156 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
158 build: Option<Build>,
159 install: Option<Install>,
162 target: Option<HashMap<String, TomlTarget>>,
166 /// TOML representation of various global build decisions.
167 #[derive(Deserialize, Default, Clone)]
168 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
170 build: Option<String>,
175 cargo: Option<String>,
176 rustc: Option<String>,
177 low_priority: Option<bool>,
178 compiler_docs: Option<bool>,
180 submodules: Option<bool>,
182 locked_deps: Option<bool>,
183 vendor: Option<bool>,
184 nodejs: Option<String>,
185 python: Option<String>,
186 full_bootstrap: Option<bool>,
187 extended: Option<bool>,
188 verbose: Option<usize>,
189 sanitizers: Option<bool>,
190 profiler: Option<bool>,
191 openssl_static: Option<bool>,
194 /// TOML representation of various global install decisions.
195 #[derive(Deserialize, Default, Clone)]
196 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
198 prefix: Option<String>,
199 sysconfdir: Option<String>,
200 docdir: Option<String>,
201 bindir: Option<String>,
202 libdir: Option<String>,
203 mandir: Option<String>,
206 /// TOML representation of how the LLVM build is configured.
207 #[derive(Deserialize, Default)]
208 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
210 enabled: Option<bool>,
211 ccache: Option<StringOrBool>,
213 assertions: Option<bool>,
214 optimize: Option<bool>,
215 release_debuginfo: Option<bool>,
216 version_check: Option<bool>,
217 static_libstdcpp: Option<bool>,
218 targets: Option<String>,
219 experimental_targets: Option<String>,
220 link_jobs: Option<u32>,
223 #[derive(Deserialize, Default, Clone)]
224 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
226 sign_folder: Option<String>,
227 gpg_password_file: Option<String>,
228 upload_addr: Option<String>,
229 src_tarball: Option<bool>,
232 #[derive(Deserialize)]
239 impl Default for StringOrBool {
240 fn default() -> StringOrBool {
241 StringOrBool::Bool(false)
245 /// TOML representation of how the Rust build is configured.
246 #[derive(Deserialize, Default)]
247 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
249 optimize: Option<bool>,
250 codegen_units: Option<u32>,
251 debug_assertions: Option<bool>,
252 debuginfo: Option<bool>,
253 debuginfo_lines: Option<bool>,
254 debuginfo_only_std: Option<bool>,
255 debug_jemalloc: Option<bool>,
256 use_jemalloc: Option<bool>,
257 backtrace: Option<bool>,
258 default_linker: Option<String>,
259 default_ar: Option<String>,
260 channel: Option<String>,
261 musl_root: Option<String>,
263 optimize_tests: Option<bool>,
264 debuginfo_tests: Option<bool>,
265 codegen_tests: Option<bool>,
266 ignore_git: Option<bool>,
269 /// TOML representation of how each build target is configured.
270 #[derive(Deserialize, Default)]
271 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
273 llvm_config: Option<String>,
274 jemalloc: Option<String>,
277 android_ndk: Option<String>,
278 musl_root: Option<String>,
279 qemu_rootfs: Option<String>,
283 pub fn parse(args: &[String]) -> Config {
284 let flags = Flags::parse(&args);
285 let file = flags.config.clone();
286 let mut config = Config::default();
287 config.llvm_enabled = true;
288 config.llvm_optimize = true;
289 config.use_jemalloc = true;
290 config.backtrace = true;
291 config.rust_optimize = true;
292 config.rust_optimize_tests = true;
293 config.submodules = true;
295 config.rust_rpath = true;
296 config.rust_codegen_units = 1;
297 config.channel = "dev".to_string();
298 config.codegen_tests = true;
299 config.ignore_git = false;
300 config.rust_dist_src = true;
302 config.on_fail = flags.on_fail;
303 config.stage = flags.stage;
304 config.src = flags.src;
305 config.jobs = flags.jobs;
306 config.cmd = flags.cmd;
307 config.incremental = flags.incremental;
308 config.keep_stage = flags.keep_stage;
310 // If --target was specified but --host wasn't specified, don't run any host-only tests.
311 config.run_host_only = flags.host.is_empty() && !flags.target.is_empty();
313 let toml = file.map(|file| {
314 let mut f = t!(File::open(&file));
315 let mut contents = String::new();
316 t!(f.read_to_string(&mut contents));
317 match toml::from_str(&contents) {
320 println!("failed to parse TOML configuration '{}': {}",
321 file.display(), err);
325 }).unwrap_or_else(|| TomlConfig::default());
327 let build = toml.build.clone().unwrap_or(Build::default());
328 set(&mut config.build, build.build.clone().map(|x| INTERNER.intern_string(x)));
329 set(&mut config.build, flags.build);
330 if config.build.is_empty() {
331 // set by bootstrap.py
332 config.build = INTERNER.intern_str(&env::var("BUILD").unwrap());
334 config.hosts.push(config.build.clone());
335 for host in build.host.iter() {
336 let host = INTERNER.intern_str(host);
337 if !config.hosts.contains(&host) {
338 config.hosts.push(host);
341 for target in config.hosts.iter().cloned()
342 .chain(build.target.iter().map(|s| INTERNER.intern_str(s)))
344 if !config.targets.contains(&target) {
345 config.targets.push(target);
348 config.hosts = if !flags.host.is_empty() {
353 config.targets = if !flags.target.is_empty() {
360 config.nodejs = build.nodejs.map(PathBuf::from);
361 config.gdb = build.gdb.map(PathBuf::from);
362 config.python = build.python.map(PathBuf::from);
363 set(&mut config.low_priority, build.low_priority);
364 set(&mut config.compiler_docs, build.compiler_docs);
365 set(&mut config.docs, build.docs);
366 set(&mut config.submodules, build.submodules);
367 set(&mut config.locked_deps, build.locked_deps);
368 set(&mut config.vendor, build.vendor);
369 set(&mut config.full_bootstrap, build.full_bootstrap);
370 set(&mut config.extended, build.extended);
371 set(&mut config.verbose, build.verbose);
372 set(&mut config.sanitizers, build.sanitizers);
373 set(&mut config.profiler, build.profiler);
374 set(&mut config.openssl_static, build.openssl_static);
375 config.verbose = cmp::max(config.verbose, flags.verbose);
377 if let Some(ref install) = toml.install {
378 config.prefix = install.prefix.clone().map(PathBuf::from);
379 config.sysconfdir = install.sysconfdir.clone().map(PathBuf::from);
380 config.docdir = install.docdir.clone().map(PathBuf::from);
381 config.bindir = install.bindir.clone().map(PathBuf::from);
382 config.libdir = install.libdir.clone().map(PathBuf::from);
383 config.mandir = install.mandir.clone().map(PathBuf::from);
386 if let Some(ref llvm) = toml.llvm {
388 Some(StringOrBool::String(ref s)) => {
389 config.ccache = Some(s.to_string())
391 Some(StringOrBool::Bool(true)) => {
392 config.ccache = Some("ccache".to_string());
394 Some(StringOrBool::Bool(false)) | None => {}
396 set(&mut config.ninja, llvm.ninja);
397 set(&mut config.llvm_enabled, llvm.enabled);
398 set(&mut config.llvm_assertions, llvm.assertions);
399 set(&mut config.llvm_optimize, llvm.optimize);
400 set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
401 set(&mut config.llvm_version_check, llvm.version_check);
402 set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
403 config.llvm_targets = llvm.targets.clone();
404 config.llvm_experimental_targets = llvm.experimental_targets.clone();
405 config.llvm_link_jobs = llvm.link_jobs;
408 if let Some(ref rust) = toml.rust {
409 set(&mut config.rust_debug_assertions, rust.debug_assertions);
410 set(&mut config.rust_debuginfo, rust.debuginfo);
411 set(&mut config.rust_debuginfo_lines, rust.debuginfo_lines);
412 set(&mut config.rust_debuginfo_only_std, rust.debuginfo_only_std);
413 set(&mut config.rust_optimize, rust.optimize);
414 set(&mut config.rust_optimize_tests, rust.optimize_tests);
415 set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
416 set(&mut config.codegen_tests, rust.codegen_tests);
417 set(&mut config.rust_rpath, rust.rpath);
418 set(&mut config.debug_jemalloc, rust.debug_jemalloc);
419 set(&mut config.use_jemalloc, rust.use_jemalloc);
420 set(&mut config.backtrace, rust.backtrace);
421 set(&mut config.channel, rust.channel.clone());
422 set(&mut config.ignore_git, rust.ignore_git);
423 config.rustc_default_linker = rust.default_linker.clone();
424 config.rustc_default_ar = rust.default_ar.clone();
425 config.musl_root = rust.musl_root.clone().map(PathBuf::from);
427 match rust.codegen_units {
428 Some(0) => config.rust_codegen_units = num_cpus::get() as u32,
429 Some(n) => config.rust_codegen_units = n,
434 if let Some(ref t) = toml.target {
435 for (triple, cfg) in t {
436 let mut target = Target::default();
438 if let Some(ref s) = cfg.llvm_config {
439 target.llvm_config = Some(env::current_dir().unwrap().join(s));
441 if let Some(ref s) = cfg.jemalloc {
442 target.jemalloc = Some(env::current_dir().unwrap().join(s));
444 if let Some(ref s) = cfg.android_ndk {
445 target.ndk = Some(env::current_dir().unwrap().join(s));
447 target.cxx = cfg.cxx.clone().map(PathBuf::from);
448 target.cc = cfg.cc.clone().map(PathBuf::from);
449 target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
450 target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
452 config.target_config.insert(INTERNER.intern_string(triple.clone()), target);
456 if let Some(ref t) = toml.dist {
457 config.dist_sign_folder = t.sign_folder.clone().map(PathBuf::from);
458 config.dist_gpg_password_file = t.gpg_password_file.clone().map(PathBuf::from);
459 config.dist_upload_addr = t.upload_addr.clone();
460 set(&mut config.rust_dist_src, t.src_tarball);
463 let cwd = t!(env::current_dir());
464 let out = cwd.join("build");
466 let stage0_root = out.join(&config.build).join("stage0/bin");
467 config.initial_rustc = match build.rustc {
468 Some(s) => PathBuf::from(s),
469 None => stage0_root.join(exe("rustc", &config.build)),
471 config.initial_cargo = match build.cargo {
472 Some(s) => PathBuf::from(s),
473 None => stage0_root.join(exe("cargo", &config.build)),
476 // compat with `./configure` while we're still using that
477 if fs::metadata("config.mk").is_ok() {
478 config.update_with_config_mk();
484 /// "Temporary" routine to parse `config.mk` into this configuration.
486 /// While we still have `./configure` this implements the ability to decode
487 /// that configuration into this. This isn't exactly a full-blown makefile
488 /// parser, but hey it gets the job done!
489 fn update_with_config_mk(&mut self) {
490 let mut config = String::new();
491 File::open("config.mk").unwrap().read_to_string(&mut config).unwrap();
492 for line in config.lines() {
493 let mut parts = line.splitn(2, ":=").map(|s| s.trim());
494 let key = parts.next().unwrap();
495 let value = match parts.next() {
496 Some(n) if n.starts_with('\"') => &n[1..n.len() - 1],
502 ($(($name:expr, $val:expr),)*) => {
505 if key == concat!("CFG_ENABLE_", $name) {
509 if key == concat!("CFG_DISABLE_", $name) {
519 ("MANAGE_SUBMODULES", self.submodules),
520 ("COMPILER_DOCS", self.compiler_docs),
522 ("LLVM_ASSERTIONS", self.llvm_assertions),
523 ("LLVM_RELEASE_DEBUGINFO", self.llvm_release_debuginfo),
524 ("OPTIMIZE_LLVM", self.llvm_optimize),
525 ("LLVM_VERSION_CHECK", self.llvm_version_check),
526 ("LLVM_STATIC_STDCPP", self.llvm_static_stdcpp),
527 ("LLVM_LINK_SHARED", self.llvm_link_shared),
528 ("OPTIMIZE", self.rust_optimize),
529 ("DEBUG_ASSERTIONS", self.rust_debug_assertions),
530 ("DEBUGINFO", self.rust_debuginfo),
531 ("DEBUGINFO_LINES", self.rust_debuginfo_lines),
532 ("DEBUGINFO_ONLY_STD", self.rust_debuginfo_only_std),
533 ("JEMALLOC", self.use_jemalloc),
534 ("DEBUG_JEMALLOC", self.debug_jemalloc),
535 ("RPATH", self.rust_rpath),
536 ("OPTIMIZE_TESTS", self.rust_optimize_tests),
537 ("DEBUGINFO_TESTS", self.rust_debuginfo_tests),
538 ("QUIET_TESTS", self.quiet_tests),
539 ("LOCAL_REBUILD", self.local_rebuild),
540 ("NINJA", self.ninja),
541 ("CODEGEN_TESTS", self.codegen_tests),
542 ("LOCKED_DEPS", self.locked_deps),
543 ("VENDOR", self.vendor),
544 ("FULL_BOOTSTRAP", self.full_bootstrap),
545 ("EXTENDED", self.extended),
546 ("SANITIZERS", self.sanitizers),
547 ("PROFILER", self.profiler),
548 ("DIST_SRC", self.rust_dist_src),
549 ("CARGO_OPENSSL_STATIC", self.openssl_static),
553 "CFG_BUILD" if value.len() > 0 => self.build = INTERNER.intern_str(value),
554 "CFG_HOST" if value.len() > 0 => {
555 self.hosts.extend(value.split(" ").map(|s| INTERNER.intern_str(s)));
558 "CFG_TARGET" if value.len() > 0 => {
559 self.targets.extend(value.split(" ").map(|s| INTERNER.intern_str(s)));
561 "CFG_EXPERIMENTAL_TARGETS" if value.len() > 0 => {
562 self.llvm_experimental_targets = Some(value.to_string());
564 "CFG_MUSL_ROOT" if value.len() > 0 => {
565 self.musl_root = Some(parse_configure_path(value));
567 "CFG_MUSL_ROOT_X86_64" if value.len() > 0 => {
568 let target = INTERNER.intern_str("x86_64-unknown-linux-musl");
569 let target = self.target_config.entry(target).or_insert(Target::default());
570 target.musl_root = Some(parse_configure_path(value));
572 "CFG_MUSL_ROOT_I686" if value.len() > 0 => {
573 let target = INTERNER.intern_str("i686-unknown-linux-musl");
574 let target = self.target_config.entry(target).or_insert(Target::default());
575 target.musl_root = Some(parse_configure_path(value));
577 "CFG_MUSL_ROOT_ARM" if value.len() > 0 => {
578 let target = INTERNER.intern_str("arm-unknown-linux-musleabi");
579 let target = self.target_config.entry(target).or_insert(Target::default());
580 target.musl_root = Some(parse_configure_path(value));
582 "CFG_MUSL_ROOT_ARMHF" if value.len() > 0 => {
583 let target = INTERNER.intern_str("arm-unknown-linux-musleabihf");
584 let target = self.target_config.entry(target).or_insert(Target::default());
585 target.musl_root = Some(parse_configure_path(value));
587 "CFG_MUSL_ROOT_ARMV7" if value.len() > 0 => {
588 let target = INTERNER.intern_str("armv7-unknown-linux-musleabihf");
589 let target = self.target_config.entry(target).or_insert(Target::default());
590 target.musl_root = Some(parse_configure_path(value));
592 "CFG_DEFAULT_AR" if value.len() > 0 => {
593 self.rustc_default_ar = Some(value.to_string());
595 "CFG_DEFAULT_LINKER" if value.len() > 0 => {
596 self.rustc_default_linker = Some(value.to_string());
598 "CFG_GDB" if value.len() > 0 => {
599 self.gdb = Some(parse_configure_path(value));
601 "CFG_RELEASE_CHANNEL" => {
602 self.channel = value.to_string();
605 self.prefix = Some(PathBuf::from(value));
607 "CFG_SYSCONFDIR" => {
608 self.sysconfdir = Some(PathBuf::from(value));
611 self.docdir = Some(PathBuf::from(value));
614 self.bindir = Some(PathBuf::from(value));
617 self.libdir = Some(PathBuf::from(value));
619 "CFG_LIBDIR_RELATIVE" => {
620 self.libdir_relative = Some(PathBuf::from(value));
623 self.mandir = Some(PathBuf::from(value));
625 "CFG_LLVM_ROOT" if value.len() > 0 => {
626 let target = self.target_config.entry(self.build.clone())
627 .or_insert(Target::default());
628 let root = parse_configure_path(value);
629 target.llvm_config = Some(push_exe_path(root, &["bin", "llvm-config"]));
631 "CFG_JEMALLOC_ROOT" if value.len() > 0 => {
632 let target = self.target_config.entry(self.build.clone())
633 .or_insert(Target::default());
634 target.jemalloc = Some(parse_configure_path(value).join("libjemalloc_pic.a"));
636 "CFG_ARM_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
637 let target = INTERNER.intern_str("arm-linux-androideabi");
638 let target = self.target_config.entry(target).or_insert(Target::default());
639 target.ndk = Some(parse_configure_path(value));
641 "CFG_ARMV7_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
642 let target = INTERNER.intern_str("armv7-linux-androideabi");
643 let target = self.target_config.entry(target).or_insert(Target::default());
644 target.ndk = Some(parse_configure_path(value));
646 "CFG_I686_LINUX_ANDROID_NDK" if value.len() > 0 => {
647 let target = INTERNER.intern_str("i686-linux-android");
648 let target = self.target_config.entry(target).or_insert(Target::default());
649 target.ndk = Some(parse_configure_path(value));
651 "CFG_AARCH64_LINUX_ANDROID_NDK" if value.len() > 0 => {
652 let target = INTERNER.intern_str("aarch64-linux-android");
653 let target = self.target_config.entry(target).or_insert(Target::default());
654 target.ndk = Some(parse_configure_path(value));
656 "CFG_X86_64_LINUX_ANDROID_NDK" if value.len() > 0 => {
657 let target = INTERNER.intern_str("x86_64-linux-android");
658 let target = self.target_config.entry(target).or_insert(Target::default());
659 target.ndk = Some(parse_configure_path(value));
661 "CFG_LOCAL_RUST_ROOT" if value.len() > 0 => {
662 let path = parse_configure_path(value);
663 self.initial_rustc = push_exe_path(path.clone(), &["bin", "rustc"]);
664 self.initial_cargo = push_exe_path(path, &["bin", "cargo"]);
666 "CFG_PYTHON" if value.len() > 0 => {
667 let path = parse_configure_path(value);
668 self.python = Some(path);
670 "CFG_ENABLE_CCACHE" if value == "1" => {
671 self.ccache = Some(exe("ccache", &self.build));
673 "CFG_ENABLE_SCCACHE" if value == "1" => {
674 self.ccache = Some(exe("sccache", &self.build));
676 "CFG_CONFIGURE_ARGS" if value.len() > 0 => {
677 self.configure_args = value.split_whitespace()
678 .map(|s| s.to_string())
681 "CFG_QEMU_ARMHF_ROOTFS" if value.len() > 0 => {
682 let target = INTERNER.intern_str("arm-unknown-linux-gnueabihf");
683 let target = self.target_config.entry(target).or_insert(Target::default());
684 target.qemu_rootfs = Some(parse_configure_path(value));
686 "CFG_QEMU_AARCH64_ROOTFS" if value.len() > 0 => {
687 let target = INTERNER.intern_str("aarch64-unknown-linux-gnu");
688 let target = self.target_config.entry(target).or_insert(Target::default());
689 target.qemu_rootfs = Some(parse_configure_path(value));
696 pub fn verbose(&self) -> bool {
700 pub fn very_verbose(&self) -> bool {
706 fn parse_configure_path(path: &str) -> PathBuf {
711 fn parse_configure_path(path: &str) -> PathBuf {
712 // on windows, configure produces unix style paths e.g. /c/some/path but we
713 // only want real windows paths
715 use std::process::Command;
718 // '/' is invalid in windows paths, so we can detect unix paths by the presence of it
719 if !path.contains('/') {
723 let win_path = build_helper::output(Command::new("cygpath").arg("-w").arg(path));
724 let win_path = win_path.trim();
729 fn set<T>(field: &mut T, val: Option<T>) {
730 if let Some(v) = val {