servo: Merge #14251 - Support build.rustflags in .servobuild (from vvuk:servobuild-rustflags); r=ConnorGBrewster
authorVladimir Vukicevic <vladimir@pobox.com>
Tue, 13 Dec 2016 16:55:12 -0800
changeset 340328 92646471f722ff59c5664c03324f17a40c6fc6b1
parent 340327 d08ba3ef73749a1e7362f9826522585f13c071f9
child 340329 e07acb058a3141b0470a51bf9f6dff1a962747b0
push id31307
push usergszorc@mozilla.com
push dateSat, 04 Feb 2017 00:59:06 +0000
treeherdermozilla-central@94079d43835f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersConnorGBrewster
bugs14251
servo: Merge #14251 - Support build.rustflags in .servobuild (from vvuk:servobuild-rustflags); r=ConnorGBrewster Add ability to specify rustflags in .servobuild. Source-Repo: https://github.com/servo/servo Source-Revision: 75c869d508231a216413808d80d6e02dec3ced6c
servo/python/servo/command_base.py
servo/servobuild.example
--- a/servo/python/servo/command_base.py
+++ b/servo/python/servo/command_base.py
@@ -292,16 +292,17 @@ class CommandBase(object):
                 context.sharedir, "cargo", self.cargo_build_id())
         self.config["tools"].setdefault("rustc-with-gold", get_env_bool("SERVO_RUSTC_WITH_GOLD", True))
 
         self.config.setdefault("build", {})
         self.config["build"].setdefault("android", False)
         self.config["build"].setdefault("mode", "")
         self.config["build"].setdefault("debug-mozjs", False)
         self.config["build"].setdefault("ccache", "")
+        self.config["build"].setdefault("rustflags", "")
 
         self.config.setdefault("android", {})
         self.config["android"].setdefault("sdk", "")
         self.config["android"].setdefault("ndk", "")
         self.config["android"].setdefault("toolchain", "")
         self.config["android"].setdefault("platform", "android-18")
         self.config["android"].setdefault("target", "arm-linux-androideabi")
 
@@ -481,16 +482,19 @@ class CommandBase(object):
         if "ANDROID_TOOLCHAIN" in env:
             env["NDK_STANDALONE"] = env["ANDROID_TOOLCHAIN"]
 
         if hosts_file_path:
             env['HOST_FILE'] = hosts_file_path
 
         env['RUSTDOC'] = path.join(self.context.topdir, 'etc', 'rustdoc-with-private')
 
+        if self.config["build"]["rustflags"]:
+            env['RUSTFLAGS'] = env.get('RUSTFLAGS', "") + " " + self.config["build"]["rustflags"]
+
         # Don't run the gold linker if on Windows https://github.com/servo/servo/issues/9499
         if self.config["tools"]["rustc-with-gold"] and sys.platform not in ("win32", "msys"):
             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"]
 
--- a/servo/servobuild.example
+++ b/servo/servobuild.example
@@ -33,16 +33,18 @@ rustc-with-gold = true
 # Defaults to prompting before building
 #mode = "dev"
 # Set "android = true" or use `mach build --android` to build the Android app.
 android = false
 # Set "debug-mozjs" or use `mach build --debug-mozjs` to build a debug spidermonkey.
 debug-mozjs = false
 # Set to the path to your ccache binary to enable caching of compiler outputs
 #ccache = "/usr/local/bin/ccache"
+# Any optional flags that will be added to $RUSTFLAGS
+#rustflags = ""
 
 # Android information
 [android]
 # Defaults to the value of $ANDROID_SDK, $ANDROID_NDK, $ANDROID_TOOLCHAIN, $ANDROID_PLATFORM respectively
 #sdk = "/opt/android-sdk"
 #ndk = "/opt/android-ndk"
 #toolchain = "/opt/android-toolchain"
 #platform = "android-18"