rust: Add RUST_HOST_FEATURES for host builds
authorJeffery To <jeffery.to@gmail.com>
Mon, 25 Sep 2023 03:28:45 +0000 (11:28 +0800)
committerJeffery To <jeffery.to@gmail.com>
Thu, 12 Oct 2023 05:59:22 +0000 (13:59 +0800)
Features to be enabled for host may not be the same as those for target.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
(cherry picked from commit d24095b8fc5b8d4e509d59f73d6901842b50c4bd)

lang/rust/rust-host-build.mk

index 39cf1f23c5c33ea02f9a96ddae1d1ff445d6ce49..39bee072eb8d19cad546c6345a02c1ff0f8212e5 100644 (file)
@@ -2,6 +2,14 @@
 #
 # Copyright (C) 2023 Luca Barbato and Donald Hoskins
 
+# Variables (all optional) to be set in package Makefiles:
+#
+# RUST_HOST_FEATURES - list of options, default empty
+#
+#   Space or comma separated list of features to activate
+#
+#   e.g. RUST_HOST_FEATURES:=enable-foo,with-bar
+
 ifeq ($(origin RUST_INCLUDE_DIR),undefined)
   RUST_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
 endif
@@ -17,7 +25,7 @@ define Host/Compile/Cargo
                CC=$(HOSTCC_NOCACHE) \
                cargo install -v \
                        --profile stripped \
-                       $(if $(RUST_PKG_FEATURES),--features "$(RUST_PKG_FEATURES)") \
+                       $(if $(RUST_HOST_FEATURES),--features "$(RUST_HOST_FEATURES)") \
                        --root $(HOST_INSTALL_DIR) \
                        --path "$(if $(strip $(1)),$(strip $(1)),.)" $(2) ; \
        )