Skip to content

Commit 2d3e0da

Browse files
lu-zerodangowrt
authored andcommitted
rust-lang: Add an Host/Compile helper as well
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
1 parent 44d1d22 commit 2d3e0da

2 files changed

Lines changed: 13 additions & 7 deletions

File tree

lang/rust/maturin/Makefile

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ define Package/maturin
3636
endef
3737

3838
define Host/Compile
39-
( \
40-
cd $(HOST_BUILD_DIR) ; \
41-
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
42-
CARGO_HOME=$(CARGO_HOME) \
43-
cargo install --path . --root $(HOST_BUILD_DIR) ; \
44-
)
39+
$(call Host/Compile/Cargo)
4540
endef
4641

4742
define Package/maturin/description
@@ -51,7 +46,7 @@ endef
5146

5247
define Host/Install
5348
$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
54-
$(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/maturin $(STAGING_DIR_HOSTPKG)/bin/maturin
49+
$(INSTALL_BIN) $(HOST_INSTALL_DIR)/bin/maturin $(STAGING_DIR_HOSTPKG)/bin/maturin
5550
endef
5651

5752
$(eval $(call HostBuild))

lang/rust/rust-package.mk

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,17 @@
55
rust_mk_path:=$(dir $(lastword $(MAKEFILE_LIST)))
66
include $(rust_mk_path)rust-host.mk
77

8+
# $(1) path to the package
9+
# $(2) additional arguments to cargo
10+
define Host/Compile/Cargo
11+
( \
12+
cd $(HOST_BUILD_DIR) ; \
13+
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
14+
CARGO_HOME=$(CARGO_HOME) CC=$(HOSTCC) \
15+
cargo install -v --profile stripped --root $(HOST_INSTALL_DIR) --path "$(if $(strip $(1)),$(strip $(1)),.)" $(2) ; \
16+
)
17+
endef
18+
819
# $(1) path to the package
920
# $(2) additional arguments to cargo
1021
define Build/Compile/Cargo

0 commit comments

Comments
 (0)