rust-lang: Add the rust language support
Based on work from Donald Hoskins <grommish@gmail.com>. Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
This commit is contained in:
parent
772db8c11b
commit
83785a7ce0
6 changed files with 1004 additions and 0 deletions
95
lang/rust/Config.in
Normal file
95
lang/rust/Config.in
Normal file
|
@ -0,0 +1,95 @@
|
|||
# Rust Language Options
|
||||
menu "Compiler Options"
|
||||
visible if PACKAGE_rust
|
||||
|
||||
config RUST_DEBUG
|
||||
bool "Enables Debugging Environment (--enable-debug)"
|
||||
|
||||
config RUST_DOCS
|
||||
bool "Build standard library documentation (--enable-docs)"
|
||||
|
||||
config RUST_COMPILER_DOCS
|
||||
bool "Build compiler documentation (--enable-compiler-docs)"
|
||||
|
||||
config RUST_OPTIMIZE_TESTS
|
||||
bool "Build tests with optimizations (--enable-optimized-tests)"
|
||||
|
||||
config RUST_PARALLEL
|
||||
bool "Build with multi-threaded support (--enable-parallel-compiler)"
|
||||
|
||||
config RUST_VERBOSE_TESTS
|
||||
bool "Enable verbose output when running tests (--enable-verbose-tests)"
|
||||
|
||||
config RUST_CCACHE
|
||||
bool "Build with ccache enabled (--enable-ccache)"
|
||||
|
||||
config RUST_LLVM_STATIC
|
||||
bool "Statically link to libstdc++ to LLVM (--enable-llvm-static-stdccp)"
|
||||
|
||||
config RUST_LLVM_SHARED
|
||||
bool "Prefer shared linking to LLVM (--enable-llvm-link-shared)"
|
||||
|
||||
config RUST_CODEGEN_TESTS
|
||||
bool "Run the src/test/codegen tests (--enable-codegen-tests)"
|
||||
|
||||
config RUST_OPTION_CHECKING
|
||||
bool "Complain about unrecognized options in this configure script (--enable-option-checking)"
|
||||
default y
|
||||
|
||||
config RUST_ENABLE_NINJA
|
||||
bool "Build LLVM using the Ninja generator (--enable-ninja)"
|
||||
default y
|
||||
|
||||
config RUST_LOCKED_DEPS
|
||||
bool "Force Cargo.lock to be up to date (--enable-locked-deps)"
|
||||
|
||||
config RUST_VENDOR
|
||||
bool "Enable usage of vendored Rust crates (--enable-vendor)"
|
||||
|
||||
config RUST_SANITIZERS
|
||||
bool "Build the sanitizer runtimes (asan, lsan, msan, tsan) (--enable-sanitizers)"
|
||||
|
||||
config RUST_DIST_SRC
|
||||
bool "When building tarballs enables building a source tarball (--enable-dist-src)"
|
||||
|
||||
config RUST_CARGO_NATIVE_STATIC
|
||||
bool "Build static native libraries in Cargo (--enable-cargo-native-static)"
|
||||
|
||||
config RUST_PROFILER
|
||||
bool "Build the profiler runtime (--enable-profiler)"
|
||||
|
||||
config RUST_FULL_TOOLS
|
||||
bool "Build all tools (--enable-full-tools)"
|
||||
|
||||
config RUST_MISSING_TOOLS
|
||||
bool "Allow failures when building tools (--enable-missing-tools)"
|
||||
default y
|
||||
|
||||
config RUST_USE_LIBCXX
|
||||
bool "Build LLVM with libc++ (--enable-use-libcxx)"
|
||||
|
||||
config RUST_CONTROL_FLOW_GUARD
|
||||
bool "Enable Control Flow Guard (--enable-control-flow-guard)"
|
||||
|
||||
config RUST_OPTIMIZE_LLVM
|
||||
bool "Build optimized LLVM (--enable-optimize-llvm)"
|
||||
default y
|
||||
|
||||
config RUST_LLVM_ASSERTIONS
|
||||
bool "Build LLVM with assertions (--enable-llvm-assertions)"
|
||||
|
||||
config RUST_DEBUG_ASSERTIONS
|
||||
bool "Build with debugging assertions (--enable-debug-assertions)"
|
||||
|
||||
config RUST_LLVM_RELEASE_DEBUGINFO
|
||||
bool "Build LLVM with debugger metadata (--enable-llvm-release-debuginfo)"
|
||||
|
||||
config RUST_MANAGE_SUBMODULES
|
||||
bool "Let the build manage the git submodules (--enable-manage-submodules)"
|
||||
default y
|
||||
|
||||
config RUST_FULL_BOOTSTRAP
|
||||
bool "Full Bootstrap - Build three compilers instead of two (--enable-full-bootstrap)"
|
||||
|
||||
endmenu
|
||||
|
144
lang/rust/Makefile
Normal file
144
lang/rust/Makefile
Normal file
|
@ -0,0 +1,144 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2023 Luca Barbato and Donald Hoskins
|
||||
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=rust
|
||||
PKG_VERSION:=1.67.1
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_LICENSE:=Apache-2.0 MIT
|
||||
PKG_LICENSE_FILES:=LICENSE-APACHE LICENSE-MIT
|
||||
|
||||
HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/rustc-$(PKG_VERSION)-src/
|
||||
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
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
# Requires Python3 to build
|
||||
HOST_BUILD_DEPENDS:=python3/host
|
||||
|
||||
# rust environment variables
|
||||
include ./rust-host.mk
|
||||
|
||||
# Rust Temp Directory
|
||||
RUST_TMP_DIR:=$(TMP_DIR)/rust-install
|
||||
|
||||
RUST_INSTALL_HOST_FILENAME:=$(PKG_NAME)-$(PKG_VERSION)-$(RUSTC_HOST_ARCH)-install.tar.xz
|
||||
RUST_INSTALL_TARGET_FILENAME:=$(PKG_NAME)-$(PKG_VERSION)-$(RUSTC_TARGET_ARCH)-install.tar.xz
|
||||
|
||||
# Rust-lang has an uninstall script
|
||||
RUST_UNINSTALL:=$(CARGO_HOME)/lib/rustlib/uninstall.sh
|
||||
|
||||
# Target Flags
|
||||
TARGET_CONFIGURE_ARGS = \
|
||||
--set=target.$(RUSTC_TARGET_ARCH).ar=$(TARGET_AR) \
|
||||
--set=target.$(RUSTC_TARGET_ARCH).cc=$(TARGET_CC_NOCACHE) \
|
||||
--set=target.$(RUSTC_TARGET_ARCH).cxx=$(TARGET_CXX_NOCACHE) \
|
||||
--set=target.$(RUSTC_TARGET_ARCH).linker=$(TARGET_CC_NOCACHE) \
|
||||
--set=target.$(RUSTC_TARGET_ARCH).musl-root=$(TOOLCHAIN_DIR) \
|
||||
--set=target.$(RUSTC_TARGET_ARCH).ranlib=$(TARGET_RANLIB)
|
||||
|
||||
# CARGO_HOME is an environmental
|
||||
HOST_CONFIGURE_OPTS += CARGO_HOME="$(CARGO_HOME)"
|
||||
|
||||
# Rust Configuration Arguments
|
||||
HOST_CONFIGURE_ARGS = \
|
||||
--build=$(RUSTC_HOST_ARCH) \
|
||||
--target=$(RUSTC_TARGET_ARCH),$(RUSTC_HOST_ARCH) \
|
||||
--host=$(RUSTC_HOST_ARCH) \
|
||||
--prefix=$(CARGO_HOME) \
|
||||
--bindir=$(CARGO_HOME)/bin \
|
||||
--libdir=$(CARGO_HOME)/lib \
|
||||
--sysconfdir=$(CARGO_HOME)/etc \
|
||||
--datadir=$(CARGO_HOME)/share \
|
||||
--mandir=$(CARGO_HOME)/man \
|
||||
--dist-compression-formats=xz \
|
||||
--enable-llvm-link-shared \
|
||||
--enable-llvm-plugins \
|
||||
--enable-missing-tools \
|
||||
--enable-ninja \
|
||||
--disable-sanitizers \
|
||||
--release-channel=stable \
|
||||
--enable-cargo-native-static \
|
||||
${TARGET_CONFIGURE_ARGS}
|
||||
|
||||
define Host/Prepare
|
||||
# Ensure rust temp directory
|
||||
[ -d $(RUST_TMP_DIR) ] || \
|
||||
mkdir -p $(RUST_TMP_DIR)
|
||||
|
||||
$(call Host/Prepare/Default)
|
||||
endef
|
||||
|
||||
define Host/Uninstall
|
||||
# Call the Uninstall script
|
||||
[ -f $(RUST_UNINSTALL) ] && \
|
||||
$(BASH) $(RUST_UNINSTALL) || echo No Uninstall
|
||||
|
||||
rm -rf $(RUST_TMP_DIR)
|
||||
endef
|
||||
|
||||
# Makes and then packages the dist artifacts
|
||||
define Host/Compile
|
||||
cd $(HOST_BUILD_DIR) && \
|
||||
$(PYTHON) x.py --config ./config.toml dist build-manifest cargo llvm-tools \
|
||||
rustc rust-std rust-src
|
||||
|
||||
$(call Host/PackageDist)
|
||||
endef
|
||||
|
||||
# Distribution Artifacts are packaged by Host/PackageDist
|
||||
# We just need to extract and install
|
||||
define Host/Install
|
||||
$(TAR) -C $(RUST_TMP_DIR) -xJf $(DL_DIR)/$(RUST_INSTALL_HOST_FILENAME) && \
|
||||
$(TAR) -C $(RUST_TMP_DIR) -xJf $(DL_DIR)/$(RUST_INSTALL_TARGET_FILENAME)
|
||||
|
||||
cd $(RUST_TMP_DIR) && \
|
||||
find -iname "*.xz" -exec tar -xJf {} ";" && \
|
||||
find ./* -type f -name install.sh -execdir sh {} --prefix=$(CARGO_HOME) --disable-ldconfig \;
|
||||
|
||||
echo -e "[target.$(RUSTC_TARGET_ARCH)]\nlinker = \"$(TARGET_CC_NOCACHE)\"\nrustflags = [\"-Ctarget-feature=-crt-static\", \"-Clink-args=$(RUSTC_LDFLAGS)\"]" > $(CARGO_HOME)/config
|
||||
echo -e "\n[profile.stripped]\ninherits = \"release\"\nopt-level = \"s\"\nstrip = true" >> $(CARGO_HOME)/config
|
||||
endef
|
||||
|
||||
# Packages the Distribution Artifacts into HOST and TARGET bundles.
|
||||
define Host/PackageDist
|
||||
cd $(HOST_BUILD_DIR)/build/dist && \
|
||||
$(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) \
|
||||
--exclude rust-*-$(RUSTC_TARGET_ARCH).tar.xz *.xz
|
||||
endef
|
||||
|
||||
define Package/rust
|
||||
SECTION:=lang
|
||||
CATEGORY:=Languages
|
||||
TITLE:=Rust Programming Language Compiler
|
||||
URL:=https://www.rust-lang.org/
|
||||
DEPENDS:=$(RUST_ARCH_DEPENDS) \
|
||||
+pkg-config +libunwind +libopenssl +liblzma +libc
|
||||
endef
|
||||
|
||||
define Package/rust/description
|
||||
Rust is a multi-paradigm, general-purpose programming language designed for performance
|
||||
and safety, especially safe concurrency. Rust is syntactically similar to C++, but can
|
||||
guarantee memory safety by using a borrow checker to validate references.
|
||||
endef
|
||||
|
||||
define Package/rust/config
|
||||
source "$(SOURCE)/Config.in"
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
$(eval $(call BuildPackage,rust))
|
573
lang/rust/patches/0001-Update-xz2-and-use-it-static.patch
Normal file
573
lang/rust/patches/0001-Update-xz2-and-use-it-static.patch
Normal file
|
@ -0,0 +1,573 @@
|
|||
From cfa7506a303537ee7211bd46c39a96bbc5cea9cf Mon Sep 17 00:00:00 2001
|
||||
From: Luca Barbato <lu_zero@gentoo.org>
|
||||
Date: Fri, 27 Jan 2023 15:34:36 +0100
|
||||
Subject: [PATCH] Update xz2 and lzma-sys
|
||||
|
||||
And use the static build.
|
||||
---
|
||||
Cargo.lock | 140 +++++++--------------------------------
|
||||
src/bootstrap/Cargo.lock | 8 +--
|
||||
src/bootstrap/Cargo.toml | 2 +-
|
||||
3 files changed, 28 insertions(+), 122 deletions(-)
|
||||
|
||||
diff --git a/Cargo.lock b/Cargo.lock
|
||||
index 6a15105805e..d4ecc363071 100644
|
||||
--- a/Cargo.lock
|
||||
+++ b/Cargo.lock
|
||||
@@ -295,45 +295,44 @@ version = "1.0.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "869119e97797867fd90f5e22af7d0bd274bd4635ebb9eb68c04f3f513ae6c412"
|
||||
dependencies = [
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo"
|
||||
-version = "0.68.0"
|
||||
+version = "0.67.1"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
+ "atty",
|
||||
"base64",
|
||||
"bytesize",
|
||||
"cargo-platform 0.1.2",
|
||||
"cargo-test-macro",
|
||||
"cargo-test-support",
|
||||
"cargo-util",
|
||||
"clap 4.0.15",
|
||||
"crates-io",
|
||||
"curl",
|
||||
"curl-sys",
|
||||
- "env_logger 0.10.0",
|
||||
+ "env_logger 0.9.0",
|
||||
"filetime",
|
||||
"flate2",
|
||||
"fwdansi",
|
||||
"git2",
|
||||
"git2-curl",
|
||||
"glob",
|
||||
"hex 0.4.2",
|
||||
"hmac",
|
||||
"home",
|
||||
- "http-auth",
|
||||
"humantime 2.0.1",
|
||||
"ignore",
|
||||
"im-rc",
|
||||
"indexmap",
|
||||
- "is-terminal",
|
||||
"itertools",
|
||||
"jobserver",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"libc",
|
||||
"libgit2-sys",
|
||||
"log",
|
||||
"memchr",
|
||||
@@ -363,38 +362,38 @@ dependencies = [
|
||||
"unicode-xid",
|
||||
"url",
|
||||
"walkdir",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-credential"
|
||||
-version = "0.2.0"
|
||||
+version = "0.1.0"
|
||||
|
||||
[[package]]
|
||||
name = "cargo-credential-1password"
|
||||
-version = "0.2.0"
|
||||
+version = "0.1.0"
|
||||
dependencies = [
|
||||
"cargo-credential",
|
||||
"serde",
|
||||
"serde_json",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-credential-macos-keychain"
|
||||
-version = "0.2.0"
|
||||
+version = "0.1.0"
|
||||
dependencies = [
|
||||
"cargo-credential",
|
||||
"security-framework",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-credential-wincred"
|
||||
-version = "0.2.0"
|
||||
+version = "0.1.0"
|
||||
dependencies = [
|
||||
"cargo-credential",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-miri"
|
||||
version = "0.1.0"
|
||||
@@ -438,38 +437,39 @@ dependencies = [
|
||||
"cargo-util",
|
||||
"crates-io",
|
||||
"filetime",
|
||||
"flate2",
|
||||
"git2",
|
||||
"glob",
|
||||
"itertools",
|
||||
"lazy_static",
|
||||
+ "remove_dir_all",
|
||||
"serde_json",
|
||||
"snapbox",
|
||||
"tar",
|
||||
"termcolor",
|
||||
"toml_edit",
|
||||
"url",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cargo-util"
|
||||
-version = "0.2.3"
|
||||
+version = "0.2.2"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"core-foundation",
|
||||
"crypto-hash",
|
||||
"filetime",
|
||||
"hex 0.4.2",
|
||||
"jobserver",
|
||||
"libc",
|
||||
"log",
|
||||
- "miow 0.5.0",
|
||||
+ "miow",
|
||||
"same-file",
|
||||
"shell-escape",
|
||||
"tempfile",
|
||||
"walkdir",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -832,17 +832,17 @@ version = "0.0.0"
|
||||
dependencies = [
|
||||
"colored",
|
||||
"diff",
|
||||
"getopts",
|
||||
"glob",
|
||||
"lazy_static",
|
||||
"lazycell",
|
||||
"libc",
|
||||
- "miow 0.3.7",
|
||||
+ "miow",
|
||||
"miropt-test-tools",
|
||||
"regex",
|
||||
"rustfix",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"tracing",
|
||||
"tracing-subscriber",
|
||||
"unified-diff",
|
||||
@@ -857,43 +857,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "70489bbb718aea4f92e5f48f2e3b5be670c2051de30e57cb6e5377b4aa08b372"
|
||||
dependencies = [
|
||||
"diff",
|
||||
"filetime",
|
||||
"getopts",
|
||||
"lazy_static",
|
||||
"libc",
|
||||
"log",
|
||||
- "miow 0.3.7",
|
||||
+ "miow",
|
||||
"regex",
|
||||
"rustfix",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
"tester",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concolor"
|
||||
-version = "0.0.9"
|
||||
+version = "0.0.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "b90f9dcd9490a97db91a85ccd79e38a87e14323f0bb824659ee3274e9143ba37"
|
||||
+checksum = "015267563b1df20adccdd00cb05257b1dfbea70a04928e9cf88ffb850c1a40af"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"bitflags",
|
||||
"concolor-query",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "concolor-query"
|
||||
-version = "0.1.0"
|
||||
+version = "0.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "82a90734b3d5dcf656e7624cca6bce9c3a90ee11f900e80141a7427ccfb3d317"
|
||||
+checksum = "d6417fe6fc03a8b533fd2177742eeb39a90c7233eedec7bac96d4d6b69a09449"
|
||||
|
||||
[[package]]
|
||||
name = "content_inspector"
|
||||
version = "0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
@@ -939,17 +939,17 @@ version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crates-io"
|
||||
-version = "0.35.0"
|
||||
+version = "0.34.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"curl",
|
||||
"percent-encoding",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"url",
|
||||
]
|
||||
@@ -1258,50 +1258,16 @@ checksum = "0b2cf0344971ee6c64c31be0d530793fba457d322dfec2810c453d0ef228f9c3"
|
||||
dependencies = [
|
||||
"atty",
|
||||
"humantime 2.0.1",
|
||||
"log",
|
||||
"regex",
|
||||
"termcolor",
|
||||
]
|
||||
|
||||
-[[package]]
|
||||
-name = "env_logger"
|
||||
-version = "0.10.0"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0"
|
||||
-dependencies = [
|
||||
- "humantime 2.0.1",
|
||||
- "is-terminal",
|
||||
- "log",
|
||||
- "regex",
|
||||
- "termcolor",
|
||||
-]
|
||||
-
|
||||
-[[package]]
|
||||
-name = "errno"
|
||||
-version = "0.2.8"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1"
|
||||
-dependencies = [
|
||||
- "errno-dragonfly",
|
||||
- "libc",
|
||||
- "winapi",
|
||||
-]
|
||||
-
|
||||
-[[package]]
|
||||
-name = "errno-dragonfly"
|
||||
-version = "0.1.2"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
|
||||
-dependencies = [
|
||||
- "cc",
|
||||
- "libc",
|
||||
-]
|
||||
-
|
||||
[[package]]
|
||||
name = "error_index_generator"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"mdbook",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1795,25 +1761,16 @@ dependencies = [
|
||||
"log",
|
||||
"mac",
|
||||
"markup5ever",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn",
|
||||
]
|
||||
|
||||
-[[package]]
|
||||
-name = "http-auth"
|
||||
-version = "0.1.6"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "c0b40b39d66c28829a0cf4d09f7e139ff8201f7500a5083732848ed3b4b4d850"
|
||||
-dependencies = [
|
||||
- "memchr",
|
||||
-]
|
||||
-
|
||||
[[package]]
|
||||
name = "humantime"
|
||||
version = "1.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df004cfca50ef23c36850aaaa59ad52cc70d0e90243c3c7737a4dd32dc7a3c4f"
|
||||
dependencies = [
|
||||
"quick-error",
|
||||
]
|
||||
@@ -2004,38 +1961,16 @@ dependencies = [
|
||||
name = "intl_pluralrules"
|
||||
version = "7.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "078ea7b7c29a2b4df841a7f6ac8775ff6074020c6776d48491ce2268e068f972"
|
||||
dependencies = [
|
||||
"unic-langid",
|
||||
]
|
||||
|
||||
-[[package]]
|
||||
-name = "io-lifetimes"
|
||||
-version = "1.0.2"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "e394faa0efb47f9f227f1cd89978f854542b318a6f64fa695489c9c993056656"
|
||||
-dependencies = [
|
||||
- "libc",
|
||||
- "windows-sys",
|
||||
-]
|
||||
-
|
||||
-[[package]]
|
||||
-name = "is-terminal"
|
||||
-version = "0.4.0"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "aae5bc6e2eb41c9def29a3e0f1306382807764b9b53112030eff57435667352d"
|
||||
-dependencies = [
|
||||
- "hermit-abi 0.2.6",
|
||||
- "io-lifetimes",
|
||||
- "rustix",
|
||||
- "windows-sys",
|
||||
-]
|
||||
-
|
||||
[[package]]
|
||||
name = "itertools"
|
||||
version = "0.10.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473"
|
||||
dependencies = [
|
||||
"either",
|
||||
]
|
||||
@@ -2235,22 +2170,16 @@ checksum = "7fb9b38af92608140b86b693604b9ffcc5824240a484d1ecd4795bacb2fe88f3"
|
||||
name = "lint-docs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"serde_json",
|
||||
"tempfile",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
-[[package]]
|
||||
-name = "linux-raw-sys"
|
||||
-version = "0.1.3"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "8f9f08d8963a6c613f4b1a78f4f4a4dbfadf8e6545b2d72861731e4858b8b47f"
|
||||
-
|
||||
[[package]]
|
||||
name = "litemap"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f34a3f4798fac63fb48cf277eefa38f94d3443baff555bb98e4f56bc9092368e"
|
||||
|
||||
[[package]]
|
||||
name = "lld-wrapper"
|
||||
@@ -2272,19 +2201,19 @@ version = "0.4.14"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
|
||||
dependencies = [
|
||||
"cfg-if 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lzma-sys"
|
||||
-version = "0.1.16"
|
||||
+version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "f24f76ec44a8ac23a31915d6e326bca17ce88da03096f1ff194925dc714dac99"
|
||||
+checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mac"
|
||||
@@ -2434,25 +2363,16 @@ dependencies = [
|
||||
name = "miow"
|
||||
version = "0.3.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
-[[package]]
|
||||
-name = "miow"
|
||||
-version = "0.5.0"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "52ffbca2f655e33c08be35d87278e5b18b89550a37dbd598c20db92f6a471123"
|
||||
-dependencies = [
|
||||
- "windows-sys",
|
||||
-]
|
||||
-
|
||||
[[package]]
|
||||
name = "miri"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"colored",
|
||||
"env_logger 0.9.0",
|
||||
"getrandom 0.2.0",
|
||||
"lazy_static",
|
||||
@@ -4637,30 +4557,16 @@ dependencies = [
|
||||
"term",
|
||||
"thiserror",
|
||||
"toml",
|
||||
"unicode-segmentation",
|
||||
"unicode-width",
|
||||
"unicode_categories",
|
||||
]
|
||||
|
||||
-[[package]]
|
||||
-name = "rustix"
|
||||
-version = "0.36.3"
|
||||
-source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "0b1fbb4dfc4eb1d390c02df47760bb19a84bb80b301ecc947ab5406394d8223e"
|
||||
-dependencies = [
|
||||
- "bitflags",
|
||||
- "errno",
|
||||
- "io-lifetimes",
|
||||
- "libc",
|
||||
- "linux-raw-sys",
|
||||
- "windows-sys",
|
||||
-]
|
||||
-
|
||||
[[package]]
|
||||
name = "rustversion"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "61b3909d758bb75c79f23d4736fac9433868679d3ad2ea7a61e3c25cfda9a088"
|
||||
|
||||
[[package]]
|
||||
name = "ryu"
|
||||
@@ -4879,19 +4785,19 @@ checksum = "cc88c725d61fc6c3132893370cac4a0200e3fedf5da8331c570664b1987f5ca2"
|
||||
[[package]]
|
||||
name = "snap"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "da73c8f77aebc0e40c300b93f0a5f1bece7a248a36eee287d4e095f35c7b7d6e"
|
||||
|
||||
[[package]]
|
||||
name = "snapbox"
|
||||
-version = "0.4.1"
|
||||
+version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "827c00e91b15e2674d8a5270bae91f898693cbf9561cbb58d8eaa31974597293"
|
||||
+checksum = "44d199ccf8f606592df2d145db26f2aa45344e23c64b074cc5a4047f1d99b0f7"
|
||||
dependencies = [
|
||||
"concolor",
|
||||
"content_inspector",
|
||||
"dunce",
|
||||
"filetime",
|
||||
"normalize-line-endings",
|
||||
"similar",
|
||||
"snapbox-macros",
|
||||
@@ -5866,19 +5772,19 @@ version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xz2"
|
||||
-version = "0.1.6"
|
||||
+version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "c179869f34fc7c01830d3ce7ea2086bc3a07e0d35289b667d0a8bf910258926c"
|
||||
+checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
|
||||
dependencies = [
|
||||
"lzma-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yaml-merge-keys"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
diff --git a/src/bootstrap/Cargo.lock b/src/bootstrap/Cargo.lock
|
||||
index efe8ae3169f..ad115c46110 100644
|
||||
--- a/src/bootstrap/Cargo.lock
|
||||
+++ b/src/bootstrap/Cargo.lock
|
||||
@@ -346,19 +346,19 @@ version = "0.4.17"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lzma-sys"
|
||||
-version = "0.1.17"
|
||||
+version = "0.1.20"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "bdb4b7c3eddad11d3af9e86c487607d2d2442d185d848575365c4856ba96d619"
|
||||
+checksum = "5fda04ab3764e6cde78b9974eec4f779acaba7c4e84b36eca3cf77c581b85d27"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
"pkg-config",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
@@ -780,19 +780,19 @@ version = "0.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6d1526bbe5aaeb5eb06885f4d987bcdfa5e23187055de9b83fe00156a821fabc"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "xz2"
|
||||
-version = "0.1.6"
|
||||
+version = "0.1.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
-checksum = "c179869f34fc7c01830d3ce7ea2086bc3a07e0d35289b667d0a8bf910258926c"
|
||||
+checksum = "388c44dc09d76f1536602ead6d325eb532f5c122f17782bd57fb47baeeb767e2"
|
||||
dependencies = [
|
||||
"lzma-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yansi"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
diff --git a/src/bootstrap/Cargo.toml b/src/bootstrap/Cargo.toml
|
||||
index ccc7ec1fce9..6d5838439db 100644
|
||||
--- a/src/bootstrap/Cargo.toml
|
||||
+++ b/src/bootstrap/Cargo.toml
|
||||
@@ -46,17 +46,17 @@ object = { version = "0.29.0", default-features = false, features = ["archive",
|
||||
serde = { version = "1.0.8", features = ["derive"] }
|
||||
serde_json = "1.0.2"
|
||||
sha2 = "0.10"
|
||||
tar = "0.4"
|
||||
toml = "0.5"
|
||||
ignore = "0.4.10"
|
||||
opener = "0.5"
|
||||
once_cell = "1.7.2"
|
||||
-xz2 = "0.1"
|
||||
+xz2 = { version = "0.1", features = ["static"] }
|
||||
walkdir = "2"
|
||||
|
||||
# Dependencies needed by the build-metrics feature
|
||||
sysinfo = { version = "0.26.0", optional = true }
|
||||
|
||||
[target.'cfg(windows)'.dependencies.winapi]
|
||||
version = "0.3"
|
||||
features = [
|
||||
--
|
||||
2.38.0
|
||||
|
58
lang/rust/rust-host.mk
Normal file
58
lang/rust/rust-host.mk
Normal file
|
@ -0,0 +1,58 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2023 Luca Barbato and Donald Hoskins
|
||||
|
||||
# Rust Environmental Vars
|
||||
CONFIG_HOST_SUFFIX:=$(shell cut -d"-" -f4 <<<"$(GNU_HOST_NAME)")
|
||||
RUSTC_HOST_ARCH:=$(HOST_ARCH)-unknown-linux-$(CONFIG_HOST_SUFFIX)
|
||||
CARGO_HOME:=$(STAGING_DIR_HOST)/cargo
|
||||
|
||||
# Support only a subset for now.
|
||||
RUST_ARCH_DEPENDS:=@(aarch64||arm||i386||i686||mips||mipsel||mips64||mips64el||mipsel||powerpc64||x86_64)
|
||||
|
||||
# Common Build Flags
|
||||
RUST_BUILD_FLAGS = \
|
||||
CARGO_HOME="$(CARGO_HOME)"
|
||||
|
||||
# This adds the rust environmental variables to Make calls
|
||||
MAKE_FLAGS += $(RUST_BUILD_FLAGS)
|
||||
|
||||
# Force linking of the SSP library
|
||||
ifdef CONFIG_PKG_CC_STACKPROTECTOR_REGULAR
|
||||
ifeq ($(strip $(PKG_SSP)),1)
|
||||
RUSTC_LDFLAGS += -lssp_nonshared
|
||||
endif
|
||||
endif
|
||||
ifdef CONFIG_PKG_CC_STACKPROTECTOR_STRONG
|
||||
ifeq ($(strip $(PKG_SSP)),1)
|
||||
TARGET_CFLAGS += -lssp_nonshared
|
||||
endif
|
||||
endif
|
||||
|
||||
# mips64 openwrt has a specific targed in rustc
|
||||
ifeq ($(ARCH),mips64)
|
||||
RUSTC_TARGET_ARCH:=$(REAL_GNU_TARGET_NAME)
|
||||
else
|
||||
RUSTC_TARGET_ARCH:=$(subst openwrt,unknown,$(REAL_GNU_TARGET_NAME))
|
||||
endif
|
||||
|
||||
RUSTC_TARGET_ARCH:=$(subst muslgnueabi,musleabi,$(RUSTC_TARGET_ARCH))
|
||||
|
||||
ifeq ($(ARCH),i386)
|
||||
RUSTC_TARGET_ARCH:=$(subst i486,i586,$(RUSTC_TARGET_ARCH))
|
||||
endif
|
||||
|
||||
# ARM Logic
|
||||
ifeq ($(ARCH),arm)
|
||||
ifeq ($(CONFIG_arm_v7),y)
|
||||
RUSTC_TARGET_ARCH:=$(subst arm,armv7,$(RUSTC_TARGET_ARCH))
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_HAS_FPU),y)
|
||||
RUSTC_TARGET_ARCH:=$(subst musleabi,musleabihf,$(RUSTC_TARGET_ARCH))
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(ARCH),aarch64)
|
||||
RUST_CFLAGS:=-mno-outline-atomics
|
||||
endif
|
15
lang/rust/rust-package.mk
Normal file
15
lang/rust/rust-package.mk
Normal file
|
@ -0,0 +1,15 @@
|
|||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
#
|
||||
# Copyright (C) 2023 Luca Barbato and Donald Hoskins
|
||||
|
||||
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 Build/Compile/Cargo
|
||||
cd $(PKG_BUILD_DIR) && \
|
||||
export PATH="$(CARGO_HOME)/bin:$(PATH)" && \
|
||||
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
|
119
lang/rust/rust_config.mk
Normal file
119
lang/rust/rust_config.mk
Normal file
|
@ -0,0 +1,119 @@
|
|||
ifeq ($(CONFIG_RUST_DEBUG),y)
|
||||
CONFIGURE_ARGS += --enable-debug
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_DOCS),y)
|
||||
CONFIGURE_ARGS += --enable-docs
|
||||
else
|
||||
CONFIGURE_ARGS += --disable-docs
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_COMPILER_DOCS),y)
|
||||
CONFIGURE_ARGS += --enable-compiler-docs
|
||||
else
|
||||
CONFIGURE_ARGS += --disable-compiler-docs
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_OPTIMIZE_TESTS),y)
|
||||
CONFIGURE_ARGS += --enable-optimize-tests
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_PARALLEL),y)
|
||||
CONFIGURE_ARGS += --enable-parallel-compiler
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_VERBOSE_TESTS),y)
|
||||
CONFIGURE_ARGS += --enable-verbose-tests
|
||||
endif
|
||||
|
||||
ifeq ($(filter $(CONFIG_RUST_CCACHE) $(CCACHE),y),)
|
||||
CONFIGURE_ARGS += --enable-ccache
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_CCACHE),y)
|
||||
CONFIGURE_ARGS += --enable-ccache
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_LLVM_STATIC),y)
|
||||
CONFIGURE_ARGS += --enable-llvm-static-stdcpp
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_LLVM_SHARED),y)
|
||||
CONFIGURE_ARGS += --enable-llvm-link-shared
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_CODEGEN_TESTS),y)
|
||||
CONFIGURE_ARGS += --enable-codegen-tests
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_OPTION_CHECKING),y)
|
||||
CONFIGURE_ARGS += --enable-option-checking
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_ENABLE_NINJA),y)
|
||||
CONFIGURE_ARGS += --enable-ninja
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_LOCKED_DEPS),y)
|
||||
CONFIGURE_ARGS += --enable-locked-deps
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_VENDOR),y)
|
||||
CONFIGURE_ARGS += --enable-vendor
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_SANITIZERS),y)
|
||||
CONFIGURE_ARGS += --enable-sanitizers
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_DIST_SRC),y)
|
||||
CONFIGURE_ARGS += --enable-dist-src
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_CARGO_NATIVE_STATIC),y)
|
||||
CONFIGURE_ARGS += --enable-cargo-native-static
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_PROFILER),y)
|
||||
CONFIGURE_ARGS += --enable-profiler
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_FULL_TOOLS),y)
|
||||
CONFIGURE_ARGS += --enable-full-tools
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_MISSING_TOOLS),y)
|
||||
CONFIGURE_ARGS += --enable-missing-tools
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_USE_LIBCXX),y)
|
||||
CONFIGURE_ARGS += --enable-use-libcxx
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_CONTROL_FLOW_GUARD),y)
|
||||
CONFIGURE_ARGS += --enable-control-flow-guard
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_OPTIMIZE_LLVM),y)
|
||||
CONFIGURE_ARGS += --enable-optimize-llvm
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_LLVM_ASSERTIONS),y)
|
||||
CONFIGURE_ARGS += --enable-llvm-assertions
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_DEBUG_ASSERTIONS),y)
|
||||
CONFIGURE_ARGS += --enable-debug-assertions
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_LLVM_RELEASE_DEBUGINFO),y)
|
||||
CONFIGURE_ARGS += --enable-llvm-release-debuginfo
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_MANAGE_SUBMODULES),y)
|
||||
CONFIGURE_ARGS += --enable-manage-submodules
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_RUST_FULL_BOOTSTRAP),y)
|
||||
CONFIGURE_ARGS += --enable-full-bootstrap
|
||||
endif
|
Loading…
Reference in a new issue