mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add Rust language
This commit is contained in:
parent
4296ac92e9
commit
d07ccb47ff
7 changed files with 350 additions and 0 deletions
45
rust/rust-host-build.mk
Normal file
45
rust/rust-host-build.mk
Normal file
|
@ -0,0 +1,45 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2023 Luca Barbato and Donald Hoskins
|
||||
|
||||
ifeq ($(origin RUST_INCLUDE_DIR),undefined)
|
||||
RUST_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
|
||||
endif
|
||||
include $(RUST_INCLUDE_DIR)/rust-values.mk
|
||||
|
||||
# $(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) ; \
|
||||
)
|
||||
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 ; \
|
||||
)
|
||||
endef
|
||||
|
||||
define RustBinHostBuild
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
|
||||
$(INSTALL_BIN) $(HOST_INSTALL_DIR)/bin/* $(STAGING_DIR_HOSTPKG)/bin/
|
||||
endef
|
||||
endef
|
||||
|
||||
Host/Compile=$(call Host/Compile/Cargo)
|
||||
Host/Uninstall=$(call Host/Uninstall/Cargo)
|
Loading…
Add table
Add a link
Reference in a new issue