diff --git a/pkgs/rust/build.sh b/pkgs/rust/build.sh index 0d01014..8dd0e0f 100644 --- a/pkgs/rust/build.sh +++ b/pkgs/rust/build.sh @@ -15,7 +15,6 @@ # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. pkgname=rust -pkgver=1.49.0 pkgver=nightly @@ -36,7 +35,10 @@ fetch() { patch -p1 < ../abyss-libunwind.patch patch -p1 < ../abyss-libz.patch patch -p1 < ../vendored-ssl.patch +# patch -p1 < ../openbsd-libressl.patch patch -p1 < ../alpine-crt.patch + patch -p1 < ../libexec.patch + patch -p1 < ../llvm_crt.patch sed -i /LD_LIBRARY_PATH/d src/bootstrap/bootstrap.py _clear_vendor_checksums libc @@ -56,13 +58,13 @@ build() { --host="x86_64-unknown-linux-musl" \ --target="x86_64-unknown-linux-musl" \ --prefix="/usr" \ - --release-channel="stable" \ + --release-channel="nightly" \ --enable-local-rust \ --local-rust-root="/usr" \ --llvm-root="/usr" \ --disable-docs \ --enable-extended \ - --tools="cargo" \ + --tools="cargo,rls,rustfmt" \ --enable-vendor \ --enable-locked-deps \ --enable-llvm-link-shared \ diff --git a/pkgs/rust/libexec.patch b/pkgs/rust/libexec.patch new file mode 100644 index 0000000..1675db4 --- /dev/null +++ b/pkgs/rust/libexec.patch @@ -0,0 +1,22 @@ +--- a/src/bootstrap/dist.rs ++++ b/src/bootstrap/dist.rs +@@ -980,7 +980,7 @@ + for dirent in fs::read_dir(cargo.parent().unwrap()).expect("read_dir") { + let dirent = dirent.expect("read dir entry"); + if dirent.file_name().to_str().expect("utf8").starts_with("cargo-credential-") { +- tarball.add_file(&dirent.path(), "libexec", 0o755); ++ tarball.add_file(&dirent.path(), "lib", 0o755); + } + } + +--- a/src/tools/cargo/src/cargo/ops/registry/auth.rs ++++ b/src/tools/cargo/src/cargo/ops/registry/auth.rs +@@ -223,7 +223,7 @@ + .parent() + .and_then(|p| p.parent()) + .ok_or_else(|| format_err!("expected cargo path {}", cargo.display()))?; +- let exe = root.join("libexec").join(format!( ++ let exe = root.join("lib").join(format!( + "cargo-credential-{}{}", + cred_name, + std::env::consts::EXE_SUFFIX diff --git a/pkgs/rust/llvm_crt.patch b/pkgs/rust/llvm_crt.patch new file mode 100644 index 0000000..560de69 --- /dev/null +++ b/pkgs/rust/llvm_crt.patch @@ -0,0 +1,32 @@ +--- a/src/bootstrap/compile.rs ++++ b/src/bootstrap/compile.rs +@@ -197,7 +197,7 @@ + DependencyType::TargetSelfContained, + ); + } +- for &obj in &["crtbegin.o", "crtbeginS.o", "crtend.o", "crtendS.o"] { ++ for &obj in &["clang_rt.crtbegin-x86_64.o", "clang_rt.crtend-x86_64.o"] { + let src = compiler_file(builder, builder.cc(target), target, obj); + let target = libdir_self_contained.join(obj); + builder.copy(&src, &target); +--- a/compiler/rustc_target/src/spec/crt_objects.rs ++++ a/compiler/rustc_target/src/spec/crt_objects.rs +@@ -64,12 +64,12 @@ + + pub(super) fn pre_musl_fallback() -> CrtObjects { + new(&[ +- (LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]), +- (LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o", "crtbeginS.o"]), +- (LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o", "crtbegin.o"]), +- (LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o", "crtbeginS.o"]), +- (LinkOutputKind::DynamicDylib, &["crti.o", "crtbeginS.o"]), +- (LinkOutputKind::StaticDylib, &["crti.o", "crtbeginS.o"]), ++ (LinkOutputKind::DynamicNoPicExe, &["crt1.o", "crti.o", "clang_rt.crtbegin-x86_64.o"]), ++ (LinkOutputKind::DynamicPicExe, &["Scrt1.o", "crti.o", "clang_rt.crtbegin-x86_64.o"]), ++ (LinkOutputKind::StaticNoPicExe, &["crt1.o", "crti.o", "clang_rt.crtbegin-x86_64.o"]), ++ (LinkOutputKind::StaticPicExe, &["rcrt1.o", "crti.o", "clang_rt.crtbegin-x86_64.o"]), ++ (LinkOutputKind::DynamicDylib, &["crti.o", "clang_rt.crtbegin-x86_64.o"]), ++ (LinkOutputKind::StaticDylib, &["crti.o", "clang_rt.crtbegin-x86_64.o"]), + ]) + } + diff --git a/pkgs/rust/openbsd-libressl.patch b/pkgs/rust/openbsd-libressl.patch new file mode 100644 index 0000000..76c3ce3 --- /dev/null +++ b/pkgs/rust/openbsd-libressl.patch @@ -0,0 +1,14 @@ +$OpenBSD: patch-vendor_openssl-sys_build_main_rs,v 1.5 2020/11/05 09:21:34 semarie Exp $ +The LibreSSL version in -current isn't explicitly supported. +Index: vendor/openssl-sys/build/main.rs +--- a/vendor/openssl-sys/build/main.rs.orig ++++ b/vendor/openssl-sys/build/main.rs +@@ -221,7 +221,7 @@ See rust-openssl README for more information: + (3, 1, 0) => ('3', '1', '0'), + (3, 1, _) => ('3', '1', 'x'), + (3, 2, 0) => ('3', '2', '0'), +- _ => version_error(), ++ _ => ('3', '2', '0'), + }; + + println!("cargo:libressl=true");