package/pkg-cargo.mk: split PKG_CARGO_ENV into target/host variables

Some variables should only be passed for target packages, such as the
target-applies-to-host variable. Additional target-specific variables
will also be added.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Thomas Petazzoni 2022-01-09 10:47:56 +01:00
parent e5ead094e1
commit 0894937f7f

View File

@ -20,15 +20,21 @@
#
################################################################################
PKG_COMMON_CARGO_ENV = \
CARGO_HOME=$(HOST_DIR)/share/cargo
# __CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS is needed to allow
# passing the -Z target-applies-to-host, which is needed together with
# CARGO_TARGET_APPLIES_TO_HOST to fix build problems when target
# architecture == host architecture.
PKG_CARGO_ENV = \
CARGO_HOME=$(HOST_DIR)/share/cargo \
$(PKG_COMMON_CARGO_ENV) \
__CARGO_TEST_CHANNEL_OVERRIDE_DO_NOT_USE_THIS="nightly" \
CARGO_TARGET_APPLIES_TO_HOST="false"
HOST_PKG_CARGO_ENV = \
$(PKG_COMMON_CARGO_ENV)
################################################################################
# inner-cargo-package -- defines how the configuration, compilation and
# installation of a cargo package should be done, implements a few hooks
@ -97,7 +103,7 @@ define $(2)_BUILD_CMDS
$$(HOST_MAKE_ENV) \
RUSTFLAGS="$$(addprefix -C link-args=,$$(HOST_LDFLAGS))" \
$$(HOST_CONFIGURE_OPTS) \
$$(PKG_CARGO_ENV) \
$$(HOST_PKG_CARGO_ENV) \
$$($(2)_CARGO_ENV) \
cargo build \
--offline \
@ -139,7 +145,7 @@ define $(2)_INSTALL_CMDS
$$(HOST_MAKE_ENV) \
RUSTFLAGS="$$(addprefix -C link-args=,$$(HOST_LDFLAGS))" \
$$(HOST_CONFIGURE_OPTS) \
$$(PKG_CARGO_ENV) \
$$(HOST_PKG_CARGO_ENV) \
$$($(2)_CARGO_ENV) \
cargo install \
--offline \