diff --git a/testing/rust/build b/testing/rust/build new file mode 100755 index 00000000..06c3f798 --- /dev/null +++ b/testing/rust/build @@ -0,0 +1,67 @@ +#!/bin/sh -e + +for patch in *.patch; do + patch -p1 < "$patch" +done + +# This package mimics the download process of rust's 'x.py' +# bootstrap library to allow for the removal of the internet +# connection requirement per build. +{ + mkdir -p "${cache_dir:=build/cache/2020-06-04}" + + for tarball in *.tar.xz\?no-extract; do + mv -f "$tarball" "$cache_dir/${tarball%%\?no-extract}" + done +} + +# 'rust' checksums files in 'vendor/', but we patch a few. +for vendor in libc openssl-sys; do + sed -i 's/\("files":{\)[^}]*/\1/' "vendor/$vendor/.cargo-checksum.json" +done + +cat > config.toml < ('3', '0', '0'), + (3, 0, 1) => ('3', '0', '1'), + (3, 0, _) => ('3', '0', 'x'), ++ (3, 1, 0) => ('3', '1', '0'), ++ (3, 1, 1) => ('3', '1', '0'), ++ (3, 1, _) => ('3', '1', 'x'), ++ (3, 2, 0) => ('3', '2', '0'), ++ (3, 2, 1) => ('3', '2', '0'), ++ (3, 2, _) => ('3', '2', 'x'), + _ => version_error(), + }; + diff --git a/testing/rust/patches/musl.patch b/testing/rust/patches/musl.patch new file mode 100644 index 00000000..d3d90ef8 --- /dev/null +++ b/testing/rust/patches/musl.patch @@ -0,0 +1,78 @@ +diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs +index b3999118e..f809a8e99 100644 +--- a/src/bootstrap/compile.rs ++++ b/src/bootstrap/compile.rs +@@ -132,7 +132,7 @@ fn copy_third_party_objects( + // to using gcc from a glibc-targeting toolchain for linking. + // To do that we have to distribute musl startup objects as a part of Rust toolchain + // and link with them manually in the self-contained mode. +- if target.contains("musl") { ++ if target.contains("noop") { + let srcdir = builder.musl_root(target).unwrap().join("lib"); + for &obj in &["crt1.o", "Scrt1.o", "rcrt1.o", "crti.o", "crtn.o"] { + copy_and_stamp(&srcdir, obj); +diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs +index 74b47d077..b700f8a09 100644 +--- a/src/bootstrap/sanity.rs ++++ b/src/bootstrap/sanity.rs +@@ -192,7 +192,7 @@ pub fn check(build: &mut Build) { + } + + // Make sure musl-root is valid +- if target.contains("musl") { ++ if target.contains("noop") { + // If this is a native target (host is also musl) and no musl-root is given, + // fall back to the system toolchain in /usr before giving up + if build.musl_root(*target).is_none() && build.config.build == *target { +diff --git a/src/librustc_target/spec/linux_musl_base.rs b/src/librustc_target/spec/linux_musl_base.rs +index 0fdd87608..63f00585f 100644 +--- a/src/librustc_target/spec/linux_musl_base.rs ++++ b/src/librustc_target/spec/linux_musl_base.rs +@@ -15,7 +15,7 @@ pub fn opts() -> TargetOptions { + base.crt_objects_fallback = Some(CrtObjectsFallback::Musl); + + // These targets statically link libc by default +- base.crt_static_default = true; ++ base.crt_static_default = false; + // These targets allow the user to choose between static and dynamic linking. + base.crt_static_respected = true; + +diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs +index 146263925..c9aa30e2d 100644 +--- a/src/libunwind/build.rs ++++ b/src/libunwind/build.rs +@@ -10,7 +10,7 @@ fn main() { + // Build the unwinding from libunwind C/C++ source code. + llvm_libunwind::compile(); + } else if target.contains("linux") { +- if target.contains("musl") { ++ if target.contains("noop") { + // linking for musl is handled in lib.rs + llvm_libunwind::compile(); + } else if !target.contains("android") { +diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs +index cc025da1a..0506db514 100644 +--- a/src/libunwind/lib.rs ++++ b/src/libunwind/lib.rs +@@ -18,7 +18,7 @@ cfg_if::cfg_if! { + } + } + +-#[cfg(target_env = "musl")] ++#[cfg(target_env = "noop")] + #[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))] + #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))] + extern "C" {} +diff --git a/vendor/libc/src/unix/mod.rs b/vendor/libc/src/unix/mod.rs +index 1084d9aa9..085c7ff9e 100644 +--- a/vendor/libc/src/unix/mod.rs ++++ b/vendor/libc/src/unix/mod.rs +@@ -302,7 +302,7 @@ cfg_if! { + } else if #[cfg(feature = "std")] { + // cargo build, don't pull in anything extra as the libstd dep + // already pulls in all libs. +- } else if #[cfg(target_env = "musl")] { ++ } else if #[cfg(target_env = "noop")] { + #[cfg_attr(feature = "rustc-dep-of-std", + link(name = "c", kind = "static", + cfg(target_feature = "crt-static")))] diff --git a/testing/rust/sources b/testing/rust/sources new file mode 100644 index 00000000..63d3f979 --- /dev/null +++ b/testing/rust/sources @@ -0,0 +1,6 @@ +https://static.rust-lang.org/dist/rustc-1.45.2-src.tar.xz +https://static.rust-lang.org/dist/2020-06-04/rust-std-1.44.0-x86_64-unknown-linux-musl.tar.xz?no-extract +https://static.rust-lang.org/dist/2020-06-04/rustc-1.44.0-x86_64-unknown-linux-musl.tar.xz?no-extract +https://static.rust-lang.org/dist/2020-06-04/cargo-0.45.0-x86_64-unknown-linux-musl.tar.xz?no-extract +patches/musl.patch +patches/libressl-3.1.X.patch diff --git a/testing/rust/version b/testing/rust/version new file mode 100644 index 00000000..6662aeb5 --- /dev/null +++ b/testing/rust/version @@ -0,0 +1 @@ +1.45.2 1