rust-lang: Apply suggestions from code review
Co-authored-by: Tianling Shen <cnsztl@gmail.com> Signed-off-by: Luca Barbato <luca.barbato@gmail.com>
This commit is contained in:
parent
674bad0559
commit
44d1d22a16
5 changed files with 86 additions and 78 deletions
|
@ -8,23 +8,20 @@ PKG_NAME:=rust
|
||||||
PKG_VERSION:=1.67.1
|
PKG_VERSION:=1.67.1
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz
|
||||||
|
PKG_SOURCE_URL:=https://static.rust-lang.org/dist/
|
||||||
|
PKG_HASH:=46483d3e5de85a3bd46f8e7a3ae1837496391067dbe713a25d3cf051b3d9ff6e
|
||||||
|
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/rustc-$(PKG_VERSION)-src/
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org>
|
||||||
PKG_LICENSE:=Apache-2.0 MIT
|
PKG_LICENSE:=Apache-2.0 MIT
|
||||||
PKG_LICENSE_FILES:=LICENSE-APACHE LICENSE-MIT
|
PKG_LICENSE_FILES:=LICENSE-APACHE LICENSE-MIT
|
||||||
|
|
||||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/rustc-$(PKG_VERSION)-src/
|
HOST_BUILD_DEPENDS:=python3/host
|
||||||
PKG_SOURCE:=rustc-$(PKG_VERSION)-src.tar.gz
|
|
||||||
PKG_SOURCE_URL:=https://static.rust-lang.org/dist/
|
|
||||||
PKG_SOURCE_VERSION:=$(PKG_VERSION)
|
|
||||||
PKG_HASH:=46483d3e5de85a3bd46f8e7a3ae1837496391067dbe713a25d3cf051b3d9ff6e
|
|
||||||
PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org>
|
|
||||||
|
|
||||||
PKG_HOST_ONLY:=1
|
PKG_HOST_ONLY:=1
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/host-build.mk
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
include $(INCLUDE_DIR)/host-build.mk
|
||||||
# Requires Python3 to build
|
|
||||||
HOST_BUILD_DEPENDS:=python3/host
|
|
||||||
|
|
||||||
# rust environment variables
|
# rust environment variables
|
||||||
include ./rust-host.mk
|
include ./rust-host.mk
|
||||||
|
@ -40,36 +37,36 @@ RUST_UNINSTALL:=$(CARGO_HOME)/lib/rustlib/uninstall.sh
|
||||||
|
|
||||||
# Target Flags
|
# Target Flags
|
||||||
TARGET_CONFIGURE_ARGS = \
|
TARGET_CONFIGURE_ARGS = \
|
||||||
--set=target.$(RUSTC_TARGET_ARCH).ar=$(TARGET_AR) \
|
--set=target.$(RUSTC_TARGET_ARCH).ar=$(TARGET_AR) \
|
||||||
--set=target.$(RUSTC_TARGET_ARCH).cc=$(TARGET_CC_NOCACHE) \
|
--set=target.$(RUSTC_TARGET_ARCH).cc=$(TARGET_CC_NOCACHE) \
|
||||||
--set=target.$(RUSTC_TARGET_ARCH).cxx=$(TARGET_CXX_NOCACHE) \
|
--set=target.$(RUSTC_TARGET_ARCH).cxx=$(TARGET_CXX_NOCACHE) \
|
||||||
--set=target.$(RUSTC_TARGET_ARCH).linker=$(TARGET_CC_NOCACHE) \
|
--set=target.$(RUSTC_TARGET_ARCH).linker=$(TARGET_CC_NOCACHE) \
|
||||||
--set=target.$(RUSTC_TARGET_ARCH).musl-root=$(TOOLCHAIN_DIR) \
|
--set=target.$(RUSTC_TARGET_ARCH).musl-root=$(TOOLCHAIN_DIR) \
|
||||||
--set=target.$(RUSTC_TARGET_ARCH).ranlib=$(TARGET_RANLIB)
|
--set=target.$(RUSTC_TARGET_ARCH).ranlib=$(TARGET_RANLIB)
|
||||||
|
|
||||||
# CARGO_HOME is an environmental
|
# CARGO_HOME is an environmental
|
||||||
HOST_CONFIGURE_OPTS += CARGO_HOME="$(CARGO_HOME)"
|
HOST_CONFIGURE_OPTS += CARGO_HOME="$(CARGO_HOME)"
|
||||||
|
|
||||||
# Rust Configuration Arguments
|
# Rust Configuration Arguments
|
||||||
HOST_CONFIGURE_ARGS = \
|
HOST_CONFIGURE_ARGS = \
|
||||||
--build=$(RUSTC_HOST_ARCH) \
|
--build=$(RUSTC_HOST_ARCH) \
|
||||||
--target=$(RUSTC_TARGET_ARCH),$(RUSTC_HOST_ARCH) \
|
--target=$(RUSTC_TARGET_ARCH),$(RUSTC_HOST_ARCH) \
|
||||||
--host=$(RUSTC_HOST_ARCH) \
|
--host=$(RUSTC_HOST_ARCH) \
|
||||||
--prefix=$(CARGO_HOME) \
|
--prefix=$(CARGO_HOME) \
|
||||||
--bindir=$(CARGO_HOME)/bin \
|
--bindir=$(CARGO_HOME)/bin \
|
||||||
--libdir=$(CARGO_HOME)/lib \
|
--libdir=$(CARGO_HOME)/lib \
|
||||||
--sysconfdir=$(CARGO_HOME)/etc \
|
--sysconfdir=$(CARGO_HOME)/etc \
|
||||||
--datadir=$(CARGO_HOME)/share \
|
--datadir=$(CARGO_HOME)/share \
|
||||||
--mandir=$(CARGO_HOME)/man \
|
--mandir=$(CARGO_HOME)/man \
|
||||||
--dist-compression-formats=xz \
|
--dist-compression-formats=xz \
|
||||||
--enable-llvm-link-shared \
|
--enable-llvm-link-shared \
|
||||||
--enable-llvm-plugins \
|
--enable-llvm-plugins \
|
||||||
--enable-missing-tools \
|
--enable-missing-tools \
|
||||||
--enable-ninja \
|
--enable-ninja \
|
||||||
--disable-sanitizers \
|
--disable-sanitizers \
|
||||||
--release-channel=stable \
|
--release-channel=stable \
|
||||||
--enable-cargo-native-static \
|
--enable-cargo-native-static \
|
||||||
${TARGET_CONFIGURE_ARGS}
|
$(TARGET_CONFIGURE_ARGS)
|
||||||
|
|
||||||
define Host/Prepare
|
define Host/Prepare
|
||||||
# Ensure rust temp directory
|
# Ensure rust temp directory
|
||||||
|
@ -112,13 +109,13 @@ endef
|
||||||
|
|
||||||
# Packages the Distribution Artifacts into HOST and TARGET bundles.
|
# Packages the Distribution Artifacts into HOST and TARGET bundles.
|
||||||
define Host/PackageDist
|
define Host/PackageDist
|
||||||
cd $(HOST_BUILD_DIR)/build/dist && \
|
( \
|
||||||
$(TAR) -cJf $(DL_DIR)/$(RUST_INSTALL_TARGET_FILENAME) \
|
cd $(HOST_BUILD_DIR)/build/dist ; \
|
||||||
rust-*-$(RUSTC_TARGET_ARCH).tar.xz
|
$(TAR) -cJf $(DL_DIR)/$(RUST_INSTALL_TARGET_FILENAME) \
|
||||||
|
rust-*-$(RUSTC_TARGET_ARCH).tar.xz ; \
|
||||||
cd $(HOST_BUILD_DIR)/build/dist && \
|
$(TAR) -cJf $(DL_DIR)/$(RUST_INSTALL_HOST_FILENAME) \
|
||||||
$(TAR) -cJf $(DL_DIR)/$(RUST_INSTALL_HOST_FILENAME) \
|
--exclude rust-*-$(RUSTC_TARGET_ARCH).tar.xz *.xz ; \
|
||||||
--exclude rust-*-$(RUSTC_TARGET_ARCH).tar.xz *.xz
|
)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/rust
|
define Package/rust
|
||||||
|
|
|
@ -8,40 +8,45 @@ PKG_NAME:=maturin
|
||||||
PKG_VERSION:=0.14.10
|
PKG_VERSION:=0.14.10
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=v$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://github.com/PyO3/maturin/archive/refs/tags/
|
PKG_SOURCE_URL:=https://codeload.github.com/PyO3/maturin/tar.gz/v$(PKG_VERSION)?
|
||||||
PKG_HASH:=8fc9bcdcb7f1535d5e3e8bb500c348ca1bff5a6dce87b0ab7dbc5a49723da28a
|
PKG_HASH:=8fc9bcdcb7f1535d5e3e8bb500c348ca1bff5a6dce87b0ab7dbc5a49723da28a
|
||||||
PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org>
|
|
||||||
|
|
||||||
PKG_HOST_ONLY:=1
|
PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org>
|
||||||
PKG_BUILD_PARALLEL:=1
|
PKG_LICENSE:=Apache-2.0 MIT
|
||||||
|
PKG_LICENSE_FILES:=license-apache license-mit
|
||||||
|
|
||||||
HOST_BUILD_DEPENDS:=rust/host
|
HOST_BUILD_DEPENDS:=rust/host
|
||||||
PKG_BUILD_DEPENDS:=rust/host
|
PKG_BUILD_DEPENDS:=rust/host
|
||||||
|
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
PKG_HOST_ONLY:=1
|
||||||
|
|
||||||
include ../rust-package.mk
|
include ../rust-package.mk
|
||||||
include $(INCLUDE_DIR)/host-build.mk
|
include $(INCLUDE_DIR)/host-build.mk
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
define Package/$(PKG_NAME)
|
define Package/maturin
|
||||||
SECTION:=lang
|
SECTION:=lang
|
||||||
CATEGORY:=Languages
|
CATEGORY:=Languages
|
||||||
SUBMENU:=Rust
|
SUBMENU:=Rust
|
||||||
CATEGORY:=Languages
|
TITLE:=Build and publish crates as python packages
|
||||||
DEPENDS:=$(RUST_ARCH_DEPENDS)
|
DEPENDS:=$(RUST_ARCH_DEPENDS)
|
||||||
TITLE:=Build and publish crates as python packages
|
URL:=https://maturin.rs
|
||||||
URL:=https://maturin.rs
|
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Host/Compile
|
define Host/Compile
|
||||||
cd $(HOST_BUILD_DIR) && \
|
( \
|
||||||
export PATH="$(CARGO_HOME)/bin:$(PATH)" && \
|
cd $(HOST_BUILD_DIR) ; \
|
||||||
CARGO_HOME=$(CARGO_HOME) \
|
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
|
||||||
cargo install --path . --root $(HOST_BUILD_DIR)
|
CARGO_HOME=$(CARGO_HOME) \
|
||||||
|
cargo install --path . --root $(HOST_BUILD_DIR) ; \
|
||||||
|
)
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/description
|
define Package/maturin/description
|
||||||
Build and publish crates with pyo3, rust-cpython, cffi and uniffi bindings as well as rust binaries as python packages.
|
Build and publish crates with pyo3, rust-cpython, cffi and uniffi
|
||||||
|
bindings as well as rust binaries as python packages.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Host/Install
|
define Host/Install
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# Copyright (C) 2023 Luca Barbato and Donald Hoskins
|
# Copyright (C) 2023 Luca Barbato and Donald Hoskins
|
||||||
|
|
||||||
# Rust Environmental Vars
|
# Rust Environmental Vars
|
||||||
CONFIG_HOST_SUFFIX:=$(shell cut -d"-" -f4 <<<"$(GNU_HOST_NAME)")
|
CONFIG_HOST_SUFFIX:=$(word 4, $(subst -, ,$(GNU_HOST_NAME)))
|
||||||
RUSTC_HOST_ARCH:=$(HOST_ARCH)-unknown-linux-$(CONFIG_HOST_SUFFIX)
|
RUSTC_HOST_ARCH:=$(HOST_ARCH)-unknown-linux-$(CONFIG_HOST_SUFFIX)
|
||||||
CARGO_HOME:=$(STAGING_DIR_HOST)/cargo
|
CARGO_HOME:=$(STAGING_DIR_HOST)/cargo
|
||||||
|
|
||||||
|
|
|
@ -8,8 +8,10 @@ include $(rust_mk_path)rust-host.mk
|
||||||
# $(1) path to the package
|
# $(1) path to the package
|
||||||
# $(2) additional arguments to cargo
|
# $(2) additional arguments to cargo
|
||||||
define Build/Compile/Cargo
|
define Build/Compile/Cargo
|
||||||
cd $(PKG_BUILD_DIR) && \
|
( \
|
||||||
export PATH="$(CARGO_HOME)/bin:$(PATH)" && \
|
cd $(PKG_BUILD_DIR) ; \
|
||||||
CARGO_HOME=$(CARGO_HOME) TARGET_CFLAGS="$(TARGET_CFLAGS) $(RUST_CFLAGS)" TARGET_CC=$(TARGET_CC_NOCACHE) CC=cc \
|
export PATH="$(CARGO_HOME)/bin:$(PATH)" ; \
|
||||||
cargo install -v --profile stripped --target $(RUSTC_TARGET_ARCH) --root $(PKG_INSTALL_DIR) --path "$(if $(strip $(1)),$(strip $(1)),.)" $(2)
|
CARGO_HOME=$(CARGO_HOME) TARGET_CFLAGS="$(TARGET_CFLAGS) $(RUST_CFLAGS)" TARGET_CC=$(TARGET_CC_NOCACHE) CC=cc \
|
||||||
|
cargo install -v --profile stripped --target $(RUSTC_TARGET_ARCH) --root $(PKG_INSTALL_DIR) --path "$(if $(strip $(1)),$(strip $(1)),.)" $(2) ; \
|
||||||
|
)
|
||||||
endef
|
endef
|
||||||
|
|
|
@ -8,10 +8,13 @@ PKG_NAME:=ripgrep
|
||||||
PKG_VERSION:=13.0.0
|
PKG_VERSION:=13.0.0
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
PKG_SOURCE:=$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=https://github.com/BurntSushi/ripgrep/archive/refs/tags/
|
PKG_SOURCE_URL:=https://codeload.github.com/BurntSushi/ripgrep/tar.gz/$(PKG_VERSION)?
|
||||||
PKG_HASH:=0fb17aaf285b3eee8ddab17b833af1e190d73de317ff9648751ab0660d763ed2
|
PKG_HASH:=0fb17aaf285b3eee8ddab17b833af1e190d73de317ff9648751ab0660d763ed2
|
||||||
|
|
||||||
PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org>
|
PKG_MAINTAINER:=Luca Barbato <lu_zero@luminem.org>
|
||||||
|
PKG_LICENSE:=MIT Unlicense
|
||||||
|
PKG_LICENSE_FILES:=LICENSE-MIT UNLICENSE
|
||||||
|
|
||||||
PKG_BUILD_DEPENDS:=rust/host
|
PKG_BUILD_DEPENDS:=rust/host
|
||||||
|
|
||||||
|
@ -22,21 +25,22 @@ define Build/Compile
|
||||||
$(call Build/Compile/Cargo,, --features 'pcre2')
|
$(call Build/Compile/Cargo,, --features 'pcre2')
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)
|
define Package/ripgrep
|
||||||
SECTION:=utils
|
SECTION:=utils
|
||||||
CATEGORY:=Utilities
|
CATEGORY:=Utilities
|
||||||
DEPENDS:=$(RUST_ARCH_DEPENDS) +libpcre2
|
TITLE:=ripgrep (rg) regex grep
|
||||||
TITLE:=ripgrep (rg) regex grep
|
DEPENDS:=$(RUST_ARCH_DEPENDS) +libpcre2
|
||||||
URL:=https://github.com/BurntSushi/ripgrep
|
URL:=https://github.com/BurntSushi/ripgrep
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/description
|
define Package/ripgrep/description
|
||||||
ripgrep (rg) recursively searches directories for a regex pattern while respecting your gitignore
|
ripgrep (rg) recursively searches directories for a regex pattern
|
||||||
|
while respecting your gitignore
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/$(PKG_NAME)/install
|
define Package/ripgrep/install
|
||||||
$(INSTALL_DIR) $(1)/bin
|
$(INSTALL_DIR) $(1)/bin
|
||||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/target/$(RUSTC_TARGET_ARCH)/stripped/rg $(1)/bin/rg
|
$(INSTALL_BIN) $(PKG_BUILD_DIR)/target/$(RUSTC_TARGET_ARCH)/stripped/rg $(1)/bin/rg
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
$(eval $(call BuildPackage,ripgrep))
|
||||||
|
|
Loading…
Reference in a new issue