Bug 1522614 - Pass CC/CXX/CFLAGS/CXXFLAGS/AR down to cargo on Windows. r=froydnj

Now that Make invokes cargo without going through an msys shell,
environment variables are going to be preserved properly, and we can now
"safely" pass the compiler-related variables down to cargo on Windows.

This makes rust target builds use the expected compiler and flags,
instead of the cc-rs crate guessing, picking cl.exe, and using the wrong
one, with the build later failing when linking it all together because
one of the objects is not for the right target.

Interestingly, the lmdb code is today built for the wrong target on
aarch64, but somehow, it doesn't break the build on automation,
presumably because the lmdb code is actually dead code, and the linker
eliminates the object as unused, masking the problem.

Depends on D18186

Differential Revision: https://phabricator.services.mozilla.com/D18187

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-02-05 21:43:28 +00:00
Родитель 5cfa7d1570
Коммит 30cc95d370
1 изменённых файлов: 0 добавлений и 7 удалений

Просмотреть файл

@ -92,18 +92,11 @@ ifndef FUZZING_INTERFACES
# https://github.com/alexcrichton/cc-rs/blob/baa71c0e298d9ad7ac30f0ad78f20b4b3b3a8fb2/src/lib.rs#L1715
rust_cc_env_name := $(subst -,_,$(RUST_TARGET))
ifeq (WINNT,$(HOST_OS_ARCH))
# Don't do most of this on Windows because msys path translation makes a mess of the paths, and
# we put MSVC in PATH there anyway. But we do suppress warnings, since all such warnings
# are in third-party code.
export CFLAGS_$(rust_cc_env_name)=-w
else
export CC_$(rust_cc_env_name)=$(CC)
export CXX_$(rust_cc_env_name)=$(CXX)
export CFLAGS_$(rust_cc_env_name)=$(COMPUTED_CFLAGS)
export CXXFLAGS_$(rust_cc_env_name)=$(COMPUTED_CXXFLAGS)
export AR_$(rust_cc_env_name)=$(AR)
endif # WINNT
endif # FUZZING_INTERFACES
endif # MOZ_CODE_COVERAGE
endif # MOZ_UBSAN