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 on_fail: Option<String>,
60 pub stage: Option<u32>,
61 pub keep_stage: Option<u32>,
63 pub jobs: Option<u32>,
65 pub incremental: bool,
67 // llvm codegen options
68 pub llvm_enabled: bool,
69 pub llvm_assertions: bool,
70 pub llvm_optimize: bool,
71 pub llvm_release_debuginfo: bool,
72 pub llvm_version_check: bool,
73 pub llvm_static_stdcpp: bool,
74 pub llvm_link_shared: bool,
75 pub llvm_targets: Option<String>,
76 pub llvm_experimental_targets: Option<String>,
77 pub llvm_link_jobs: Option<u32>,
79 // rust codegen options
80 pub rust_optimize: bool,
81 pub rust_codegen_units: u32,
82 pub rust_debug_assertions: bool,
83 pub rust_debuginfo: bool,
84 pub rust_debuginfo_lines: bool,
85 pub rust_debuginfo_only_std: bool,
87 pub rustc_default_linker: Option<String>,
88 pub rustc_default_ar: Option<String>,
89 pub rust_optimize_tests: bool,
90 pub rust_debuginfo_tests: bool,
91 pub rust_dist_src: bool,
93 pub build: Interned<String>,
94 pub hosts: Vec<Interned<String>>,
95 pub targets: Vec<Interned<String>>,
96 pub local_rebuild: bool,
99 pub dist_sign_folder: Option<PathBuf>,
100 pub dist_upload_addr: Option<String>,
101 pub dist_gpg_password_file: Option<PathBuf>,
104 pub debug_jemalloc: bool,
105 pub use_jemalloc: bool,
106 pub backtrace: bool, // support for RUST_BACKTRACE
109 pub low_priority: bool,
111 pub quiet_tests: bool,
112 // Fallback musl-root for all targets
113 pub musl_root: Option<PathBuf>,
114 pub prefix: Option<PathBuf>,
115 pub sysconfdir: Option<PathBuf>,
116 pub docdir: Option<PathBuf>,
117 pub bindir: Option<PathBuf>,
118 pub libdir: Option<PathBuf>,
119 pub libdir_relative: Option<PathBuf>,
120 pub mandir: Option<PathBuf>,
121 pub codegen_tests: bool,
122 pub nodejs: Option<PathBuf>,
123 pub gdb: Option<PathBuf>,
124 pub python: Option<PathBuf>,
125 pub configure_args: Vec<String>,
126 pub openssl_static: bool,
129 // These are either the stage0 downloaded binaries or the locally installed ones.
130 pub initial_cargo: PathBuf,
131 pub initial_rustc: PathBuf,
135 /// Per-target configuration stored in the global configuration structure.
138 /// Some(path to llvm-config) if using an external LLVM.
139 pub llvm_config: Option<PathBuf>,
140 pub jemalloc: Option<PathBuf>,
141 pub cc: Option<PathBuf>,
142 pub cxx: Option<PathBuf>,
143 pub ndk: Option<PathBuf>,
144 pub musl_root: Option<PathBuf>,
145 pub qemu_rootfs: Option<PathBuf>,
148 /// Structure of the `config.toml` file that configuration is read from.
150 /// This structure uses `Decodable` to automatically decode a TOML configuration
151 /// file into this format, and then this is traversed and written into the above
152 /// `Config` structure.
153 #[derive(Deserialize, Default)]
154 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
156 build: Option<Build>,
157 install: Option<Install>,
160 target: Option<HashMap<String, TomlTarget>>,
164 /// TOML representation of various global build decisions.
165 #[derive(Deserialize, Default, Clone)]
166 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
168 build: Option<String>,
173 cargo: Option<String>,
174 rustc: Option<String>,
175 low_priority: Option<bool>,
176 compiler_docs: Option<bool>,
178 submodules: Option<bool>,
180 locked_deps: Option<bool>,
181 vendor: Option<bool>,
182 nodejs: Option<String>,
183 python: Option<String>,
184 full_bootstrap: Option<bool>,
185 extended: Option<bool>,
186 verbose: Option<usize>,
187 sanitizers: Option<bool>,
188 profiler: Option<bool>,
189 openssl_static: Option<bool>,
192 /// TOML representation of various global install decisions.
193 #[derive(Deserialize, Default, Clone)]
194 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
196 prefix: Option<String>,
197 sysconfdir: Option<String>,
198 docdir: Option<String>,
199 bindir: Option<String>,
200 libdir: Option<String>,
201 mandir: Option<String>,
204 /// TOML representation of how the LLVM build is configured.
205 #[derive(Deserialize, Default)]
206 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
208 enabled: Option<bool>,
209 ccache: Option<StringOrBool>,
211 assertions: Option<bool>,
212 optimize: Option<bool>,
213 release_debuginfo: Option<bool>,
214 version_check: Option<bool>,
215 static_libstdcpp: Option<bool>,
216 targets: Option<String>,
217 experimental_targets: Option<String>,
218 link_jobs: Option<u32>,
221 #[derive(Deserialize, Default, Clone)]
222 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
224 sign_folder: Option<String>,
225 gpg_password_file: Option<String>,
226 upload_addr: Option<String>,
227 src_tarball: Option<bool>,
230 #[derive(Deserialize)]
237 impl Default for StringOrBool {
238 fn default() -> StringOrBool {
239 StringOrBool::Bool(false)
243 /// TOML representation of how the Rust build is configured.
244 #[derive(Deserialize, Default)]
245 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
247 optimize: Option<bool>,
248 codegen_units: Option<u32>,
249 debug_assertions: Option<bool>,
250 debuginfo: Option<bool>,
251 debuginfo_lines: Option<bool>,
252 debuginfo_only_std: Option<bool>,
253 debug_jemalloc: Option<bool>,
254 use_jemalloc: Option<bool>,
255 backtrace: Option<bool>,
256 default_linker: Option<String>,
257 default_ar: Option<String>,
258 channel: Option<String>,
259 musl_root: Option<String>,
261 optimize_tests: Option<bool>,
262 debuginfo_tests: Option<bool>,
263 codegen_tests: Option<bool>,
264 ignore_git: Option<bool>,
267 /// TOML representation of how each build target is configured.
268 #[derive(Deserialize, Default)]
269 #[serde(deny_unknown_fields, rename_all = "kebab-case")]
271 llvm_config: Option<String>,
272 jemalloc: Option<String>,
275 android_ndk: Option<String>,
276 musl_root: Option<String>,
277 qemu_rootfs: Option<String>,
281 pub fn parse(args: &[String]) -> Config {
282 let flags = Flags::parse(&args);
283 let file = flags.config.clone();
284 let mut config = Config::default();
285 config.llvm_enabled = true;
286 config.llvm_optimize = true;
287 config.use_jemalloc = true;
288 config.backtrace = true;
289 config.rust_optimize = true;
290 config.rust_optimize_tests = true;
291 config.submodules = true;
293 config.rust_rpath = true;
294 config.rust_codegen_units = 1;
295 config.channel = "dev".to_string();
296 config.codegen_tests = true;
297 config.ignore_git = false;
298 config.rust_dist_src = true;
300 config.on_fail = flags.on_fail;
301 config.stage = flags.stage;
302 config.src = flags.src;
303 config.jobs = flags.jobs;
304 config.cmd = flags.cmd;
305 config.incremental = flags.incremental;
306 config.keep_stage = flags.keep_stage;
308 let toml = file.map(|file| {
309 let mut f = t!(File::open(&file));
310 let mut contents = String::new();
311 t!(f.read_to_string(&mut contents));
312 match toml::from_str(&contents) {
315 println!("failed to parse TOML configuration '{}': {}",
316 file.display(), err);
320 }).unwrap_or_else(|| TomlConfig::default());
322 let build = toml.build.clone().unwrap_or(Build::default());
323 set(&mut config.build, build.build.clone().map(|x| INTERNER.intern_string(x)));
324 set(&mut config.build, flags.build);
325 if config.build.is_empty() {
326 // set by bootstrap.py
327 config.build = INTERNER.intern_str(&env::var("BUILD").unwrap());
329 config.hosts.push(config.build.clone());
330 for host in build.host.iter() {
331 let host = INTERNER.intern_str(host);
332 if !config.hosts.contains(&host) {
333 config.hosts.push(host);
336 for target in config.hosts.iter().cloned()
337 .chain(build.target.iter().map(|s| INTERNER.intern_str(s)))
339 if !config.targets.contains(&target) {
340 config.targets.push(target);
343 config.hosts = if !flags.host.is_empty() {
348 config.targets = if !flags.target.is_empty() {
354 config.nodejs = build.nodejs.map(PathBuf::from);
355 config.gdb = build.gdb.map(PathBuf::from);
356 config.python = build.python.map(PathBuf::from);
357 set(&mut config.low_priority, build.low_priority);
358 set(&mut config.compiler_docs, build.compiler_docs);
359 set(&mut config.docs, build.docs);
360 set(&mut config.submodules, build.submodules);
361 set(&mut config.locked_deps, build.locked_deps);
362 set(&mut config.vendor, build.vendor);
363 set(&mut config.full_bootstrap, build.full_bootstrap);
364 set(&mut config.extended, build.extended);
365 set(&mut config.verbose, build.verbose);
366 set(&mut config.sanitizers, build.sanitizers);
367 set(&mut config.profiler, build.profiler);
368 set(&mut config.openssl_static, build.openssl_static);
369 config.verbose = cmp::max(config.verbose, flags.verbose);
371 if let Some(ref install) = toml.install {
372 config.prefix = install.prefix.clone().map(PathBuf::from);
373 config.sysconfdir = install.sysconfdir.clone().map(PathBuf::from);
374 config.docdir = install.docdir.clone().map(PathBuf::from);
375 config.bindir = install.bindir.clone().map(PathBuf::from);
376 config.libdir = install.libdir.clone().map(PathBuf::from);
377 config.mandir = install.mandir.clone().map(PathBuf::from);
380 if let Some(ref llvm) = toml.llvm {
382 Some(StringOrBool::String(ref s)) => {
383 config.ccache = Some(s.to_string())
385 Some(StringOrBool::Bool(true)) => {
386 config.ccache = Some("ccache".to_string());
388 Some(StringOrBool::Bool(false)) | None => {}
390 set(&mut config.ninja, llvm.ninja);
391 set(&mut config.llvm_enabled, llvm.enabled);
392 set(&mut config.llvm_assertions, llvm.assertions);
393 set(&mut config.llvm_optimize, llvm.optimize);
394 set(&mut config.llvm_release_debuginfo, llvm.release_debuginfo);
395 set(&mut config.llvm_version_check, llvm.version_check);
396 set(&mut config.llvm_static_stdcpp, llvm.static_libstdcpp);
397 config.llvm_targets = llvm.targets.clone();
398 config.llvm_experimental_targets = llvm.experimental_targets.clone();
399 config.llvm_link_jobs = llvm.link_jobs;
402 if let Some(ref rust) = toml.rust {
403 set(&mut config.rust_debug_assertions, rust.debug_assertions);
404 set(&mut config.rust_debuginfo, rust.debuginfo);
405 set(&mut config.rust_debuginfo_lines, rust.debuginfo_lines);
406 set(&mut config.rust_debuginfo_only_std, rust.debuginfo_only_std);
407 set(&mut config.rust_optimize, rust.optimize);
408 set(&mut config.rust_optimize_tests, rust.optimize_tests);
409 set(&mut config.rust_debuginfo_tests, rust.debuginfo_tests);
410 set(&mut config.codegen_tests, rust.codegen_tests);
411 set(&mut config.rust_rpath, rust.rpath);
412 set(&mut config.debug_jemalloc, rust.debug_jemalloc);
413 set(&mut config.use_jemalloc, rust.use_jemalloc);
414 set(&mut config.backtrace, rust.backtrace);
415 set(&mut config.channel, rust.channel.clone());
416 set(&mut config.ignore_git, rust.ignore_git);
417 config.rustc_default_linker = rust.default_linker.clone();
418 config.rustc_default_ar = rust.default_ar.clone();
419 config.musl_root = rust.musl_root.clone().map(PathBuf::from);
421 match rust.codegen_units {
422 Some(0) => config.rust_codegen_units = num_cpus::get() as u32,
423 Some(n) => config.rust_codegen_units = n,
428 if let Some(ref t) = toml.target {
429 for (triple, cfg) in t {
430 let mut target = Target::default();
432 if let Some(ref s) = cfg.llvm_config {
433 target.llvm_config = Some(env::current_dir().unwrap().join(s));
435 if let Some(ref s) = cfg.jemalloc {
436 target.jemalloc = Some(env::current_dir().unwrap().join(s));
438 if let Some(ref s) = cfg.android_ndk {
439 target.ndk = Some(env::current_dir().unwrap().join(s));
441 target.cxx = cfg.cxx.clone().map(PathBuf::from);
442 target.cc = cfg.cc.clone().map(PathBuf::from);
443 target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
444 target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
446 config.target_config.insert(INTERNER.intern_string(triple.clone()), target);
450 if let Some(ref t) = toml.dist {
451 config.dist_sign_folder = t.sign_folder.clone().map(PathBuf::from);
452 config.dist_gpg_password_file = t.gpg_password_file.clone().map(PathBuf::from);
453 config.dist_upload_addr = t.upload_addr.clone();
454 set(&mut config.rust_dist_src, t.src_tarball);
457 let cwd = t!(env::current_dir());
458 let out = cwd.join("build");
460 let stage0_root = out.join(&config.build).join("stage0/bin");
461 config.initial_rustc = match build.rustc {
462 Some(s) => PathBuf::from(s),
463 None => stage0_root.join(exe("rustc", &config.build)),
465 config.initial_cargo = match build.cargo {
466 Some(s) => PathBuf::from(s),
467 None => stage0_root.join(exe("cargo", &config.build)),
470 // compat with `./configure` while we're still using that
471 if fs::metadata("config.mk").is_ok() {
472 config.update_with_config_mk();
478 /// "Temporary" routine to parse `config.mk` into this configuration.
480 /// While we still have `./configure` this implements the ability to decode
481 /// that configuration into this. This isn't exactly a full-blown makefile
482 /// parser, but hey it gets the job done!
483 fn update_with_config_mk(&mut self) {
484 let mut config = String::new();
485 File::open("config.mk").unwrap().read_to_string(&mut config).unwrap();
486 for line in config.lines() {
487 let mut parts = line.splitn(2, ":=").map(|s| s.trim());
488 let key = parts.next().unwrap();
489 let value = match parts.next() {
490 Some(n) if n.starts_with('\"') => &n[1..n.len() - 1],
496 ($(($name:expr, $val:expr),)*) => {
499 if key == concat!("CFG_ENABLE_", $name) {
503 if key == concat!("CFG_DISABLE_", $name) {
513 ("MANAGE_SUBMODULES", self.submodules),
514 ("COMPILER_DOCS", self.compiler_docs),
516 ("LLVM_ASSERTIONS", self.llvm_assertions),
517 ("LLVM_RELEASE_DEBUGINFO", self.llvm_release_debuginfo),
518 ("OPTIMIZE_LLVM", self.llvm_optimize),
519 ("LLVM_VERSION_CHECK", self.llvm_version_check),
520 ("LLVM_STATIC_STDCPP", self.llvm_static_stdcpp),
521 ("LLVM_LINK_SHARED", self.llvm_link_shared),
522 ("OPTIMIZE", self.rust_optimize),
523 ("DEBUG_ASSERTIONS", self.rust_debug_assertions),
524 ("DEBUGINFO", self.rust_debuginfo),
525 ("DEBUGINFO_LINES", self.rust_debuginfo_lines),
526 ("DEBUGINFO_ONLY_STD", self.rust_debuginfo_only_std),
527 ("JEMALLOC", self.use_jemalloc),
528 ("DEBUG_JEMALLOC", self.debug_jemalloc),
529 ("RPATH", self.rust_rpath),
530 ("OPTIMIZE_TESTS", self.rust_optimize_tests),
531 ("DEBUGINFO_TESTS", self.rust_debuginfo_tests),
532 ("QUIET_TESTS", self.quiet_tests),
533 ("LOCAL_REBUILD", self.local_rebuild),
534 ("NINJA", self.ninja),
535 ("CODEGEN_TESTS", self.codegen_tests),
536 ("LOCKED_DEPS", self.locked_deps),
537 ("VENDOR", self.vendor),
538 ("FULL_BOOTSTRAP", self.full_bootstrap),
539 ("EXTENDED", self.extended),
540 ("SANITIZERS", self.sanitizers),
541 ("PROFILER", self.profiler),
542 ("DIST_SRC", self.rust_dist_src),
543 ("CARGO_OPENSSL_STATIC", self.openssl_static),
547 "CFG_BUILD" if value.len() > 0 => self.build = INTERNER.intern_str(value),
548 "CFG_HOST" if value.len() > 0 => {
549 self.hosts.extend(value.split(" ").map(|s| INTERNER.intern_str(s)));
552 "CFG_TARGET" if value.len() > 0 => {
553 self.targets.extend(value.split(" ").map(|s| INTERNER.intern_str(s)));
555 "CFG_EXPERIMENTAL_TARGETS" if value.len() > 0 => {
556 self.llvm_experimental_targets = Some(value.to_string());
558 "CFG_MUSL_ROOT" if value.len() > 0 => {
559 self.musl_root = Some(parse_configure_path(value));
561 "CFG_MUSL_ROOT_X86_64" if value.len() > 0 => {
562 let target = INTERNER.intern_str("x86_64-unknown-linux-musl");
563 let target = self.target_config.entry(target).or_insert(Target::default());
564 target.musl_root = Some(parse_configure_path(value));
566 "CFG_MUSL_ROOT_I686" if value.len() > 0 => {
567 let target = INTERNER.intern_str("i686-unknown-linux-musl");
568 let target = self.target_config.entry(target).or_insert(Target::default());
569 target.musl_root = Some(parse_configure_path(value));
571 "CFG_MUSL_ROOT_ARM" if value.len() > 0 => {
572 let target = INTERNER.intern_str("arm-unknown-linux-musleabi");
573 let target = self.target_config.entry(target).or_insert(Target::default());
574 target.musl_root = Some(parse_configure_path(value));
576 "CFG_MUSL_ROOT_ARMHF" if value.len() > 0 => {
577 let target = INTERNER.intern_str("arm-unknown-linux-musleabihf");
578 let target = self.target_config.entry(target).or_insert(Target::default());
579 target.musl_root = Some(parse_configure_path(value));
581 "CFG_MUSL_ROOT_ARMV7" if value.len() > 0 => {
582 let target = INTERNER.intern_str("armv7-unknown-linux-musleabihf");
583 let target = self.target_config.entry(target).or_insert(Target::default());
584 target.musl_root = Some(parse_configure_path(value));
586 "CFG_DEFAULT_AR" if value.len() > 0 => {
587 self.rustc_default_ar = Some(value.to_string());
589 "CFG_DEFAULT_LINKER" if value.len() > 0 => {
590 self.rustc_default_linker = Some(value.to_string());
592 "CFG_GDB" if value.len() > 0 => {
593 self.gdb = Some(parse_configure_path(value));
595 "CFG_RELEASE_CHANNEL" => {
596 self.channel = value.to_string();
599 self.prefix = Some(PathBuf::from(value));
601 "CFG_SYSCONFDIR" => {
602 self.sysconfdir = Some(PathBuf::from(value));
605 self.docdir = Some(PathBuf::from(value));
608 self.bindir = Some(PathBuf::from(value));
611 self.libdir = Some(PathBuf::from(value));
613 "CFG_LIBDIR_RELATIVE" => {
614 self.libdir_relative = Some(PathBuf::from(value));
617 self.mandir = Some(PathBuf::from(value));
619 "CFG_LLVM_ROOT" if value.len() > 0 => {
620 let target = self.target_config.entry(self.build.clone())
621 .or_insert(Target::default());
622 let root = parse_configure_path(value);
623 target.llvm_config = Some(push_exe_path(root, &["bin", "llvm-config"]));
625 "CFG_JEMALLOC_ROOT" if value.len() > 0 => {
626 let target = self.target_config.entry(self.build.clone())
627 .or_insert(Target::default());
628 target.jemalloc = Some(parse_configure_path(value).join("libjemalloc_pic.a"));
630 "CFG_ARM_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
631 let target = INTERNER.intern_str("arm-linux-androideabi");
632 let target = self.target_config.entry(target).or_insert(Target::default());
633 target.ndk = Some(parse_configure_path(value));
635 "CFG_ARMV7_LINUX_ANDROIDEABI_NDK" if value.len() > 0 => {
636 let target = INTERNER.intern_str("armv7-linux-androideabi");
637 let target = self.target_config.entry(target).or_insert(Target::default());
638 target.ndk = Some(parse_configure_path(value));
640 "CFG_I686_LINUX_ANDROID_NDK" if value.len() > 0 => {
641 let target = INTERNER.intern_str("i686-linux-android");
642 let target = self.target_config.entry(target).or_insert(Target::default());
643 target.ndk = Some(parse_configure_path(value));
645 "CFG_AARCH64_LINUX_ANDROID_NDK" if value.len() > 0 => {
646 let target = INTERNER.intern_str("aarch64-linux-android");
647 let target = self.target_config.entry(target).or_insert(Target::default());
648 target.ndk = Some(parse_configure_path(value));
650 "CFG_X86_64_LINUX_ANDROID_NDK" if value.len() > 0 => {
651 let target = INTERNER.intern_str("x86_64-linux-android");
652 let target = self.target_config.entry(target).or_insert(Target::default());
653 target.ndk = Some(parse_configure_path(value));
655 "CFG_LOCAL_RUST_ROOT" if value.len() > 0 => {
656 let path = parse_configure_path(value);
657 self.initial_rustc = push_exe_path(path.clone(), &["bin", "rustc"]);
658 self.initial_cargo = push_exe_path(path, &["bin", "cargo"]);
660 "CFG_PYTHON" if value.len() > 0 => {
661 let path = parse_configure_path(value);
662 self.python = Some(path);
664 "CFG_ENABLE_CCACHE" if value == "1" => {
665 self.ccache = Some(exe("ccache", &self.build));
667 "CFG_ENABLE_SCCACHE" if value == "1" => {
668 self.ccache = Some(exe("sccache", &self.build));
670 "CFG_CONFIGURE_ARGS" if value.len() > 0 => {
671 self.configure_args = value.split_whitespace()
672 .map(|s| s.to_string())
675 "CFG_QEMU_ARMHF_ROOTFS" if value.len() > 0 => {
676 let target = INTERNER.intern_str("arm-unknown-linux-gnueabihf");
677 let target = self.target_config.entry(target).or_insert(Target::default());
678 target.qemu_rootfs = Some(parse_configure_path(value));
680 "CFG_QEMU_AARCH64_ROOTFS" if value.len() > 0 => {
681 let target = INTERNER.intern_str("aarch64-unknown-linux-gnu");
682 let target = self.target_config.entry(target).or_insert(Target::default());
683 target.qemu_rootfs = Some(parse_configure_path(value));
690 pub fn verbose(&self) -> bool {
694 pub fn very_verbose(&self) -> bool {
700 fn parse_configure_path(path: &str) -> PathBuf {
705 fn parse_configure_path(path: &str) -> PathBuf {
706 // on windows, configure produces unix style paths e.g. /c/some/path but we
707 // only want real windows paths
709 use std::process::Command;
712 // '/' is invalid in windows paths, so we can detect unix paths by the presence of it
713 if !path.contains('/') {
717 let win_path = build_helper::output(Command::new("cygpath").arg("-w").arg(path));
718 let win_path = win_path.trim();
723 fn set<T>(field: &mut T, val: Option<T>) {
724 if let Some(v) = val {