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_HOST_FEATURES - list of options, default empty
9 # Space or comma separated list of features to activate
11 # e.g. RUST_HOST_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_HOST_CONFIG_VARS
) \
20 CC
=$(HOSTCC_NOCACHE
) \
21 MAKEFLAGS
="$(HOST_JOBS)"
23 # $(1) path to the package (optional)
24 # $(2) additional arguments to cargo (optional)
25 define Host
/Compile
/Cargo
28 --profile
$(CARGO_HOST_PROFILE
) \
29 $(if
$(RUST_HOST_FEATURES
),--features
"$(RUST_HOST_FEATURES)") \
30 --root
$(HOST_INSTALL_DIR
) \
31 --path
"$(HOST_BUILD_DIR)/$(if $(strip $(1)),$(strip $(1)))" \
32 $(if
$(filter --jobserver
%,$(HOST_JOBS
)),,-j1
) \
36 define Host
/Uninstall
/Cargo
39 --root
$(HOST_INSTALL_DIR
) \
43 define RustBinHostBuild
45 $(INSTALL_DIR
) $(STAGING_DIR_HOSTPKG
)/bin
46 $(INSTALL_BIN
) $(HOST_INSTALL_DIR
)/bin
/* $(STAGING_DIR_HOSTPKG
)/bin
/
50 Host
/Compile
=$(call Host
/Compile
/Cargo
)
51 Host
/Uninstall
=$(call Host
/Uninstall
/Cargo
)