diff --git a/build/moz.configure/rust.configure b/build/moz.configure/rust.configure index d23d9b59a77b..e6ede4b274ad 100644 --- a/build/moz.configure/rust.configure +++ b/build/moz.configure/rust.configure @@ -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)) diff --git a/config/makefiles/rust.mk b/config/makefiles/rust.mk index f2d3dddf6c03..0c95d81995d1 100644 --- a/config/makefiles/rust.mk +++ b/config/makefiles/rust.mk @@ -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