[][src]Module dinghy_build::build_env

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_path_to_env

Append a value to a PATH-like (:-separated) environment variable.

append_path_to_target_env

Append a value to a PATH-like (:-separated) environment variable taking target scoping rules into consideration.

build_env

Build-context aware environment variable access.

envify

Capitalize and replace - by _.

set_all_env

Set a bunch of environment variables.

set_env

Set one environment variable.

set_env_ifndef

Set one environment variable if not set yet.

set_target_env

Set one environment variable with target-scoping rules.

sysroot_path

Access a required TARGET_SYSROOT variable, suggesting to define it or use Dinghy.

target_env

Access var_base directly, or use targetting rules depending on the build being native or cross.

target_env_from_triple

Access var_base directly, using targetting rules.