libssh2: update to 1.11.0
[feed/packages.git] / lang / rust / rust-host-build.mk
1 # SPDX-License-Identifier: GPL-2.0-only
2 #
3 # Copyright (C) 2023 Luca Barbato and Donald Hoskins
4
5 # Variables (all optional) to be set in package Makefiles:
6 #
7 # RUST_HOST_FEATURES - list of options, default empty
8 #
9 # Space or comma separated list of features to activate
10 #
11 # e.g. RUST_HOST_FEATURES:=enable-foo,with-bar
12
13 ifeq ($(origin RUST_INCLUDE_DIR),undefined)
14 RUST_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
15 endif
16 include $(RUST_INCLUDE_DIR)/rust-values.mk
17
18 CARGO_HOST_VARS= \
19 $(CARGO_HOST_CONFIG_VARS) \
20 CC=$(HOSTCC_NOCACHE) \
21 MAKEFLAGS="$(HOST_JOBS)"
22
23 # $(1) path to the package (optional)
24 # $(2) additional arguments to cargo (optional)
25 define Host/Compile/Cargo
26 +$(CARGO_HOST_VARS) \
27 cargo install -v \
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) \
33 $(2)
34 endef
35
36 define Host/Uninstall/Cargo
37 +$(CARGO_HOST_VARS) \
38 cargo uninstall -v \
39 --root $(HOST_INSTALL_DIR) \
40 || true
41 endef
42
43 define RustBinHostBuild
44 define Host/Install
45 $(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
46 $(INSTALL_BIN) $(HOST_INSTALL_DIR)/bin/* $(STAGING_DIR_HOSTPKG)/bin/
47 endef
48 endef
49
50 Host/Compile=$(call Host/Compile/Cargo)
51 Host/Uninstall=$(call Host/Uninstall/Cargo)