mirror of
https://github.com/openwrt/packages.git
synced 2026-04-15 19:02:09 +00:00
rust: introduce RUST_{HOST,PKG}_LOCKED flag
Introduce `RUST_{HOST,PKG}_LOCKED` flag (enabled by default) to respect
upstream lockfile. This can be disabled by setting it to 0 if you want
to have up-to-date dependencies.
This change also adds new `CARGO_{HOST,PKG}_ARGS` variable to pass extra
build arguments to cargo.
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
committed by
Tianling Shen
parent
0a512e8f0e
commit
1000e99185
@@ -9,17 +9,33 @@
|
||||
# Space or comma separated list of features to activate
|
||||
#
|
||||
# e.g. RUST_HOST_FEATURES:=enable-foo,with-bar
|
||||
#
|
||||
#
|
||||
# RUST_HOST_LOCKED - Assert that `Cargo.lock` will remain unchanged
|
||||
# (Enabled by default)
|
||||
#
|
||||
# Disable it if you want to have up-to-date dependencies
|
||||
#
|
||||
# e.g. RUST_HOST_LOCKED:=0
|
||||
|
||||
ifeq ($(origin RUST_INCLUDE_DIR),undefined)
|
||||
RUST_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
|
||||
endif
|
||||
include $(RUST_INCLUDE_DIR)/rust-values.mk
|
||||
|
||||
RUST_HOST_LOCKED ?= 1
|
||||
|
||||
CARGO_HOST_VARS= \
|
||||
$(CARGO_HOST_CONFIG_VARS) \
|
||||
CC=$(HOSTCC_NOCACHE) \
|
||||
MAKEFLAGS="$(HOST_JOBS)"
|
||||
|
||||
CARGO_HOST_ARGS=
|
||||
|
||||
ifeq ($(strip $(RUST_HOST_LOCKED)),1)
|
||||
CARGO_HOST_ARGS+= --locked
|
||||
endif
|
||||
|
||||
# $(1) path to the package (optional)
|
||||
# $(2) additional arguments to cargo (optional)
|
||||
define Host/Compile/Cargo
|
||||
@@ -30,6 +46,7 @@ define Host/Compile/Cargo
|
||||
--root $(HOST_INSTALL_DIR) \
|
||||
--path "$(HOST_BUILD_DIR)/$(if $(strip $(1)),$(strip $(1)))" \
|
||||
$(if $(filter --jobserver%,$(HOST_JOBS)),,-j1) \
|
||||
$(CARGO_HOST_ARGS) \
|
||||
$(2)
|
||||
endef
|
||||
|
||||
|
||||
@@ -9,17 +9,34 @@
|
||||
# Space or comma separated list of features to activate
|
||||
#
|
||||
# e.g. RUST_PKG_FEATURES:=enable-foo,with-bar
|
||||
#
|
||||
#
|
||||
# RUST_PKG_LOCKED - Assert that `Cargo.lock` will remain unchanged
|
||||
# (Enabled by default)
|
||||
#
|
||||
# Disable it if you want to have up-to-date dependencies
|
||||
#
|
||||
# e.g. RUST_PKG_LOCKED:=0
|
||||
|
||||
|
||||
ifeq ($(origin RUST_INCLUDE_DIR),undefined)
|
||||
RUST_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
|
||||
endif
|
||||
include $(RUST_INCLUDE_DIR)/rust-values.mk
|
||||
|
||||
RUST_PKG_LOCKED ?= 1
|
||||
|
||||
CARGO_PKG_VARS= \
|
||||
$(CARGO_PKG_CONFIG_VARS) \
|
||||
CC=$(HOSTCC_NOCACHE) \
|
||||
MAKEFLAGS="$(PKG_JOBS)"
|
||||
|
||||
CARGO_PKG_ARGS=
|
||||
|
||||
ifeq ($(strip $(RUST_PKG_LOCKED)),1)
|
||||
CARGO_PKG_ARGS+= --locked
|
||||
endif
|
||||
|
||||
# $(1) path to the package (optional)
|
||||
# $(2) additional arguments to cargo (optional)
|
||||
define Build/Compile/Cargo
|
||||
@@ -30,6 +47,7 @@ define Build/Compile/Cargo
|
||||
--root $(PKG_INSTALL_DIR) \
|
||||
--path "$(PKG_BUILD_DIR)/$(if $(strip $(1)),$(strip $(1)))" \
|
||||
$(if $(filter --jobserver%,$(PKG_JOBS)),,-j1) \
|
||||
$(CARGO_PKG_ARGS) \
|
||||
$(2)
|
||||
endef
|
||||
|
||||
|
||||
Reference in New Issue
Block a user