diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py index 40db368bfe8..feca17976d0 100644 --- a/python/servo/build_commands.py +++ b/python/servo/build_commands.py @@ -204,12 +204,7 @@ class MachCommands(CommandBase): opts += ["--features", "%s" % ' '.join(features)] build_start = time() - env = self.build_env() - - # Ensure Rust uses hard floats and SIMD on ARM devices - if target: - if target.startswith('arm') or target.startswith('aarch64'): - env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C target-feature=+neon" + env = self.build_env(target=target) if android: # Build OpenSSL for android @@ -225,7 +220,7 @@ class MachCommands(CommandBase): with cd(openssl_dir): status = call( make_cmd + ["-f", "openssl.makefile"], - env=self.build_env(), + env=env, verbose=verbose) if status: return status @@ -234,11 +229,6 @@ class MachCommands(CommandBase): env['OPENSSL_INCLUDE_DIR'] = path.join(openssl_dir, "include") env['OPENSSL_STATIC'] = 'TRUE' - if not (self.config["build"]["ccache"] == ""): - env['CCACHE'] = self.config["build"]["ccache"] - - env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -W unused-extern-crates" - status = call( ["cargo", "build"] + opts, env=env, cwd=self.servo_crate(), verbose=verbose) diff --git a/python/servo/command_base.py b/python/servo/command_base.py index 0b51bf93dc6..792130bd46b 100644 --- a/python/servo/command_base.py +++ b/python/servo/command_base.py @@ -255,7 +255,7 @@ class CommandBase(object): " --release" if release else "")) sys.exit() - def build_env(self, gonk=False, hosts_file_path=None): + def build_env(self, gonk=False, hosts_file_path=None, target=None): """Return an extended environment dictionary.""" env = os.environ.copy() if sys.platform == "win32" and type(env['PATH']) == unicode: @@ -399,6 +399,16 @@ class CommandBase(object): if subprocess.call(['which', 'ld.gold'], stdout=PIPE, stderr=PIPE) == 0: env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C link-args=-fuse-ld=gold" + if not (self.config["build"]["ccache"] == ""): + env['CCACHE'] = self.config["build"]["ccache"] + + # Ensure Rust uses hard floats and SIMD on ARM devices + if target: + if target.startswith('arm') or target.startswith('aarch64'): + env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -C target-feature=+neon" + + env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " -W unused-extern-crates" + return env def servo_crate(self):