libssh2: update to 1.11.0
[feed/packages.git] / lang / rust / rust-host-build.mk
index 39cf1f23c5c33ea02f9a96ddae1d1ff445d6ce49..e5629293760b57ed0ee2ec5d58b12575aeeca646 100644 (file)
@@ -2,36 +2,42 @@
 #
 # 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
 include $(RUST_INCLUDE_DIR)/rust-values.mk
 
+CARGO_HOST_VARS= \
+       $(CARGO_HOST_CONFIG_VARS) \
+       CC=$(HOSTCC_NOCACHE) \
+       MAKEFLAGS="$(HOST_JOBS)"
+
 # $(1) path to the package (optional)
 # $(2) additional arguments to cargo (optional)
 define Host/Compile/Cargo
-       ( \
-               cd $(HOST_BUILD_DIR) ; \
-               export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
-               CARGO_HOME=$(CARGO_HOME) \
-               CC=$(HOSTCC_NOCACHE) \
-               cargo install -v \
-                       --profile stripped \
-                       $(if $(RUST_PKG_FEATURES),--features "$(RUST_PKG_FEATURES)") \
-                       --root $(HOST_INSTALL_DIR) \
-                       --path "$(if $(strip $(1)),$(strip $(1)),.)" $(2) ; \
-       )
+       +$(CARGO_HOST_VARS) \
+       cargo install -v \
+               --profile $(CARGO_HOST_PROFILE) \
+               $(if $(RUST_HOST_FEATURES),--features "$(RUST_HOST_FEATURES)") \
+               --root $(HOST_INSTALL_DIR) \
+               --path "$(HOST_BUILD_DIR)/$(if $(strip $(1)),$(strip $(1)))" \
+               $(if $(filter --jobserver%,$(HOST_JOBS)),,-j1) \
+               $(2)
 endef
 
 define Host/Uninstall/Cargo
-       ( \
-               cd $(HOST_BUILD_DIR) ; \
-               export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
-               CARGO_HOME=$(CARGO_HOME) \
-               CC=$(HOSTCC_NOCACHE) \
-               cargo uninstall -v \
-                       --root $(HOST_INSTALL_DIR) || true ; \
-       )
+       +$(CARGO_HOST_VARS) \
+       cargo uninstall -v \
+               --root $(HOST_INSTALL_DIR) \
+               || true
 endef
 
 define RustBinHostBuild