rust: update to 1.70.0

This commit is contained in:
Marcin Puc 2023-05-31 00:36:10 +02:00 committed by classabbyamp
parent 41de58e839
commit cdd0c0659b
6 changed files with 124 additions and 158 deletions

1
srcpkgs/rust-src Symbolic link
View file

@ -0,0 +1 @@
rust

View file

@ -4,17 +4,6 @@ Date: Sun, 3 May 2020 17:53:33 +0200
Subject: [PATCH 02/15] Remove -nostdlib and musl_root from musl targets
extended by various void contributors to match our musl setup
---
compiler/rustc_target/src/spec/crt_objects.rs | 22 ----------
.../rustc_target/src/spec/linux_musl_base.rs | 7 ---
config.toml.example | 8 ----
src/bootstrap/cc_detect.rs | 25 +----------
src/bootstrap/compile.rs | 43 +------------------
src/bootstrap/config.rs | 9 ----
src/bootstrap/configure.py | 28 ------------
src/bootstrap/lib.rs | 19 --------
src/bootstrap/sanity.rs | 23 ----------
9 files changed, 3 insertions(+), 181 deletions(-)
diff --git a/compiler/rustc_target/src/spec/crt_objects.rs b/compiler/rustc_target/src/spec/crt_objects.rs
index c126390f5..7aef73d3b 100644
@ -70,13 +59,13 @@ index 61553e71b..88f807a58 100644
base
}
diff --git a/config.toml.example b/config.toml.example
index ca54cbd2d..beec9bb04 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -540,14 +540,6 @@ changelog-seen = 2
diff --git a/config.example.toml b/config.example.toml
index 6d9c762ce..7a1375d8a 100644
--- a/config.example.toml
+++ b/config.example.toml
@@ -556,14 +556,6 @@ changelog-seen = 2
# behavior -- this may lead to miscompilations or other bugs.
#description = <none> (string)
#description = ""
-# The root location of the musl installation directory. The library directory
-# will also need to contain libunwind.a for an unwinding implementation. Note
@ -90,10 +79,10 @@ index ca54cbd2d..beec9bb04 100644
# platforms to ensure that the compiler is usable by default from the build
# directory (as it links to a number of dynamic libraries). This may not be
diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs
index 7128d542a..668245f3c 100644
index 65c882fb8..f35a92821 100644
--- a/src/bootstrap/cc_detect.rs
+++ b/src/bootstrap/cc_detect.rs
@@ -101,7 +101,7 @@ pub fn find(build: &mut Build) {
@@ -103,7 +103,7 @@ pub fn find(build: &mut Build) {
if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
cfg.compiler(cc);
} else {
@ -102,7 +91,7 @@ index 7128d542a..668245f3c 100644
}
let compiler = cfg.get_compiler();
@@ -122,7 +122,7 @@ pub fn find(build: &mut Build) {
@@ -124,7 +124,7 @@ pub fn find(build: &mut Build) {
cfg.compiler(cxx);
true
} else if build.hosts.contains(&target) || build.build == target {
@ -111,7 +100,7 @@ index 7128d542a..668245f3c 100644
true
} else {
// Use an auto-detected compiler (or one configured via `CXX_target_triple` env vars).
@@ -158,7 +158,6 @@ fn set_compiler(
@@ -160,7 +160,6 @@ fn set_compiler(
compiler: Language,
target: TargetSelection,
config: Option<&Target>,
@ -119,7 +108,7 @@ index 7128d542a..668245f3c 100644
) {
match &*target.triple {
// When compiling for android we may have the NDK configured in the
@@ -194,26 +193,6 @@ fn set_compiler(
@@ -196,26 +195,6 @@ fn set_compiler(
}
}
@ -147,10 +136,10 @@ index 7128d542a..668245f3c 100644
}
}
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 0deed3f99..0bddac5d1 100644
index 4a4e7adcb..f2cdc4a07 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -228,39 +228,7 @@ fn copy_self_contained_objects(
@@ -246,39 +246,7 @@ fn copy_self_contained_objects(
let mut target_deps = vec![];
// Copies the libc and CRT objects.
@ -174,7 +163,7 @@ index 0deed3f99..0bddac5d1 100644
- DependencyType::TargetSelfContained,
- );
- }
- let crt_path = builder.ensure(native::CrtBeginEnd { target });
- let crt_path = builder.ensure(llvm::CrtBeginEnd { target });
- for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] {
- let src = crt_path.join(obj);
- let target = libdir_self_contained.join(obj);
@ -191,7 +180,7 @@ index 0deed3f99..0bddac5d1 100644
let srcdir = builder
.wasi_root(target)
.unwrap_or_else(|| {
@@ -344,15 +312,6 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
@@ -375,15 +343,6 @@ pub fn std_cargo(builder: &Builder<'_>, target: TargetSelection, stage: u32, car
.arg("--manifest-path")
.arg(builder.src.join("library/test/Cargo.toml"));
@ -208,10 +197,10 @@ index 0deed3f99..0bddac5d1 100644
if let Some(p) = builder.wasi_root(target) {
let root = format!("native={}/lib/wasm32-wasi", p.to_str().unwrap());
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index d8c15c76e..53f95e49b 100644
index cc3b3bc25..eb472c5e8 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -200,7 +200,6 @@ pub struct Config {
@@ -210,7 +210,6 @@ pub struct Config {
pub missing_tools: bool,
// Fallback musl-root for all targets
@ -219,7 +208,7 @@ index d8c15c76e..53f95e49b 100644
pub prefix: Option<PathBuf>,
pub sysconfdir: Option<PathBuf>,
pub datadir: Option<PathBuf>,
@@ -440,8 +439,6 @@ pub struct Target {
@@ -456,8 +455,6 @@ pub struct Target {
pub sanitizers: Option<bool>,
pub profiler: Option<bool>,
pub crt_static: Option<bool>,
@ -228,7 +217,7 @@ index d8c15c76e..53f95e49b 100644
pub wasi_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
pub no_std: bool,
@@ -734,7 +731,6 @@ define_config! {
@@ -753,7 +750,6 @@ define_config! {
default_linker: Option<String> = "default-linker",
channel: Option<String> = "channel",
description: Option<String> = "description",
@ -236,7 +225,7 @@ index d8c15c76e..53f95e49b 100644
rpath: Option<bool> = "rpath",
verbose_tests: Option<bool> = "verbose-tests",
optimize_tests: Option<bool> = "optimize-tests",
@@ -781,8 +777,6 @@ define_config! {
@@ -801,8 +797,6 @@ define_config! {
sanitizers: Option<bool> = "sanitizers",
profiler: Option<bool> = "profiler",
crt_static: Option<bool> = "crt-static",
@ -245,7 +234,7 @@ index d8c15c76e..53f95e49b 100644
wasi_root: Option<String> = "wasi-root",
qemu_rootfs: Option<String> = "qemu-rootfs",
no_std: Option<bool> = "no-std",
@@ -1187,7 +1181,6 @@ impl Config {
@@ -1133,7 +1127,6 @@ impl Config {
set(&mut config.llvm_tools_enabled, rust.llvm_tools);
config.rustc_parallel = rust.parallel_compiler.unwrap_or(false);
config.rustc_default_linker = rust.default_linker;
@ -253,7 +242,7 @@ index d8c15c76e..53f95e49b 100644
config.save_toolstates = rust.save_toolstates.map(PathBuf::from);
set(&mut config.deny_warnings, flags.deny_warnings.or(rust.deny_warnings));
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
@@ -1251,8 +1244,6 @@ impl Config {
@@ -1293,8 +1286,6 @@ impl Config {
target.ranlib = cfg.ranlib.map(PathBuf::from);
target.linker = cfg.linker.map(PathBuf::from);
target.crt_static = cfg.crt_static;
@ -263,10 +252,10 @@ index d8c15c76e..53f95e49b 100644
target.qemu_rootfs = cfg.qemu_rootfs.map(PathBuf::from);
target.sanitizers = cfg.sanitizers;
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 6b139decb..a2e19b8f4 100755
index abd28b400..6f0f8d879 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -112,34 +112,6 @@ v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk",
@@ -111,34 +111,6 @@ v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk",
"aarch64-linux-android NDK standalone path")
v("x86_64-linux-android-ndk", "target.x86_64-linux-android.android-ndk",
"x86_64-linux-android NDK standalone path")
@ -302,10 +291,10 @@ index 6b139decb..a2e19b8f4 100755
"rootfs in qemu testing, you probably don't want to use this")
v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 3ed534523..c7c7a75f0 100644
index 419bcbc63..dc98f5197 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1181,25 +1181,6 @@ impl Build {
@@ -1139,25 +1139,6 @@ impl Build {
}
}

View file

@ -3,18 +3,11 @@ From: Daniel Kolesa <daniel@octaforge.org>
Date: Mon, 20 Dec 2021 00:45:35 +0100
Subject: [PATCH 03/15] move debugger scripts to /usr/share/rust
---
src/bootstrap/dist.rs | 2 +-
src/etc/rust-gdb | 2 +-
src/etc/rust-gdbgui | 2 +-
src/etc/rust-lldb | 4 ++--
4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs
index b1fae356d..e7a077134 100644
index 76aad16c1..db53459e8 100644
--- a/src/bootstrap/dist.rs
+++ b/src/bootstrap/dist.rs
@@ -460,7 +460,7 @@ impl Step for DebuggerScripts {
@@ -528,7 +528,7 @@ impl Step for DebuggerScripts {
fn run(self, builder: &Builder<'_>) {
let host = self.host;
let sysroot = self.sysroot;
@ -24,7 +17,7 @@ index b1fae356d..e7a077134 100644
let cp_debugger_script = |file: &str| {
builder.install(&builder.src.join("src/etc/").join(file), &dst, 0o644);
diff --git a/src/etc/rust-gdb b/src/etc/rust-gdb
index b950cea79..559bfe3f1 100755
index 9abed30ea..4c7f953ed 100755
--- a/src/etc/rust-gdb
+++ b/src/etc/rust-gdb
@@ -12,7 +12,7 @@ fi
@ -33,11 +26,11 @@ index b950cea79..559bfe3f1 100755
RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
-GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
+GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/share/rust"
# Get the commit hash for path remapping
RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \([a-zA-Z0-9_]*\)/\1/p')"
# Run GDB with the additional arguments that load the pretty printers
# Set the environment variable `RUST_GDB` to overwrite the call to a
diff --git a/src/etc/rust-gdbgui b/src/etc/rust-gdbgui
index 9744913b6..8722acdcc 100755
index 913269316..f444fbc4b 100755
--- a/src/etc/rust-gdbgui
+++ b/src/etc/rust-gdbgui
@@ -41,7 +41,7 @@ fi
@ -46,9 +39,9 @@ index 9744913b6..8722acdcc 100755
RUSTC_SYSROOT="$("$RUSTC" --print=sysroot)"
-GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/lib/rustlib/etc"
+GDB_PYTHON_MODULE_DIRECTORY="$RUSTC_SYSROOT/share/rust"
# Get the commit hash for path remapping
RUSTC_COMMIT_HASH="$("$RUSTC" -vV | sed -n 's/commit-hash: \([a-zA-Z0-9_]*\)/\1/p')"
# Set the environment variable `RUST_GDB` to overwrite the call to a
# different/specific command (defaults to `gdb`).
diff --git a/src/etc/rust-lldb b/src/etc/rust-lldb
index bce72f1ba..8abb01245 100755
--- a/src/etc/rust-lldb
@ -64,6 +57,3 @@ index bce72f1ba..8abb01245 100755
# Call LLDB with the commands added to the argument list
exec "$lldb" --one-line-before-file "$script_import" --source-before-file "$commands_file" "$@"
--
2.37.2

View file

@ -3,20 +3,13 @@ From: Daniel Kolesa <daniel@octaforge.org>
Date: Mon, 20 Dec 2021 00:55:18 +0100
Subject: [PATCH 04/15] fix shebang on install-template.sh
---
src/tools/rust-installer/install-template.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/tools/rust-installer/install-template.sh b/src/tools/rust-installer/install-template.sh
index e68be8911..beaa90f7b 100644
index 92a3f1f2c..fca281191 100644
--- a/src/tools/rust-installer/install-template.sh
+++ b/src/tools/rust-installer/install-template.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
# Copyright 2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
--
2.37.2
# No undefined variables
set -u

View file

@ -3,29 +3,23 @@ From: q66 <daniel@octaforge.org>
Date: Sun, 3 May 2020 18:02:03 +0200
Subject: [PATCH 10/15] Fix dynamic linkage of musl libc for the libc crate
---
vendor/libc/src/unix/mod.rs | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/vendor/libc/src/unix/mod.rs b/vendor/libc/src/unix/mod.rs
index ecee44411..7ae05f24e 100644
index b005970b9..c53093a09 100644
--- a/vendor/libc/src/unix/mod.rs
+++ b/vendor/libc/src/unix/mod.rs
@@ -337,11 +337,11 @@ cfg_if! {
@@ -351,7 +351,14 @@ cfg_if! {
#[link(name = "dl", cfg(not(target_feature = "crt-static")))]
#[link(name = "c", cfg(not(target_feature = "crt-static")))]
extern {}
} else if #[cfg(target_env = "musl")] {
- } else if #[cfg(any(target_env = "musl", target_env = "ohos"))] {
+ } else if #[cfg(target_env = "musl")] {
+ #[link(name = "c")]
+ extern {}
#[cfg_attr(feature = "rustc-dep-of-std",
- link(name = "c", kind = "static", modifiers = "-bundle",
+ #[cfg_attr(feature = "rustc-dep-of-std",
+ link(name = "gcc", kind = "static", modifiers = "-bundle",
+ cfg(target_feature = "crt-static")))]
+ extern {}
+ } else if #[cfg(target_env = "ohos")] {
#[cfg_attr(feature = "rustc-dep-of-std",
link(name = "c", kind = "static", modifiers = "-bundle",
cfg(target_feature = "crt-static")))]
- #[cfg_attr(feature = "rustc-dep-of-std",
- link(name = "c", cfg(not(target_feature = "crt-static"))))]
extern {}
} else if #[cfg(target_os = "emscripten")] {
#[link(name = "c")]
--
2.37.2

View file

@ -8,7 +8,7 @@
# uploaded to https://repo-default.voidlinux.org/distfiles/
#
pkgname=rust
version=1.69.0
version=1.70.0
revision=1
hostmakedepends="cmake curl pkg-config python3 tar cargo-bootstrap"
makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm15"
@ -18,9 +18,10 @@ maintainer="Enno Boland <gottox@voidlinux.org>"
license="MIT, Apache-2.0"
homepage="https://www.rust-lang.org/"
distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"
checksum=fb05971867ad6ccabbd3720279f5a94b99f61024923187b56bb5c455fa3cf60f
checksum=b2bfae000b7a5040e4ec4bbc50a09f21548190cb7570b0ed77358368413bd27c
lib32disabled=yes
make_check=no # CBA for now
python_version=3 # needed for python files in rust-src
build_options="bindist"
desc_option_bindist="Generate tarballs for bootstrap"
@ -70,97 +71,85 @@ post_patch() {
}
do_configure() {
local _local_rebuild _use_debug _use_debug_rustc _use_rpath _use_docs _llvm_shared
local _local_rebuild _debug _debug_rustc _rpath _docs _llvm_shared
local _cross_args
if [ "$CROSS_BUILD" ]; then
_local_rebuild="true"
_local_rebuild="enable"
else
_local_rebuild="false"
_local_rebuild="disable"
fi
# disable rustc debug info as it bloats up rust-std significantly
# set to 1 or 2 if you wish to have debug info for rustc, it won't
# link on 32-bit platforms though (too big)
_use_debug_rustc="0"
_debug_rustc="0"
# just disable debug for now
_use_debug="0"
_debug="0"
# if true, the binaries will be built with rpath, so the binaries will be
# usable directly from the build directory, this is not desirable for
# packaging but is useful when building bootstrap binaries
if [ "$build_option_bindist" ]; then
_use_rpath="true"
_use_docs="false"
_llvm_shared="false"
_rpath="enable"
_docs="disable"
_llvm_shared="disable"
else
_use_rpath="false"
_use_docs="true"
_llvm_shared="true"
_rpath="disable"
_docs="enable"
_llvm_shared="enable"
fi
cat > config.toml <<- EOF
changelog-seen = 2
[llvm]
ninja = false
link-shared = ${_llvm_shared}
[build]
build = "${RUST_BUILD}"
host = [ "${RUST_TARGET}" ]
target = [ "${RUST_TARGET}" ]
cargo = "/usr/bin/cargo"
rustc = "/usr/bin/rustc"
submodules = false
python = "python3"
locked-deps = true
vendor = true
full-bootstrap = false
local-rebuild = ${_local_rebuild}
extended = false
docs = ${_use_docs}
tools = []
[install]
prefix = "/usr"
[rust]
optimize = true
debug = false
codegen-units = 1
codegen-units-std = 1
debuginfo-level = ${_use_debug}
debuginfo-level-rustc = ${_use_debug_rustc}
debuginfo-level-tests = 0
incremental = false
parallel-compiler = false
channel = "stable"
description = "Void Linux"
rpath = ${_use_rpath}
verbose-tests = true
dist-src = false
jemalloc = false
llvm-libunwind = "no"
codegen-tests = false
[dist]
src-tarball = false
[target.${RUST_BUILD}]
llvm-config = "/usr/bin/llvm-config"
crt-static = false
cc = "${CC_host:-$CC}"
cxx = "${CXX_host:-$CXX}"
ar = "${AR_host:-$AR}"
linker = "${CC_host:-$CC}"
EOF
if [ "$CROSS_BUILD" ]; then
cat >> config.toml <<- EOF
[target.${RUST_TARGET}]
llvm-config = "/usr/bin/llvm-config"
crt-static = false
cc = "${CC}"
cxx = "${CXX}"
ar = "${AR}"
linker = "${CC}"
sysroot = "${XBPS_CROSS_BASE}"
EOF
_cross_args="--set=target.${RUST_TARGET}.llvm-config=/usr/bin/llvm-config
--set=target.${RUST_TARGET}.crt-static=false
--set=target.${RUST_TARGET}.cc=${CC}
--set=target.${RUST_TARGET}.cxx=${CXX}
--set=target.${RUST_TARGET}.ar=${AR}
--set=target.${RUST_TARGET}.linker=${CC}"
fi
./configure \
--build="${RUST_BUILD}" \
--host="${RUST_TARGET}" \
--target="${RUST_TARGET}" \
--prefix=/usr \
--python=python3 \
--enable-vendor \
--enable-locked-deps \
--enable-verbose-tests \
--disable-full-bootstrap \
--disable-extended \
--disable-codegen-tests \
--disable-dist-src \
--${_llvm_shared}-llvm-link-shared \
--${_rpath}-rpath \
--${_local_rebuild}-local-rebuild \
--${_docs}-docs \
--debuginfo-level="${_debug}" \
--debuginfo-level-rustc="${_debug_rustc}" \
--debuginfo-level-tests=0 \
--release-channel=stable \
--release-description="Void Linux" \
--llvm-libunwind=no \
--llvm-config=/usr/bin/llvm-config \
--set="rust.optimize=true" \
--set="rust.debug=false" \
--set="rust.codegen-units=1" \
--set="rust.codegen-units-std=1" \
--set="rust.incremental=false" \
--set="rust.parallel-compiler=false" \
--set="rust.jemalloc=false" \
--set="build.submodules=false" \
--set="build.rustc=/usr/bin/rustc" \
--set="build.cargo=/usr/bin/cargo" \
--set="target.${RUST_BUILD}.crt-static=false" \
--set="target.${RUST_BUILD}.cc=${CC_host:-$CC}" \
--set="target.${RUST_BUILD}.cxx=${CXX_host:-$CXX}" \
--set="target.${RUST_BUILD}.ar=${AR_host:-$AR}" \
--set="target.${RUST_BUILD}.linker=${CC_host:-$CC}" \
--set="dist.src-tarball=false" \
${_cross_args}
}
# Set the correct CFLAGS for the build host, we have to compile libbacktrace
@ -213,6 +202,8 @@ do_install() {
-C "$DESTDIR/usr/lib" --strip-components=3 --exclude=manifest.in
tar xf build/dist/rust-docs-${version}-${RUST_TARGET}.tar.gz \
-C "$DESTDIR/usr" --strip-components=2 --exclude=manifest.in
tar xf build/dist/rust-src-${version}.tar.gz \
-C "$DESTDIR/usr" --strip-components=2 --exclude=manifest.in
vlicense COPYRIGHT
vlicense LICENSE-APACHE
@ -237,6 +228,14 @@ rust-std_package() {
depends="libexecinfo-devel"
fi
pkg_install() {
vmove usr/lib/rustlib
vmove usr/lib/rustlib/${RUST_TARGET}
vmove usr/lib/rustlib/rustc-src
}
}
rust-src_package() {
short_desc+=" - source code"
pkg_install() {
vmove usr/lib/rustlib/src
}
}