Module dinghy_build::build_env
source · Expand description
Target-aware environment manipulations.
cc-rs and pkg-config-rs use a similar convention where some environment variables (like CC, CFLAGS or PKG_CONFIG_PATH) can be tagged with the current rustc target to distinguish a native build environment and one or several cross-compilation ones.
For instance, while compiling for Android arm, cc-rs
looks first at
CC_arm-linux-androideabi, then CC_arm_linux_androideabi, the TARGET_CC
and finally CC.
This crates implements some of the same logic and also helps generating
these variables names. It also notify all environment lookup “back” to
cargo using cargo:rerun-if-env-changed
markup.
Functions§
- Append a value to a PATH-like (
:
-separated) environment variable. - Append a value to a PATH-like (
:
-separated) environment variable taking target scoping rules into consideration. - Build-context aware environment variable access.
- Capitalize and replace
-
by_
. - Set a bunch of environment variables.
- Set one environment variable.
- Set one environment variable if not set yet.
- Set one environment variable with target-scoping rules.
- Access a required TARGET_SYSROOT variable, suggesting to define it or use Dinghy.
- Access
var_base
directly, or use targetting rules depending on the build being native or cross. - Access
var_base
directly, using targetting rules.