Bug 1524396 - Replace RUST_TARGET_ENV_NAME with make substitutions. r=chmanchester

While the substitution pattern is kind of awful in make, it will allow
to more straightforwardly deal with the difference between target and
host.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Hommey 2019-03-21 23:40:23 +00:00
Родитель 632127ba32
Коммит 27044ed480
2 изменённых файлов: 3 добавлений и 11 удалений

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

@ -272,16 +272,6 @@ set_config('RUST_TARGET', rust_target_triple)
set_config('RUST_HOST_TARGET', rust_host_triple)
@depends(rust_target_triple)
def rust_target_env_name(triple):
return triple.upper().replace('-', '_')
# We need this to form various Cargo environment variables, as there is no
# uppercase function in make, and we don't want to shell out just for
# converting a string to uppercase.
set_config('RUST_TARGET_ENV_NAME', rust_target_env_name)
# This is used for putting source info into symbol files.
set_config('RUSTC_COMMIT', depends(rustc_info)(lambda i: i.commit))

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

@ -137,6 +137,8 @@ HOST_RECIPES := \
$(HOST_RECIPES): RUSTFLAGS:=$(rustflags_override)
cargo_env = $(subst -,_,$(subst a,A,$(subst b,B,$(subst c,C,$(subst d,D,$(subst e,E,$(subst f,F,$(subst g,G,$(subst h,H,$(subst i,I,$(subst j,J,$(subst k,K,$(subst l,L,$(subst m,M,$(subst n,N,$(subst o,O,$(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,$(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,$(subst z,Z,$1)))))))))))))))))))))))))))
# We use the + prefix to pass down the jobserver fds to cargo, but we
# don't use the prefix when make -n is used, so that cargo doesn't run
# in that case)
@ -159,7 +161,7 @@ define CARGO_CHECK
$(call RUN_CARGO,check)
endef
cargo_linker_env_var := CARGO_TARGET_$(RUST_TARGET_ENV_NAME)_LINKER
cargo_linker_env_var := CARGO_TARGET_$(call cargo_env,$(RUST_TARGET))_LINKER
# Don't define a custom linker on Windows, as it's difficult to have a
# non-binary file that will get executed correctly by Cargo. We don't