Gentoo Archives: gentoo-commits

From: Thomas Deutschmann <whissi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: www-client/firefox/files/, www-client/firefox/
Date: Thu, 04 Oct 2018 13:50:40
Message-Id: 1538660139.87ee38a17afd372982e6411cc9c22bbf3229ed0c.whissi@gentoo
1 commit: 87ee38a17afd372982e6411cc9c22bbf3229ed0c
2 Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
3 AuthorDate: Thu Oct 4 13:35:23 2018 +0000
4 Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
5 CommitDate: Thu Oct 4 13:35:39 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=87ee38a1
7
8 www-client/firefox: make rust cc honor CC env variable
9
10 Bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1496270
11 Package-Manager: Portage-2.3.50, Repoman-2.3.11
12 Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
13
14 .../files/firefox-60.0-update-cc-to-honor-CC.patch | 745 +++++++++++++++++++++
15 www-client/firefox/firefox-60.2.2.ebuild | 1 +
16 2 files changed, 746 insertions(+)
17
18 diff --git a/www-client/firefox/files/firefox-60.0-update-cc-to-honor-CC.patch b/www-client/firefox/files/firefox-60.0-update-cc-to-honor-CC.patch
19 new file mode 100644
20 index 00000000000..9bca3f57a0a
21 --- /dev/null
22 +++ b/www-client/firefox/files/firefox-60.0-update-cc-to-honor-CC.patch
23 @@ -0,0 +1,745 @@
24 +https://bugzilla.mozilla.org/show_bug.cgi?id=1496270
25 +https://bugzilla.mozilla.org/show_bug.cgi?id=1445528
26 +
27 +--- a/third_party/rust/cc/.cargo-checksum.json
28 ++++ b/third_party/rust/cc/.cargo-checksum.json
29 +@@ -1 +1 @@
30 +-{"files":{".travis.yml":"1a4a3f7f90349924378e93acbb524b9127e37c02cfbc6dc59fd904bbdc1c8d0b","Cargo.toml":"623dd06a83bcbf2f292ab51af93e9b79b689e3be06a62968b79f4e36f1bb769f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"186c5c8a62520cb7a3d90d77161c954b52ae8456fca0e0669bc3a5b889592a43","appveyor.yml":"ab45bfdcf2596f357225a54e730c34d518a8f3ad56c2ed33af682cfd45bddc02","src/bin/gcc-shim.rs":"d6be9137cb48b86891e7b263adbf492e1193ffe682db9ba4a88eb1079b874b58","src/com.rs":"0cb06f5db0fb70d27db0e5917ca337de6e7032119e6aabfea1bad9c719f5f34b","src/lib.rs":"996b650e19d5ccd6e64e741789427017c913644e980862a7286ec4ed53c14a17","src/registry.rs":"3876ef9573e3bbc050aef41a684b9a510cc1a91b15ae874fe032cf4377b4d116","src/setup_config.rs":"1a3eeb11c6847c31f2a4685b62ab35c76f0b6d5a17f7ed99e9df164283a771f7","src/winapi.rs":"cb5e6cab3eb570b0f97c660ca448ccfb5024262c0c7b245c181daad91a7
31 9f211","src/windows_registry.rs":"6de548aa94215e449f0e58e9a3b1702939d7c2f7b63a9040901c948bf138201d","tests/cc_env.rs":"7402315eea7ffa23b29b393c1de8e236294ede9de562ff0a562704a157135341","tests/support/mod.rs":"092551f9f6e3a999fa0aa02f93314aac0bda2b09268f948c423df56a43575e0b","tests/test.rs":"b1164258714e13173f3861126e97bedf1e29aa24618993c4eb0edd57c431dcc7"},"package":"deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0"}
32 +\ No newline at end of file
33 ++{"files":{".travis.yml":"1a4a3f7f90349924378e93acbb524b9127e37c02cfbc6dc59fd904bbdc1c8d0b","Cargo.toml":"623dd06a83bcbf2f292ab51af93e9b79b689e3be06a62968b79f4e36f1bb769f","LICENSE-APACHE":"a60eea817514531668d7e00765731449fe14d059d3249e0bc93b36de45f759f2","LICENSE-MIT":"378f5840b258e2779c39418f3f2d7b2ba96f1c7917dd6be0713f88305dbda397","README.md":"186c5c8a62520cb7a3d90d77161c954b52ae8456fca0e0669bc3a5b889592a43","appveyor.yml":"ab45bfdcf2596f357225a54e730c34d518a8f3ad56c2ed33af682cfd45bddc02","src/bin/gcc-shim.rs":"d6be9137cb48b86891e7b263adbf492e1193ffe682db9ba4a88eb1079b874b58","src/com.rs":"0cb06f5db0fb70d27db0e5917ca337de6e7032119e6aabfea1bad9c719f5f34b","src/lib.rs":"6e8cea99f5fc8e5982b1ea9a336ee2f9a6158a9498c8f0c36f1e8cee8c99716e","src/registry.rs":"3876ef9573e3bbc050aef41a684b9a510cc1a91b15ae874fe032cf4377b4d116","src/setup_config.rs":"1a3eeb11c6847c31f2a4685b62ab35c76f0b6d5a17f7ed99e9df164283a771f7","src/winapi.rs":"cb5e6cab3eb570b0f97c660ca448ccfb5024262c0c7b245c181daad91a7
34 9f211","src/windows_registry.rs":"6de548aa94215e449f0e58e9a3b1702939d7c2f7b63a9040901c948bf138201d","tests/cc_env.rs":"7402315eea7ffa23b29b393c1de8e236294ede9de562ff0a562704a157135341","tests/support/mod.rs":"092551f9f6e3a999fa0aa02f93314aac0bda2b09268f948c423df56a43575e0b","tests/test.rs":"b1164258714e13173f3861126e97bedf1e29aa24618993c4eb0edd57c431dcc7"},"package":"deaf9ec656256bb25b404c51ef50097207b9cbb29c933d31f92cae5a8a0ffee0"}
35 +\ No newline at end of file
36 +--- a/third_party/rust/cc/src/lib.rs
37 ++++ b/third_party/rust/cc/src/lib.rs
38 +@@ -61,15 +61,14 @@
39 + extern crate rayon;
40 +
41 + use std::env;
42 +-use std::ffi::{OsString, OsStr};
43 ++use std::ffi::{OsStr, OsString};
44 + use std::fs;
45 +-use std::path::{PathBuf, Path};
46 +-use std::process::{Command, Stdio, Child};
47 +-use std::io::{self, BufReader, BufRead, Read, Write};
48 ++use std::path::{Path, PathBuf};
49 ++use std::process::{Child, Command, Stdio};
50 ++use std::io::{self, BufRead, BufReader, Read, Write};
51 + use std::thread::{self, JoinHandle};
52 +-
53 +-#[cfg(feature = "parallel")]
54 +-use std::sync::Mutex;
55 ++use std::collections::HashMap;
56 ++use std::sync::{Arc, Mutex};
57 +
58 + // These modules are all glue to support reading the MSVC version from
59 + // the registry and from COM interfaces
60 +@@ -97,6 +96,7 @@ pub struct Build {
61 + objects: Vec<PathBuf>,
62 + flags: Vec<String>,
63 + flags_supported: Vec<String>,
64 ++ known_flag_support_status: Arc<Mutex<HashMap<String, bool>>>,
65 + files: Vec<PathBuf>,
66 + cpp: bool,
67 + cpp_link_stdlib: Option<Option<String>>,
68 +@@ -241,8 +241,7 @@ impl ToolFamily {
69 + fn nvcc_debug_flag(&self) -> &'static str {
70 + match *self {
71 + ToolFamily::Msvc => unimplemented!(),
72 +- ToolFamily::Gnu |
73 +- ToolFamily::Clang => "-G",
74 ++ ToolFamily::Gnu | ToolFamily::Clang => "-G",
75 + }
76 + }
77 +
78 +@@ -251,8 +250,7 @@ impl ToolFamily {
79 + fn nvcc_redirect_flag(&self) -> &'static str {
80 + match *self {
81 + ToolFamily::Msvc => unimplemented!(),
82 +- ToolFamily::Gnu |
83 +- ToolFamily::Clang => "-Xcompiler",
84 ++ ToolFamily::Gnu | ToolFamily::Clang => "-Xcompiler",
85 + }
86 + }
87 + }
88 +@@ -269,10 +267,7 @@ struct Object {
89 + impl Object {
90 + /// Create a new source file -> object file pair.
91 + fn new(src: PathBuf, dst: PathBuf) -> Object {
92 +- Object {
93 +- src: src,
94 +- dst: dst,
95 +- }
96 ++ Object { src: src, dst: dst }
97 + }
98 + }
99 +
100 +@@ -289,6 +284,7 @@ impl Build {
101 + objects: Vec::new(),
102 + flags: Vec::new(),
103 + flags_supported: Vec::new(),
104 ++ known_flag_support_status: Arc::new(Mutex::new(HashMap::new())),
105 + files: Vec::new(),
106 + shared_flag: None,
107 + static_flag: None,
108 +@@ -344,10 +340,8 @@ impl Build {
109 + /// .compile("foo");
110 + /// ```
111 + pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, var: &str, val: V) -> &mut Build {
112 +- self.definitions.push((
113 +- var.to_string(),
114 +- val.into().map(|s| s.to_string()),
115 +- ));
116 ++ self.definitions
117 ++ .push((var.to_string(), val.into().map(|s| s.to_string())));
118 + self
119 + }
120 +
121 +@@ -398,7 +392,16 @@ impl Build {
122 + ///
123 + /// It may return error if it's unable to run the compilier with a test file
124 + /// (e.g. the compiler is missing or a write to the `out_dir` failed).
125 ++ ///
126 ++ /// Note: Once computed, the result of this call is stored in the
127 ++ /// `known_flag_support` field. If `is_flag_supported(flag)`
128 ++ /// is called again, the result will be read from the hash table.
129 + pub fn is_flag_supported(&self, flag: &str) -> Result<bool, Error> {
130 ++ let mut known_status = self.known_flag_support_status.lock().unwrap();
131 ++ if let Some(is_supported) = known_status.get(flag).cloned() {
132 ++ return Ok(is_supported);
133 ++ }
134 ++
135 + let out_dir = self.get_out_dir()?;
136 + let src = self.ensure_check_file()?;
137 + let obj = out_dir.join("flag_check");
138 +@@ -413,7 +416,8 @@ impl Build {
139 + .cuda(self.cuda);
140 + let compiler = cfg.try_get_compiler()?;
141 + let mut cmd = compiler.to_command();
142 +- command_add_output_file(&mut cmd, &obj, target.contains("msvc"), false);
143 ++ let is_arm = target.contains("aarch64") || target.contains("arm");
144 ++ command_add_output_file(&mut cmd, &obj, target.contains("msvc"), false, is_arm);
145 +
146 + // We need to explicitly tell msvc not to link and create an exe
147 + // in the root directory of the crate
148 +@@ -424,7 +428,10 @@ impl Build {
149 + cmd.arg(&src);
150 +
151 + let output = cmd.output()?;
152 +- Ok(output.stderr.is_empty())
153 ++ let is_supported = output.stderr.is_empty();
154 ++
155 ++ known_status.insert(flag.to_owned(), is_supported);
156 ++ Ok(is_supported)
157 + }
158 +
159 + /// Add an arbitrary flag to the invocation of the compiler if it supports it
160 +@@ -777,9 +784,8 @@ impl Build {
161 + A: AsRef<OsStr>,
162 + B: AsRef<OsStr>,
163 + {
164 +- self.env.push(
165 +- (a.as_ref().to_owned(), b.as_ref().to_owned()),
166 +- );
167 ++ self.env
168 ++ .push((a.as_ref().to_owned(), b.as_ref().to_owned()));
169 + self
170 + }
171 +
172 +@@ -880,31 +886,19 @@ impl Build {
173 + fn compile_objects(&self, objs: &[Object]) -> Result<(), Error> {
174 + use self::rayon::prelude::*;
175 +
176 +- let mut cfg = rayon::Configuration::new();
177 + if let Ok(amt) = env::var("NUM_JOBS") {
178 + if let Ok(amt) = amt.parse() {
179 +- cfg = cfg.num_threads(amt);
180 ++ let _ = rayon::ThreadPoolBuilder::new()
181 ++ .num_threads(amt)
182 ++ .build_global();
183 + }
184 + }
185 +- drop(rayon::initialize(cfg));
186 +-
187 +- let results: Mutex<Vec<Result<(), Error>>> = Mutex::new(Vec::new());
188 +-
189 +- objs.par_iter().with_max_len(1).for_each(
190 +- |obj| {
191 +- let res = self.compile_object(obj);
192 +- results.lock().unwrap().push(res)
193 +- },
194 +- );
195 +
196 + // Check for any errors and return the first one found.
197 +- for result in results.into_inner().unwrap().iter() {
198 +- if result.is_err() {
199 +- return result.clone();
200 +- }
201 +- }
202 +-
203 +- Ok(())
204 ++ objs.par_iter()
205 ++ .with_max_len(1)
206 ++ .map(|obj| self.compile_object(obj))
207 ++ .collect()
208 + }
209 +
210 + #[cfg(not(feature = "parallel"))]
211 +@@ -917,7 +911,8 @@ impl Build {
212 +
213 + fn compile_object(&self, obj: &Object) -> Result<(), Error> {
214 + let is_asm = obj.src.extension().and_then(|s| s.to_str()) == Some("asm");
215 +- let msvc = self.get_target()?.contains("msvc");
216 ++ let target = self.get_target()?;
217 ++ let msvc = target.contains("msvc");
218 + let (mut cmd, name) = if msvc && is_asm {
219 + self.msvc_macro_assembler()?
220 + } else {
221 +@@ -931,15 +926,17 @@ impl Build {
222 + compiler
223 + .path
224 + .file_name()
225 +- .ok_or_else(|| {
226 +- Error::new(ErrorKind::IOError, "Failed to get compiler path.")
227 +- })?
228 ++ .ok_or_else(|| Error::new(ErrorKind::IOError, "Failed to get compiler path."))?
229 + .to_string_lossy()
230 + .into_owned(),
231 + )
232 + };
233 +- command_add_output_file(&mut cmd, &obj.dst, msvc, is_asm);
234 +- cmd.arg(if msvc { "/c" } else { "-c" });
235 ++ let is_arm = target.contains("aarch64") || target.contains("arm");
236 ++ command_add_output_file(&mut cmd, &obj.dst, msvc, is_asm, is_arm);
237 ++ // armasm and armasm64 don't requrie -c option
238 ++ if !msvc || !is_asm || !is_arm {
239 ++ cmd.arg(if msvc { "/c" } else { "-c" });
240 ++ }
241 + cmd.arg(&obj.src);
242 +
243 + run(&mut cmd, &name)?;
244 +@@ -967,9 +964,7 @@ impl Build {
245 + let name = compiler
246 + .path
247 + .file_name()
248 +- .ok_or_else(|| {
249 +- Error::new(ErrorKind::IOError, "Failed to get compiler path.")
250 +- })?
251 ++ .ok_or_else(|| Error::new(ErrorKind::IOError, "Failed to get compiler path."))?
252 + .to_string_lossy()
253 + .into_owned();
254 +
255 +@@ -1054,8 +1049,8 @@ impl Build {
256 + cmd.args.push(crt_flag.into());
257 +
258 + match &opt_level[..] {
259 +- "z" | "s" => cmd.args.push("/Os".into()),
260 +- "1" => cmd.args.push("/O1".into()),
261 ++ // Msvc uses /O1 to enable all optimizations that minimize code size.
262 ++ "z" | "s" | "1" => cmd.args.push("/O1".into()),
263 + // -O3 is a valid value for gcc and clang compilers, but not msvc. Cap to /O2.
264 + "2" | "3" => cmd.args.push("/O2".into()),
265 + _ => {}
266 +@@ -1070,8 +1065,10 @@ impl Build {
267 + cmd.args.push(format!("-O{}", opt_level).into());
268 + }
269 +
270 +- cmd.push_cc_arg("-ffunction-sections".into());
271 +- cmd.push_cc_arg("-fdata-sections".into());
272 ++ if !target.contains("-ios") {
273 ++ cmd.push_cc_arg("-ffunction-sections".into());
274 ++ cmd.push_cc_arg("-fdata-sections".into());
275 ++ }
276 + if self.pic.unwrap_or(!target.contains("windows-gnu")) {
277 + cmd.push_cc_arg("-fPIC".into());
278 + }
279 +@@ -1169,7 +1166,7 @@ impl Build {
280 + // linker that we're generating 32-bit executables as well. This'll
281 + // typically only be used for build scripts which transitively use
282 + // these flags that try to compile executables.
283 +- if target == "i686-unknown-linux-musl" {
284 ++ if target == "i686-unknown-linux-musl" || target == "i586-unknown-linux-musl" {
285 + cmd.args.push("-Wl,-melf_i386".into());
286 + }
287 +
288 +@@ -1212,14 +1209,13 @@ impl Build {
289 + if self.cpp {
290 + match (self.cpp_set_stdlib.as_ref(), cmd.family) {
291 + (None, _) => {}
292 +- (Some(stdlib), ToolFamily::Gnu) |
293 +- (Some(stdlib), ToolFamily::Clang) => {
294 ++ (Some(stdlib), ToolFamily::Gnu) | (Some(stdlib), ToolFamily::Clang) => {
295 + cmd.push_cc_arg(format!("-stdlib=lib{}", stdlib).into());
296 + }
297 + _ => {
298 + println!(
299 + "cargo:warning=cpp_set_stdlib is specified, but the {:?} compiler \
300 +- does not support this option, ignored",
301 ++ does not support this option, ignored",
302 + cmd.family
303 + );
304 + }
305 +@@ -1272,6 +1268,10 @@ impl Build {
306 + let target = self.get_target()?;
307 + let tool = if target.contains("x86_64") {
308 + "ml64.exe"
309 ++ } else if target.contains("arm") {
310 ++ "armasm.exe"
311 ++ } else if target.contains("aarch64") {
312 ++ "armasm64.exe"
313 + } else {
314 + "ml.exe"
315 + };
316 +@@ -1307,20 +1307,55 @@ impl Build {
317 + if target.contains("msvc") {
318 + let mut cmd = match self.archiver {
319 + Some(ref s) => self.cmd(s),
320 +- None => {
321 +- windows_registry::find(&target, "lib.exe").unwrap_or_else(
322 +- || {
323 +- self.cmd("lib.exe")
324 +- },
325 +- )
326 +- }
327 ++ None => windows_registry::find(&target, "lib.exe")
328 ++ .unwrap_or_else(|| self.cmd("lib.exe")),
329 + };
330 ++
331 + let mut out = OsString::from("/OUT:");
332 + out.push(dst);
333 +- run(
334 +- cmd.arg(out).arg("/nologo").args(&objects).args(&self.objects),
335 +- "lib.exe",
336 +- )?;
337 ++ cmd.arg(out).arg("/nologo");
338 ++
339 ++ // Similar to https://github.com/rust-lang/rust/pull/47507
340 ++ // and https://github.com/rust-lang/rust/pull/48548
341 ++ let estimated_command_line_len = objects
342 ++ .iter()
343 ++ .chain(&self.objects)
344 ++ .map(|a| a.as_os_str().len())
345 ++ .sum::<usize>();
346 ++ if estimated_command_line_len > 1024 * 6 {
347 ++ let mut args = String::from("\u{FEFF}"); // BOM
348 ++ for arg in objects.iter().chain(&self.objects) {
349 ++ args.push('"');
350 ++ for c in arg.to_str().unwrap().chars() {
351 ++ if c == '"' {
352 ++ args.push('\\')
353 ++ }
354 ++ args.push(c)
355 ++ }
356 ++ args.push('"');
357 ++ args.push('\n');
358 ++ }
359 ++
360 ++ let mut utf16le = Vec::new();
361 ++ for code_unit in args.encode_utf16() {
362 ++ utf16le.push(code_unit as u8);
363 ++ utf16le.push((code_unit >> 8) as u8);
364 ++ }
365 ++
366 ++ let mut args_file = OsString::from(dst);
367 ++ args_file.push(".args");
368 ++ fs::File::create(&args_file)
369 ++ .unwrap()
370 ++ .write_all(&utf16le)
371 ++ .unwrap();
372 ++
373 ++ let mut args_file_arg = OsString::from("@");
374 ++ args_file_arg.push(args_file);
375 ++ cmd.arg(args_file_arg);
376 ++ } else {
377 ++ cmd.args(&objects).args(&self.objects);
378 ++ }
379 ++ run(&mut cmd, "lib.exe")?;
380 +
381 + // The Rust compiler will look for libfoo.a and foo.lib, but the
382 + // MSVC linker will also be passed foo.lib, so be sure that both
383 +@@ -1412,6 +1447,18 @@ impl Build {
384 +
385 + cmd.args.push("-isysroot".into());
386 + cmd.args.push(sdk_path.trim().into());
387 ++ cmd.args.push("-fembed-bitcode".into());
388 ++ /*
389 ++ * TODO we probably ultimatedly want the -fembed-bitcode-marker flag
390 ++ * but can't have it now because of an issue in LLVM:
391 ++ * https://github.com/alexcrichton/cc-rs/issues/301
392 ++ * https://github.com/rust-lang/rust/pull/48896#comment-372192660
393 ++ */
394 ++ /*
395 ++ if self.get_opt_level()? == "0" {
396 ++ cmd.args.push("-fembed-bitcode-marker".into());
397 ++ }
398 ++ */
399 +
400 + Ok(())
401 + }
402 +@@ -1437,37 +1484,44 @@ impl Build {
403 + };
404 +
405 + // On Solaris, c++/cc unlikely to exist or be correct.
406 +- let default = if host.contains("solaris") { gnu } else { traditional };
407 +-
408 +- let tool_opt: Option<Tool> =
409 +- self.env_tool(env)
410 +- .map(|(tool, cc, args)| {
411 +- let mut t = Tool::new(PathBuf::from(tool));
412 +- if let Some(cc) = cc {
413 +- t.cc_wrapper_path = Some(PathBuf::from(cc));
414 +- }
415 +- for arg in args {
416 +- t.cc_wrapper_args.push(arg.into());
417 +- }
418 +- t
419 +- })
420 +- .or_else(|| {
421 +- if target.contains("emscripten") {
422 +- let tool = if self.cpp { "em++" } else { "emcc" };
423 +- // Windows uses bat file so we have to be a bit more specific
424 +- if cfg!(windows) {
425 +- let mut t = Tool::new(PathBuf::from("cmd"));
426 +- t.args.push("/c".into());
427 +- t.args.push(format!("{}.bat", tool).into());
428 +- Some(t)
429 +- } else {
430 +- Some(Tool::new(PathBuf::from(tool)))
431 +- }
432 ++ let default = if host.contains("solaris") {
433 ++ gnu
434 ++ } else {
435 ++ traditional
436 ++ };
437 ++
438 ++ let tool_opt: Option<Tool> = self.env_tool(env)
439 ++ .map(|(tool, cc, args)| {
440 ++ // chop off leading/trailing whitespace to work around
441 ++ // semi-buggy build scripts which are shared in
442 ++ // makefiles/configure scripts (where spaces are far more
443 ++ // lenient)
444 ++ let mut t = Tool::new(PathBuf::from(tool.trim()));
445 ++ if let Some(cc) = cc {
446 ++ t.cc_wrapper_path = Some(PathBuf::from(cc));
447 ++ }
448 ++ for arg in args {
449 ++ t.cc_wrapper_args.push(arg.into());
450 ++ }
451 ++ t
452 ++ })
453 ++ .or_else(|| {
454 ++ if target.contains("emscripten") {
455 ++ let tool = if self.cpp { "em++" } else { "emcc" };
456 ++ // Windows uses bat file so we have to be a bit more specific
457 ++ if cfg!(windows) {
458 ++ let mut t = Tool::new(PathBuf::from("cmd"));
459 ++ t.args.push("/c".into());
460 ++ t.args.push(format!("{}.bat", tool).into());
461 ++ Some(t)
462 + } else {
463 +- None
464 ++ Some(Tool::new(PathBuf::from(tool)))
465 + }
466 +- })
467 +- .or_else(|| windows_registry::find_tool(&target, "cl.exe"));
468 ++ } else {
469 ++ None
470 ++ }
471 ++ })
472 ++ .or_else(|| windows_registry::find_tool(&target, "cl.exe"));
473 +
474 + let tool = match tool_opt {
475 + Some(t) => t,
476 +@@ -1501,6 +1555,7 @@ impl Build {
477 + "armv7-unknown-linux-gnueabihf" => Some("arm-linux-gnueabihf"),
478 + "armv7-unknown-linux-musleabihf" => Some("arm-linux-musleabihf"),
479 + "armv7-unknown-netbsd-eabihf" => Some("armv7--netbsdelf-eabihf"),
480 ++ "i586-unknown-linux-musl" => Some("musl"),
481 + "i686-pc-windows-gnu" => Some("i686-w64-mingw32"),
482 + "i686-unknown-linux-musl" => Some("musl"),
483 + "i686-unknown-netbsd" => Some("i486--netbsdelf"),
484 +@@ -1509,10 +1564,12 @@ impl Build {
485 + "mips64-unknown-linux-gnuabi64" => Some("mips64-linux-gnuabi64"),
486 + "mips64el-unknown-linux-gnuabi64" => Some("mips64el-linux-gnuabi64"),
487 + "powerpc-unknown-linux-gnu" => Some("powerpc-linux-gnu"),
488 ++ "powerpc-unknown-linux-gnuspe" => Some("powerpc-linux-gnuspe"),
489 + "powerpc-unknown-netbsd" => Some("powerpc--netbsd"),
490 + "powerpc64-unknown-linux-gnu" => Some("powerpc-linux-gnu"),
491 + "powerpc64le-unknown-linux-gnu" => Some("powerpc64le-linux-gnu"),
492 + "s390x-unknown-linux-gnu" => Some("s390x-linux-gnu"),
493 ++ "sparc-unknown-linux-gnu" => Some("sparc-linux-gnu"),
494 + "sparc64-unknown-linux-gnu" => Some("sparc64-linux-gnu"),
495 + "sparc64-unknown-netbsd" => Some("sparc64--netbsd"),
496 + "sparcv9-sun-solaris" => Some("sparcv9-sun-solaris"),
497 +@@ -1538,14 +1595,18 @@ impl Build {
498 + };
499 +
500 + let tool = if self.cuda {
501 +- assert!(tool.args.is_empty(),
502 +- "CUDA compilation currently assumes empty pre-existing args");
503 ++ assert!(
504 ++ tool.args.is_empty(),
505 ++ "CUDA compilation currently assumes empty pre-existing args"
506 ++ );
507 + let nvcc = match self.get_var("NVCC") {
508 + Err(_) => "nvcc".into(),
509 + Ok(nvcc) => nvcc,
510 + };
511 + let mut nvcc_tool = Tool::with_features(PathBuf::from(nvcc), self.cuda);
512 +- nvcc_tool.args.push(format!("-ccbin={}", tool.path.display()).into());
513 ++ nvcc_tool
514 ++ .args
515 ++ .push(format!("-ccbin={}", tool.path.display()).into());
516 + nvcc_tool
517 + } else {
518 + tool
519 +@@ -1568,10 +1629,7 @@ impl Build {
520 + Some(res) => Ok(res),
521 + None => Err(Error::new(
522 + ErrorKind::EnvVarNotFound,
523 +- &format!(
524 +- "Could not find environment variable {}.",
525 +- var_base
526 +- ),
527 ++ &format!("Could not find environment variable {}.", var_base),
528 + )),
529 + }
530 + }
531 +@@ -1585,21 +1643,68 @@ impl Build {
532 + .collect()
533 + }
534 +
535 +-
536 + /// Returns compiler path, optional modifier name from whitelist, and arguments vec
537 + fn env_tool(&self, name: &str) -> Option<(String, Option<String>, Vec<String>)> {
538 +- self.get_var(name).ok().map(|tool| {
539 +- let whitelist = ["ccache", "distcc", "sccache"];
540 ++ let tool = match self.get_var(name) {
541 ++ Ok(tool) => tool,
542 ++ Err(_) => return None,
543 ++ };
544 +
545 +- for t in whitelist.iter() {
546 +- if tool.starts_with(t) && tool[t.len()..].starts_with(' ') {
547 +- let args = tool.split_whitespace().collect::<Vec<_>>();
548 ++ // If this is an exact path on the filesystem we don't want to do any
549 ++ // interpretation at all, just pass it on through. This'll hopefully get
550 ++ // us to support spaces-in-paths.
551 ++ if Path::new(&tool).exists() {
552 ++ return Some((tool, None, Vec::new()));
553 ++ }
554 ++
555 ++ // Ok now we want to handle a couple of scenarios. We'll assume from
556 ++ // here on out that spaces are splitting separate arguments. Two major
557 ++ // features we want to support are:
558 ++ //
559 ++ // CC='sccache cc'
560 ++ //
561 ++ // aka using `sccache` or any other wrapper/caching-like-thing for
562 ++ // compilations. We want to know what the actual compiler is still,
563 ++ // though, because our `Tool` API support introspection of it to see
564 ++ // what compiler is in use.
565 ++ //
566 ++ // additionally we want to support
567 ++ //
568 ++ // CC='cc -flag'
569 ++ //
570 ++ // where the CC env var is used to also pass default flags to the C
571 ++ // compiler.
572 ++ //
573 ++ // It's true that everything here is a bit of a pain, but apparently if
574 ++ // you're not literally make or bash then you get a lot of bug reports.
575 ++ let known_wrappers = ["ccache", "distcc", "sccache", "icecc"];
576 ++
577 ++ let mut parts = tool.split_whitespace();
578 ++ let maybe_wrapper = match parts.next() {
579 ++ Some(s) => s,
580 ++ None => return None,
581 ++ };
582 +
583 +- return (args[1].to_string(), Some(t.to_string()), args[2..].iter().map(|s| s.to_string()).collect());
584 +- }
585 ++ let file_stem = Path::new(maybe_wrapper)
586 ++ .file_stem()
587 ++ .unwrap()
588 ++ .to_str()
589 ++ .unwrap();
590 ++ if known_wrappers.contains(&file_stem) {
591 ++ if let Some(compiler) = parts.next() {
592 ++ return Some((
593 ++ compiler.to_string(),
594 ++ Some(maybe_wrapper.to_string()),
595 ++ parts.map(|s| s.to_string()).collect(),
596 ++ ));
597 + }
598 +- (tool, None, Vec::new())
599 +- })
600 ++ }
601 ++
602 ++ Some((
603 ++ maybe_wrapper.to_string(),
604 ++ None,
605 ++ parts.map(|s| s.to_string()).collect(),
606 ++ ))
607 + }
608 +
609 + /// Returns the default C++ standard library for the current target: `libc++`
610 +@@ -1611,7 +1716,7 @@ impl Build {
611 + let target = self.get_target()?;
612 + if target.contains("msvc") {
613 + Ok(None)
614 +- } else if target.contains("darwin") {
615 ++ } else if target.contains("apple") {
616 + Ok(Some("c++".to_string()))
617 + } else if target.contains("freebsd") {
618 + Ok(Some("c++".to_string()))
619 +@@ -1700,10 +1805,7 @@ impl Build {
620 + Some(s) => Ok(s),
621 + None => Err(Error::new(
622 + ErrorKind::EnvVarNotFound,
623 +- &format!(
624 +- "Environment variable {} not defined.",
625 +- v.to_string()
626 +- ),
627 ++ &format!("Environment variable {} not defined.", v.to_string()),
628 + )),
629 + }
630 + }
631 +@@ -1731,8 +1833,9 @@ impl Tool {
632 + let family = if let Some(fname) = path.file_name().and_then(|p| p.to_str()) {
633 + if fname.contains("clang") {
634 + ToolFamily::Clang
635 +- } else if fname.contains("cl") && !fname.contains("cloudabi") &&
636 +- !fname.contains("uclibc") {
637 ++ } else if fname.contains("cl") && !fname.contains("cloudabi")
638 ++ && !fname.contains("uclibc")
639 ++ {
640 + ToolFamily::Msvc
641 + } else {
642 + ToolFamily::Gnu
643 +@@ -1775,8 +1878,8 @@ impl Tool {
644 + cmd.arg(&self.path);
645 + cmd.args(&self.cc_wrapper_args);
646 + cmd
647 +- },
648 +- None => Command::new(&self.path)
649 ++ }
650 ++ None => Command::new(&self.path),
651 + };
652 + cmd.args(&self.args);
653 + for &(ref k, ref v) in self.env.iter() {
654 +@@ -1822,10 +1925,8 @@ impl Tool {
655 + cc_env.push(arg);
656 + }
657 + cc_env
658 +- },
659 +- None => {
660 +- OsString::from("")
661 + }
662 ++ None => OsString::from(""),
663 + }
664 + }
665 +
666 +@@ -1868,8 +1969,7 @@ fn run(cmd: &mut Command, program: &str) -> Result<(), Error> {
667 + ErrorKind::ToolExecError,
668 + &format!(
669 + "Failed to wait on spawned child process, command {:?} with args {:?}.",
670 +- cmd,
671 +- program
672 ++ cmd, program
673 + ),
674 + ))
675 + }
676 +@@ -1884,9 +1984,7 @@ fn run(cmd: &mut Command, program: &str) -> Result<(), Error> {
677 + ErrorKind::ToolExecError,
678 + &format!(
679 + "Command {:?} with args {:?} did not execute successfully (status code {}).",
680 +- cmd,
681 +- program,
682 +- status
683 ++ cmd, program, status
684 + ),
685 + ))
686 + }
687 +@@ -1909,8 +2007,7 @@ fn run_output(cmd: &mut Command, program: &str) -> Result<Vec<u8>, Error> {
688 + ErrorKind::ToolExecError,
689 + &format!(
690 + "Failed to wait on spawned child process, command {:?} with args {:?}.",
691 +- cmd,
692 +- program
693 ++ cmd, program
694 + ),
695 + ))
696 + }
697 +@@ -1925,9 +2022,7 @@ fn run_output(cmd: &mut Command, program: &str) -> Result<Vec<u8>, Error> {
698 + ErrorKind::ToolExecError,
699 + &format!(
700 + "Command {:?} with args {:?} did not execute successfully (status code {}).",
701 +- cmd,
702 +- program,
703 +- status
704 ++ cmd, program, status
705 + ),
706 + ))
707 + }
708 +@@ -1943,39 +2038,30 @@ fn spawn(cmd: &mut Command, program: &str) -> Result<(Child, JoinHandle<()>), Er
709 + match cmd.stderr(Stdio::piped()).spawn() {
710 + Ok(mut child) => {
711 + let stderr = BufReader::new(child.stderr.take().unwrap());
712 +- let print = thread::spawn(move || for line in stderr.split(b'\n').filter_map(
713 +- |l| l.ok(),
714 +- )
715 +- {
716 +- print!("cargo:warning=");
717 +- std::io::stdout().write_all(&line).unwrap();
718 +- println!("");
719 ++ let print = thread::spawn(move || {
720 ++ for line in stderr.split(b'\n').filter_map(|l| l.ok()) {
721 ++ print!("cargo:warning=");
722 ++ std::io::stdout().write_all(&line).unwrap();
723 ++ println!("");
724 ++ }
725 + });
726 + Ok((child, print))
727 + }
728 + Err(ref e) if e.kind() == io::ErrorKind::NotFound => {
729 + let extra = if cfg!(windows) {
730 + " (see https://github.com/alexcrichton/cc-rs#compile-time-requirements \
731 +- for help)"
732 ++ for help)"
733 + } else {
734 + ""
735 + };
736 + Err(Error::new(
737 + ErrorKind::ToolNotFound,
738 +- &format!(
739 +- "Failed to find tool. Is `{}` installed?{}",
740 +- program,
741 +- extra
742 +- ),
743 ++ &format!("Failed to find tool. Is `{}` installed?{}", program, extra),
744 + ))
745 + }
746 + Err(_) => Err(Error::new(
747 + ErrorKind::ToolExecError,
748 +- &format!(
749 +- "Command {:?} with args {:?} failed to start.",
750 +- cmd,
751 +- program
752 +- ),
753 ++ &format!("Command {:?} with args {:?} failed to start.", cmd, program),
754 + )),
755 + }
756 + }
757 +@@ -1984,9 +2070,10 @@ fn fail(s: &str) -> ! {
758 + panic!("\n\nInternal error occurred: {}\n\n", s)
759 + }
760 +
761 +-
762 +-fn command_add_output_file(cmd: &mut Command, dst: &Path, msvc: bool, is_asm: bool) {
763 +- if msvc && is_asm {
764 ++fn command_add_output_file(cmd: &mut Command, dst: &Path, msvc: bool, is_asm: bool, is_arm: bool) {
765 ++ if msvc && is_asm && is_arm {
766 ++ cmd.arg("-o").arg(&dst);
767 ++ } else if msvc && is_asm {
768 + cmd.arg("/Fo").arg(dst);
769 + } else if msvc {
770 + let mut s = OsString::from("/Fo");
771
772 diff --git a/www-client/firefox/firefox-60.2.2.ebuild b/www-client/firefox/firefox-60.2.2.ebuild
773 index 1923dd9db2b..5e93109b74c 100644
774 --- a/www-client/firefox/firefox-60.2.2.ebuild
775 +++ b/www-client/firefox/firefox-60.2.2.ebuild
776 @@ -130,6 +130,7 @@ src_prepare() {
777 eapply "${FILESDIR}"/bug_1461221.patch
778 eapply "${FILESDIR}"/${PN}-60.0-blessings-TERM.patch # 654316
779 eapply "${FILESDIR}"/${PN}-60.0-missing-errno_h-in-SandboxOpenedFiles_cpp.patch
780 + eapply "${FILESDIR}"/${PN}-60.0-update-cc-to-honor-CC.patch
781
782 # Enable gnomebreakpad
783 if use debug ; then