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
--- 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) \