1 # SPDX-License-Identifier: GPL-2.0-only
3 # Copyright (C) 2023 Luca Barbato and Donald Hoskins
5 # Variables (all optional) to be set in package Makefiles:
7 # RUST_PKG_FEATURES - list of options, default empty
9 # Space or comma separated list of features to activate
11 # e.g. RUST_PKG_FEATURES:=enable-foo,with-bar
13 ifeq ($(origin RUST_INCLUDE_DIR
),undefined
)
14 RUST_INCLUDE_DIR
:=$(dir $(lastword
$(MAKEFILE_LIST
)))
16 include $(RUST_INCLUDE_DIR
)/rust-values.mk
19 $(CARGO_PKG_CONFIG_VARS
) \
20 CC
=$(HOSTCC_NOCACHE
) \
21 MAKEFLAGS
="$(PKG_JOBS)"
23 # $(1) path to the package (optional)
24 # $(2) additional arguments to cargo (optional)
25 define Build
/Compile
/Cargo
28 --profile
$(CARGO_PKG_PROFILE
) \
29 $(if
$(strip $(RUST_PKG_FEATURES
)),--features
"$(strip $(RUST_PKG_FEATURES))") \
30 --root
$(PKG_INSTALL_DIR
) \
31 --path
"$(PKG_BUILD_DIR)/$(if $(strip $(1)),$(strip $(1)))" \
32 $(if
$(filter --jobserver
%,$(PKG_JOBS
)),,-j1
) \
37 ifndef Package
/$(1)/install
38 define Package
/$(1)/install
39 $$(INSTALL_DIR
) $$(1)/usr
/bin
/
40 $$(INSTALL_BIN
) $$(PKG_INSTALL_DIR
)/bin
/* $$(1)/usr
/bin
/
45 Build
/Compile
=$(call Build
/Compile
/Cargo
)