Skip to content

Commit

Permalink
rust-lang: Add an Host/Compile helper as well
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
  • Loading branch information
lu-zero committed Mar 9, 2023
1 parent ba1482b commit e778b32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
9 changes: 2 additions & 7 deletions lang/rust/maturin/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,7 @@ define Package/maturin
endef

define Host/Compile
( \
cd $(HOST_BUILD_DIR) ; \
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
CARGO_HOME=$(CARGO_HOME) \
cargo install --path . --root $(HOST_BUILD_DIR) ; \
)
$(call Host/Compile/Cargo)
endef

define Package/maturin/description
Expand All @@ -51,7 +46,7 @@ endef

define Host/Install
$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
$(INSTALL_BIN) $(HOST_BUILD_DIR)/bin/maturin $(STAGING_DIR_HOSTPKG)/bin/maturin
$(INSTALL_BIN) $(HOST_INSTALL_DIR)/bin/maturin $(STAGING_DIR_HOSTPKG)/bin/maturin
endef

$(eval $(call HostBuild))
Expand Down
11 changes: 11 additions & 0 deletions lang/rust/rust-package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@
rust_mk_path:=$(dir $(lastword $(MAKEFILE_LIST)))
include $(rust_mk_path)rust-host.mk

# $(1) path to the package
# $(2) additional arguments to cargo
define Host/Compile/Cargo
( \
cd $(HOST_BUILD_DIR) ; \
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
CARGO_HOME=$(CARGO_HOME) CC=$(HOSTCC) \
cargo install -v --profile stripped --root $(HOST_INSTALL_DIR) --path "$(if $(strip $(1)),$(strip $(1)),.)" $(2) ; \
)
endef

# $(1) path to the package
# $(2) additional arguments to cargo
define Build/Compile/Cargo
Expand Down

0 comments on commit e778b32

Please sign in to comment.