Bug 1355464 - Only clean out the environment variables that are affected by 32- vs 64-bit builds. r?ted draft
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 11 Apr 2017 13:35:40 -0400
changeset 560623 a78058360f63f028c4e233d1a7bd9e373e8eb0f6
parent 560546 abf145ebd05fe105efbc78b761858c34f7690154
child 623758 a5c2e6aabb2659f931888ebcac1bd2b42f802568
push id53482
push userkgupta@mozilla.com
push dateTue, 11 Apr 2017 17:35:53 +0000
reviewersted
bugs1355464
milestone55.0a1
Bug 1355464 - Only clean out the environment variables that are affected by 32- vs 64-bit builds. r?ted Instead of using the -i flag to clean out the entire set of environment variables, we explicitly just clear out the variables that are affected by 32- vs 64-bit builds in vcvars.bat. This still allows cargo to use it's internal autodetection to do host/target builds as it wants when cross-compiling, but also allows other things that rely on include directories and so on to work properly. MozReview-Commit-ID: 99SECKv1zQa
config/rules.mk
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -944,19 +944,22 @@ rustflags_override = RUSTFLAGS='$(rustfl
 endif
 
 ifdef MOZ_MSVCBITS
 # If we are building a MozillaBuild shell, we want to clear out the
 # vcvars.bat environment variables for cargo builds. This is because
 # a 32-bit MozillaBuild shell on a 64-bit machine will try to use
 # the 32-bit compiler/linker for everything, while cargo/rustc wants
 # to use the 64-bit linker for build.rs scripts. This conflict results
-# in a build failure (see bug 1350001). Clearing out *just* the changes
-# from vcvars.bat is hard, so we just clear out the whole environment.
-environment_cleaner = -i
+# in a build failure (see bug 1350001). So we clear out the environment
+# variables that are actually relevant to 32- vs 64-bit builds.
+environment_cleaner = PATH='' LIB='' LIBPATH=''
+# The servo build needs to know where python is, and we're removing the PATH
+# so we tell it explicitly via the PYTHON env var.
+environment_cleaner += PYTHON='$(shell which $(PYTHON))'
 else
 environment_cleaner =
 endif
 
 CARGO_BUILD = env $(environment_cleaner) $(rustflags_override) \
 	CARGO_TARGET_DIR=$(CARGO_TARGET_DIR) \
 	RUSTC=$(RUSTC) \
 	MOZ_DIST=$(ABS_DIST) \