Expand description
Inputs to the build script, in the form of environment variables.
Functions
Path to the cargo
binary performing the build.
For each configuration option of the package being built, this will
contain the value of the configuration. Boolean configurations are present
if they are set, and not present otherwise. This includes values built-in
to the compiler (which can be seen with rustc --print=cfg
) and values set
by build scripts and extra flags passed to rustc
(such as those defined
in RUSTFLAGS
).
The CPU pointer width.
List of CPU target features enabled.
Extra flags that Cargo invokes rustc with. See build.rustflags
. Note
that since Rust 1.55, RUSTFLAGS
is removed from the environment; scripts
should use CARGO_ENCODED_RUSTFLAGS
instead.
For each activated feature of the package being built, this will be true.
Contains parameters needed for Cargo’s jobserver implementation to parallelize subprocesses. Rustc or cargo invocations from build.rs can already read CARGO_MAKEFLAGS, but GNU Make requires the flags to be specified either directly as arguments, or through the MAKEFLAGS environment variable. Currently Cargo doesn’t set the MAKEFLAGS variable, but it’s free for build scripts invoking GNU Make to set it to the contents of CARGO_MAKEFLAGS.
The directory containing the manifest for the package being built (the package containing the build script). Also note that this is the value of the current working directory of the build script when it starts.
The manifest links value.
List of authors from the manifest of your package.
The description from the manifest of your package.
The home page from the manifest of your package.
The license from the manifest of your package.
The license file from the manifest of your package.
The name of your package.
The repository from the manifest of your package.
The full version of your package.
The major version of your package.
The minor version of your package.
The patch version of your package.
The pre-release of your package.
Value of the corresponding variable for the profile currently being built.
Each build script can generate an arbitrary set of metadata in the form of
key-value pairs. This metadata is passed to the build scripts of
dependent packages. For example, if the package bar
depends on foo
,
then if foo
generates key=value
as part of its build script metadata,
then the build script of bar
will have the environment variables
DEP_FOO_KEY=value
.
The host triple of the Rust compiler.
The parallelism specified as the top-level parallelism. This can be
useful to pass a -j
parameter to a system like make
. Note that care
should be taken when interpreting this environment variable. For
historical purposes this is still provided but recent versions of
Cargo, for example, do not need to run make -j
, and instead can set
the MAKEFLAGS
env var to the content of CARGO_MAKEFLAGS
to activate
the use of Cargo’s GNU Make compatible jobserver for sub-make
invocations.
Value of the corresponding variable for the profile currently being built.
The folder in which all output should be placed. This folder is inside the build directory for the package being built, and it is unique for the package in question.
release
for release builds, debug
for other builds. This is
determined based on if the profile inherits from the dev
or
release
profile. Using this environment variable is not
recommended. Using other environment variables like OPT_LEVEL
provide a more correct view of the actual settings being used.
The compiler that Cargo has resolved to use, passed to the build script so it might use it as well.
The path to the linker binary that Cargo has resolved to use for the current target, if specified.
The rustc
wrapper, if any, that Cargo is using for workspace members.
See build.rustc-workspace-wrapper
.
The rustc
wrapper, if any, that Cargo is using. See
build.rustc-wrapper
.
The documentation generator that Cargo has resolved to use, passed to the build script so it might use it as well.
The target triple that is being compiled for. Native code should be compiled for this triple. See the Target Triple description for more information.