mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add missing files for Rust
This commit is contained in:
parent
08993bc8c3
commit
55186758bc
4 changed files with 52 additions and 45 deletions
15
rust/Config.in
Normal file
15
rust/Config.in
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
menu "Configuration options (for developers)"
|
||||||
|
|
||||||
|
config RUST_SCCACHE
|
||||||
|
bool "Use sccache"
|
||||||
|
help
|
||||||
|
Shared compilation cache; see https://github.com/mozilla/sccache
|
||||||
|
|
||||||
|
config RUST_SCCACHE_DIR
|
||||||
|
string "Set sccache directory" if RUST_SCCACHE
|
||||||
|
default ""
|
||||||
|
help
|
||||||
|
Store sccache in this directory.
|
||||||
|
If not set, uses './.sccache'
|
||||||
|
|
||||||
|
endmenu
|
|
@ -1,8 +0,0 @@
|
||||||
[target.@RUSTC_TARGET_ARCH@]
|
|
||||||
linker = "@TARGET_CC_NOCACHE@"
|
|
||||||
rustflags = ["-Ctarget-feature=-crt-static", "-Clink-args=@RUSTC_LDFLAGS@"]
|
|
||||||
|
|
||||||
[profile.stripped]
|
|
||||||
inherits = "release"
|
|
||||||
opt-level = "s"
|
|
||||||
strip = true
|
|
|
@ -2,36 +2,42 @@
|
||||||
#
|
#
|
||||||
# Copyright (C) 2023 Luca Barbato and Donald Hoskins
|
# 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)
|
ifeq ($(origin RUST_INCLUDE_DIR),undefined)
|
||||||
RUST_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
|
RUST_INCLUDE_DIR:=$(dir $(lastword $(MAKEFILE_LIST)))
|
||||||
endif
|
endif
|
||||||
include $(RUST_INCLUDE_DIR)/rust-values.mk
|
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)
|
# $(1) path to the package (optional)
|
||||||
# $(2) additional arguments to cargo (optional)
|
# $(2) additional arguments to cargo (optional)
|
||||||
define Host/Compile/Cargo
|
define Host/Compile/Cargo
|
||||||
( \
|
+$(CARGO_HOST_VARS) \
|
||||||
cd $(HOST_BUILD_DIR) ; \
|
cargo install -v \
|
||||||
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
|
--profile $(CARGO_HOST_PROFILE) \
|
||||||
CARGO_HOME=$(CARGO_HOME) \
|
$(if $(RUST_HOST_FEATURES),--features "$(RUST_HOST_FEATURES)") \
|
||||||
CC=$(HOSTCC_NOCACHE) \
|
--root $(HOST_INSTALL_DIR) \
|
||||||
cargo install -v \
|
--path "$(HOST_BUILD_DIR)/$(if $(strip $(1)),$(strip $(1)))" \
|
||||||
--profile stripped \
|
$(if $(filter --jobserver%,$(HOST_JOBS)),,-j1) \
|
||||||
$(if $(RUST_PKG_FEATURES),--features "$(RUST_PKG_FEATURES)") \
|
$(2)
|
||||||
--root $(HOST_INSTALL_DIR) \
|
|
||||||
--path "$(if $(strip $(1)),$(strip $(1)),.)" $(2) ; \
|
|
||||||
)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Host/Uninstall/Cargo
|
define Host/Uninstall/Cargo
|
||||||
( \
|
+$(CARGO_HOST_VARS) \
|
||||||
cd $(HOST_BUILD_DIR) ; \
|
cargo uninstall -v \
|
||||||
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
|
--root $(HOST_INSTALL_DIR) \
|
||||||
CARGO_HOME=$(CARGO_HOME) \
|
|| true
|
||||||
CC=$(HOSTCC_NOCACHE) \
|
|
||||||
cargo uninstall -v \
|
|
||||||
--root $(HOST_INSTALL_DIR) || true ; \
|
|
||||||
)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define RustBinHostBuild
|
define RustBinHostBuild
|
||||||
|
|
|
@ -15,28 +15,22 @@ ifeq ($(origin RUST_INCLUDE_DIR),undefined)
|
||||||
endif
|
endif
|
||||||
include $(RUST_INCLUDE_DIR)/rust-values.mk
|
include $(RUST_INCLUDE_DIR)/rust-values.mk
|
||||||
|
|
||||||
# Support only a subset for now.
|
CARGO_PKG_VARS= \
|
||||||
RUST_ARCH_DEPENDS:=@(aarch64||arm||i386||i686||mips||mipsel||mips64||mips64el||mipsel||powerpc64||riscv64||x86_64)
|
$(CARGO_PKG_CONFIG_VARS) \
|
||||||
|
CC=$(HOSTCC_NOCACHE) \
|
||||||
|
MAKEFLAGS="$(PKG_JOBS)"
|
||||||
|
|
||||||
# $(1) path to the package (optional)
|
# $(1) path to the package (optional)
|
||||||
# $(2) additional arguments to cargo (optional)
|
# $(2) additional arguments to cargo (optional)
|
||||||
define Build/Compile/Cargo
|
define Build/Compile/Cargo
|
||||||
( \
|
+$(CARGO_PKG_VARS) \
|
||||||
cd $(PKG_BUILD_DIR) ; \
|
cargo install -v \
|
||||||
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
|
--profile $(CARGO_PKG_PROFILE) \
|
||||||
CARGO_HOME=$(CARGO_HOME) \
|
$(if $(strip $(RUST_PKG_FEATURES)),--features "$(strip $(RUST_PKG_FEATURES))") \
|
||||||
TARGET_CFLAGS="$(TARGET_CFLAGS) $(RUST_CFLAGS)" \
|
--root $(PKG_INSTALL_DIR) \
|
||||||
TARGET_CC=$(TARGET_CC_NOCACHE) \
|
--path "$(PKG_BUILD_DIR)/$(if $(strip $(1)),$(strip $(1)))" \
|
||||||
CC=$(HOSTCC_NOCACHE) \
|
$(if $(filter --jobserver%,$(PKG_JOBS)),,-j1) \
|
||||||
$(CARGO_VARS) \
|
$(2)
|
||||||
cargo install -v \
|
|
||||||
--profile stripped \
|
|
||||||
--target $(RUSTC_TARGET_ARCH) \
|
|
||||||
$(if $(strip $(RUST_PKG_FEATURES)),--features "$(strip $(RUST_PKG_FEATURES))") \
|
|
||||||
--root $(PKG_INSTALL_DIR) \
|
|
||||||
--path "$(if $(strip $(1)),$(strip $(1)),.)" \
|
|
||||||
$(2) ; \
|
|
||||||
)
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define RustBinPackage
|
define RustBinPackage
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue