aboutsummaryrefslogtreecommitdiff
path: root/rust
diff options
context:
space:
mode:
Diffstat (limited to 'rust')
-rw-r--r--rust/.checksum7
-rw-r--r--rust/.files114
-rw-r--r--rust/abuild102
-rw-r--r--rust/depends1
-rw-r--r--rust/fix-curl.patch39
-rw-r--r--rust/fix-linux_musl_base.patch65
-rw-r--r--rust/libressl.patch408
7 files changed, 736 insertions, 0 deletions
diff --git a/rust/.checksum b/rust/.checksum
new file mode 100644
index 00000000..54d0aacb
--- /dev/null
+++ b/rust/.checksum
@@ -0,0 +1,7 @@
+ca7742d493604e180b27d98bf461d550140cee343b4fd0a9f39b86ea87441f2c cargo-1.85.0-x86_64-unknown-linux-musl.tar.xz
+c3a18c929b155d8fd1484d2d9cef917deebc8c34ea2cb476a84ac2fb4f323840 fix-curl.patch
+98cd52ea1add75f87899eda742c302404eea756a27d9a62b6bb318db0c6b34ac fix-linux_musl_base.patch
+0913269633249b1b02d2a9dd7f933c776da2f8bd33d353bf0babc4a8dfd4de3e libressl.patch
+87d4ec8089bfcf5449bd8482e86ef668e2c4fd9fc52c3c374a11dd9d5f4dd79d rust-std-1.85.0-x86_64-unknown-linux-musl.tar.xz
+30e6cc202b9ad0180fc66deebddc1232350ddc92b947c4430e55ad96638779ab rustc-1.85.0-x86_64-unknown-linux-musl.tar.xz
+5bd02dd4e25b96b42a0c5b7ab25d51eb4db7760b412b4a5e2285237900d5a20b rustc-1.86.0-src.tar.xz
diff --git a/rust/.files b/rust/.files
new file mode 100644
index 00000000..ba54e642
--- /dev/null
+++ b/rust/.files
@@ -0,0 +1,114 @@
+drwxr-xr-x root/root etc/
+drwxr-xr-x root/root etc/bash_completion.d/
+-rw-r--r-- root/root etc/bash_completion.d/cargo.new
+drwxr-xr-x root/root usr/
+drwxr-xr-x root/root usr/bin/
+-rwxr-xr-x root/root usr/bin/cargo
+-rwxr-xr-x root/root usr/bin/cargo-fmt
+-rwxr-xr-x root/root usr/bin/rust-gdb
+-rwxr-xr-x root/root usr/bin/rust-gdbgui
+-rwxr-xr-x root/root usr/bin/rust-lldb
+-rwxr-xr-x root/root usr/bin/rustc
+-rwxr-xr-x root/root usr/bin/rustfmt
+drwxr-xr-x root/root usr/lib/
+-rw-r--r-- root/root usr/lib/librustc_driver-ec077a736098b7c9.so
+drwxr-xr-x root/root usr/lib/rustlib/
+-rw-r--r-- root/root usr/lib/rustlib/components
+drwxr-xr-x root/root usr/lib/rustlib/etc/
+-rw-r--r-- root/root usr/lib/rustlib/etc/gdb_load_rust_pretty_printers.py
+-rw-r--r-- root/root usr/lib/rustlib/etc/gdb_lookup.py
+-rw-r--r-- root/root usr/lib/rustlib/etc/gdb_providers.py
+-rw-r--r-- root/root usr/lib/rustlib/etc/lldb_commands
+-rw-r--r-- root/root usr/lib/rustlib/etc/lldb_lookup.py
+-rw-r--r-- root/root usr/lib/rustlib/etc/lldb_providers.py
+-rw-r--r-- root/root usr/lib/rustlib/etc/rust_types.py
+-rw-r--r-- root/root usr/lib/rustlib/install.log
+-rw-r--r-- root/root usr/lib/rustlib/manifest-cargo
+-rw-r--r-- root/root usr/lib/rustlib/manifest-rust-std-x86_64-unknown-linux-musl
+-rw-r--r-- root/root usr/lib/rustlib/manifest-rustc
+-rw-r--r-- root/root usr/lib/rustlib/manifest-rustfmt-preview
+-rw-r--r-- root/root usr/lib/rustlib/rust-installer-version
+drwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/
+drwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/bin/
+drwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/bin/gcc-ld/
+-rwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/bin/gcc-ld/ld.lld
+-rwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/bin/gcc-ld/ld64.lld
+-rwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/bin/gcc-ld/lld-link
+-rwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/bin/gcc-ld/wasm-ld
+-rwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/bin/rust-lld
+-rwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/bin/rust-objcopy
+drwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/liballoc-66473c445db0d96e.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libcfg_if-a28a9935a2376220.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libcompiler_builtins-3025226cf35b05ba.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libcore-6acc777b98105ee7.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libgetopts-d3d886d159004024.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libhashbrown-476504b7edc442ca.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/liblibc-709a512bd0ec6991.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_abort-828d553676bc43d8.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libpanic_unwind-326d2a6890423ce0.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libproc_macro-ee316e6ba2710fea.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_demangle-124217ca77b8bce2.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_alloc-f80ae5f99e24eb68.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_core-e49a838c15547764.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/librustc_std_workspace_std-2deb468abe17876e.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-8d3f7a219b301f21.rlib
+-rwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd-8d3f7a219b301f21.so
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libstd_detect-7ddfbab6c2b7a4e1.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libsysroot-7cc2119d20423e4c.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libtest-e6e5d4072440b539.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libunicode_width-ba9d1d0316c73c0e.rlib
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/libunwind-92b74b12ed259709.rlib
+drwxr-xr-x root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/Scrt1.o
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crt1.o
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbegin.o
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtbeginS.o
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtend.o
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtendS.o
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crti.o
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/crtn.o
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/libc.a
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/libunwind.a
+-rw-r--r-- root/root usr/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained/rcrt1.o
+drwxr-xr-x root/root usr/share/
+drwxr-xr-x root/root usr/share/man/
+drwxr-xr-x root/root usr/share/man/man1/
+-rw-r--r-- root/root usr/share/man/man1/cargo-add.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-bench.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-build.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-check.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-clean.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-doc.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-fetch.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-fix.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-generate-lockfile.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-help.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-info.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-init.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-install.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-locate-project.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-login.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-logout.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-metadata.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-new.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-owner.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-package.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-pkgid.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-publish.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-remove.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-report.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-run.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-rustc.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-rustdoc.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-search.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-test.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-tree.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-uninstall.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-update.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-vendor.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-version.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo-yank.1.gz
+-rw-r--r-- root/root usr/share/man/man1/cargo.1.gz
+-rw-r--r-- root/root usr/share/man/man1/rustc.1.gz
+-rw-r--r-- root/root usr/share/man/man1/rustdoc.1.gz
diff --git a/rust/abuild b/rust/abuild
new file mode 100644
index 00000000..8c4d918d
--- /dev/null
+++ b/rust/abuild
@@ -0,0 +1,102 @@
+name=rust
+version=1.86.0
+
+##cat src/stage0.txt
+export _date=2025-02-20
+export _rustc=1.85.0
+export _cargo=$_rustc
+##
+
+release=1
+source="https://static.rust-lang.org/dist/${name}c-$version-src.tar.xz
+ https://static.rust-lang.org/dist/$_date/rust-std-$_rustc-x86_64-unknown-linux-musl.tar.xz::noextract
+ https://static.rust-lang.org/dist/$_date/rustc-$_rustc-x86_64-unknown-linux-musl.tar.xz::noextract
+ https://static.rust-lang.org/dist/$_date/cargo-$_cargo-x86_64-unknown-linux-musl.tar.xz::noextract
+ fix-linux_musl_base.patch
+ libressl.patch
+ fix-curl.patch"
+build_dir=${name}c-$version-src
+keep_static=1
+no_strip=1
+
+build() {
+ mkdir -p build/cache/$_date
+
+ _tuplet=x86_64-unknown-linux-musl
+ cp $SRC/rust-std-$_rustc-x86_64-unknown-linux-musl.tar.xz build/cache/$_date/
+ cp $SRC/rustc-$_rustc-x86_64-unknown-linux-musl.tar.xz build/cache/$_date/
+ cp $SRC/cargo-$_cargo-x86_64-unknown-linux-musl.tar.xz build/cache/$_date/
+
+ sed -i 's/\(crt_static_default = \)true/\1false/' compiler/rustc_target/src/spec/base/linux_musl.rs
+ sed -i 's/\("files":{\)[^}]*/\1/' vendor/curl-sys-0.4.52+curl-7.81.0/.cargo-checksum.json
+ sed -i 's/\("files":{\)[^}]*/\1/' vendor/curl-sys-0.4.78+curl-8.11.0/.cargo-checksum.json
+ sed -i 's/\("files":{\)[^}]*/\1/' vendor/curl-sys-0.4.79+curl-8.12.0/.cargo-checksum.json
+ sed -i 's/\("files":{\)[^}]*/\1/' vendor/openssl-sys-0.9.92/.cargo-checksum.json
+
+ cat > config.toml <<EOF
+[llvm]
+link-shared = true
+download-ci-llvm = false
+static-libstdcpp = false
+use-libcxx = true
+
+[build]
+build = "$_tuplet"
+host = [ "$_tuplet" ]
+target = [ "$_tuplet" ]
+
+docs = false
+compiler-docs = false
+extended = true
+submodules = false
+python = "python3"
+locked-deps = true
+vendor = true
+tools = [ "cargo", "rustfmt" ]
+sanitizers = false
+profiler = false
+full-bootstrap = false
+
+[install]
+prefix = "/usr"
+
+[target.$_tuplet]
+llvm-config = "/usr/bin/llvm-config"
+crt-static = false
+sanitizers = false
+
+[dist]
+src-tarball = false
+
+[rust]
+backtrace = false
+channel = "stable"
+codegen-tests = false
+codegen-units-std = 1
+codegen-units = 0
+debug = false
+debug-assertions = false
+debuginfo-level = 0
+incremental = false
+jemalloc = false
+rpath = false
+dist-src = false
+llvm-libunwind = "system"
+EOF
+
+ mkdir -p libgcc
+ printf 'INPUT(-lunwind)\n' > libgcc/libgcc_s.so
+ ln -sf $(cc -print-file-name=libunwind.so) libgcc/libgcc_s.so.1
+ export LD_LIBRARY_PATH="$PWD/libgcc:$LD_LIBRARY_PATH"
+ export LIBRARY_PATH="$PWD/libgcc:$LIBRARY_PATH"
+
+ mkdir "$SRC/rust"
+ export RUST_BACKTRACE=1
+
+ #python x.py build
+ python x.py install
+
+ rm -rf $PKG/usr/lib/rustlib/src/ \
+ $PKG/usr/share/zsh \
+ $PKG/usr/lib/rustlib/uninstall.sh
+}
diff --git a/rust/depends b/rust/depends
new file mode 100644
index 00000000..453889a6
--- /dev/null
+++ b/rust/depends
@@ -0,0 +1 @@
+llvm
diff --git a/rust/fix-curl.patch b/rust/fix-curl.patch
new file mode 100644
index 00000000..b29c2794
--- /dev/null
+++ b/rust/fix-curl.patch
@@ -0,0 +1,39 @@
+diff --git a/vendor/curl-sys-0.4.52+curl-7.81.0/build.rs b/vendor/curl-sys-0.4.52+curl-7.81.0/build.rs
+index e9a2a42..560bfed 100644
+--- a/vendor/curl-sys-0.4.52+curl-7.81.0/build.rs
++++ b/vendor/curl-sys-0.4.52+curl-7.81.0/build.rs
+@@ -111,6 +111,8 @@ fn main() {
+ .include("curl/lib")
+ .include("curl/include")
+ .define("BUILDING_LIBCURL", None)
++ .define("CURL_CA_BUNDLE", "\"/etc/ssl/cert.pem\"")
++ .define("CURL_CA_PATH", "\"/etc/ssl/certs\"")
+ .define("CURL_DISABLE_DICT", None)
+ .define("CURL_DISABLE_GOPHER", None)
+ .define("CURL_DISABLE_IMAP", None)
+diff --git a/vendor/curl-sys-0.4.78+curl-8.11.0/build.rs b/vendor/curl-sys-0.4.78+curl-8.11.0/build.rs
+index a451b24..363b314 100644
+--- a/vendor/curl-sys-0.4.78+curl-8.11.0/build.rs
++++ b/vendor/curl-sys-0.4.78+curl-8.11.0/build.rs
+@@ -117,6 +117,8 @@ fn main() {
+ .include("curl/lib")
+ .include("curl/include")
+ .define("BUILDING_LIBCURL", None)
++ .define("CURL_CA_BUNDLE", "\"/etc/ssl/cert.pem\"")
++ .define("CURL_CA_PATH", "\"/etc/ssl/certs\"")
+ .define("CURL_DISABLE_DICT", None)
+ .define("CURL_DISABLE_GOPHER", None)
+ .define("CURL_DISABLE_IMAP", None)
+diff --git a/vendor/curl-sys-0.4.79+curl-8.12.0/build.rs b/vendor/curl-sys-0.4.79+curl-8.12.0/build.rs
+index 8315a20..98dedb4 100644
+--- a/vendor/curl-sys-0.4.79+curl-8.12.0/build.rs
++++ b/vendor/curl-sys-0.4.79+curl-8.12.0/build.rs
+@@ -117,6 +117,8 @@ fn main() {
+ .include("curl/lib")
+ .include("curl/include")
+ .define("BUILDING_LIBCURL", None)
++ .define("CURL_CA_BUNDLE", "\"/etc/ssl/cert.pem\"")
++ .define("CURL_CA_PATH", "\"/etc/ssl/certs\"")
+ .define("CURL_DISABLE_DICT", None)
+ .define("CURL_DISABLE_GOPHER", None)
+ .define("CURL_DISABLE_IMAP", None)
diff --git a/rust/fix-linux_musl_base.patch b/rust/fix-linux_musl_base.patch
new file mode 100644
index 00000000..acd156e1
--- /dev/null
+++ b/rust/fix-linux_musl_base.patch
@@ -0,0 +1,65 @@
+diff --git a/compiler/rustc_target/src/spec/base/linux_musl.rs b/compiler/rustc_target/src/spec/base/linux_musl.rs
+index 1a854fe..7b0cc7b 100644
+--- a/compiler/rustc_target/src/spec/base/linux_musl.rs
++++ b/compiler/rustc_target/src/spec/base/linux_musl.rs
+@@ -1,12 +1,9 @@
+-use crate::spec::{LinkSelfContainedDefault, TargetOptions, base, crt_objects};
++use crate::spec::{base, TargetOptions};
+
+ pub(crate) fn opts() -> TargetOptions {
+ let mut base = base::linux::opts();
+
+ base.env = "musl".into();
+- base.pre_link_objects_self_contained = crt_objects::pre_musl_self_contained();
+- base.post_link_objects_self_contained = crt_objects::post_musl_self_contained();
+- base.link_self_contained = LinkSelfContainedDefault::InferredForMusl;
+
+ base
+ }
+diff --git a/compiler/rustc_target/src/spec/crt_objects.rs b/compiler/rustc_target/src/spec/crt_objects.rs
+index e3b6430..13a96e2 100644
+--- a/compiler/rustc_target/src/spec/crt_objects.rs
++++ b/compiler/rustc_target/src/spec/crt_objects.rs
+@@ -62,28 +62,6 @@ pub(super) fn all(obj: &'static str) -> CrtObjects {
+ ])
+ }
+
+-pub(super) fn pre_musl_self_contained() -> 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"]),
+- ])
+-}
+-
+-pub(super) fn post_musl_self_contained() -> CrtObjects {
+- new(&[
+- (LinkOutputKind::DynamicNoPicExe, &["crtend.o", "crtn.o"]),
+- (LinkOutputKind::DynamicPicExe, &["crtendS.o", "crtn.o"]),
+- (LinkOutputKind::StaticNoPicExe, &["crtend.o", "crtn.o"]),
+- (LinkOutputKind::StaticPicExe, &["crtendS.o", "crtn.o"]),
+- (LinkOutputKind::DynamicDylib, &["crtendS.o", "crtn.o"]),
+- (LinkOutputKind::StaticDylib, &["crtendS.o", "crtn.o"]),
+- ])
+-}
+-
+ pub(super) fn pre_mingw_self_contained() -> CrtObjects {
+ new(&[
+ (LinkOutputKind::DynamicNoPicExe, &["crt2.o", "rsbegin.o"]),
+diff --git a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
+index 8dcdc5b..25f53d6 100644
+--- a/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
++++ b/compiler/rustc_target/src/spec/targets/x86_64_unknown_linux_musl.rs
+@@ -14,8 +14,7 @@ pub(crate) fn target() -> Target {
+ | SanitizerSet::MEMORY
+ | SanitizerSet::THREAD;
+ base.supports_xray = true;
+- // FIXME(compiler-team#422): musl targets should be dynamically linked by default.
+- base.crt_static_default = true;
++ base.crt_static_default = false;
+
+ Target {
+ llvm_target: "x86_64-unknown-linux-musl".into(),
diff --git a/rust/libressl.patch b/rust/libressl.patch
new file mode 100644
index 00000000..10a9689b
--- /dev/null
+++ b/rust/libressl.patch
@@ -0,0 +1,408 @@
+diff --git a/vendor/openssl-0.10.38/build.rs b/vendor/openssl-0.10.38/build.rs
+index d90ebc17..3e323cea 100644
+--- a/vendor/openssl-0.10.38/build.rs
++++ b/vendor/openssl-0.10.38/build.rs
+@@ -78,5 +78,41 @@ fn main() {
+ if version >= 0x3_04_00_00_0 {
+ println!("cargo:rustc-cfg=libressl340");
+ }
++
++ if version >= 0x3_05_00_00_0 {
++ println!("cargo:rustc-cfg=libressl350");
++ }
++
++ if version >= 0x3_06_00_00_0 {
++ println!("cargo:rustc-cfg=libressl360");
++ }
++
++ if version >= 0x3_06_01_00_0 {
++ println!("cargo:rustc-cfg=libressl361");
++ }
++
++ if version >= 0x3_07_00_00_0 {
++ println!("cargo:rustc-cfg=libressl370");
++ }
++
++ if version >= 0x3_08_00_00_0 {
++ println!("cargo:rustc-cfg=libressl380");
++ }
++
++ if version >= 0x3_08_02_00_0 {
++ println!("cargo:rustc-cfg=libressl382");
++ }
++
++ if version >= 0x3_09_00_00_0 {
++ println!("cargo:rustc-cfg=libressl390");
++ }
++
++ if version >= 0x4_00_00_00_0 {
++ println!("cargo:rustc-cfg=libressl400");
++ }
++
++ if version >= 0x4_01_00_00_0 {
++ println!("cargo:rustc-cfg=libressl410");
++ }
+ }
+ }
+diff --git a/vendor/openssl-0.10.57/build.rs b/vendor/openssl-0.10.57/build.rs
+index 0a974b33..791fb8a5 100644
+--- a/vendor/openssl-0.10.57/build.rs
++++ b/vendor/openssl-0.10.57/build.rs
+@@ -67,6 +67,21 @@ fn main() {
+ if version >= 0x3_07_00_00_0 {
+ println!("cargo:rustc-cfg=libressl370");
+ }
++ if version >= 0x3_08_00_00_0 {
++ println!("cargo:rustc-cfg=libressl380");
++ }
++ if version >= 0x3_08_02_00_0 {
++ println!("cargo:rustc-cfg=libressl382");
++ }
++ if version >= 0x3_09_00_00_0 {
++ println!("cargo:rustc-cfg=libressl390");
++ }
++ if version >= 0x4_00_00_00_0 {
++ println!("cargo:rustc-cfg=libressl400");
++ }
++ if version >= 0x4_01_00_00_0 {
++ println!("cargo:rustc-cfg=libressl410");
++ }
+ }
+
+ if let Ok(vars) = env::var("DEP_OPENSSL_CONF") {
+@@ -103,60 +118,4 @@ fn main() {
+ println!("cargo:rustc-cfg=ossl310");
+ }
+ }
+-
+- if let Ok(version) = env::var("DEP_OPENSSL_LIBRESSL_VERSION_NUMBER") {
+- let version = u64::from_str_radix(&version, 16).unwrap();
+-
+- if version >= 0x2_05_01_00_0 {
+- println!("cargo:rustc-cfg=libressl251");
+- }
+-
+- if version >= 0x2_06_01_00_0 {
+- println!("cargo:rustc-cfg=libressl261");
+- }
+-
+- if version >= 0x2_07_00_00_0 {
+- println!("cargo:rustc-cfg=libressl270");
+- }
+-
+- if version >= 0x2_07_01_00_0 {
+- println!("cargo:rustc-cfg=libressl271");
+- }
+-
+- if version >= 0x2_07_03_00_0 {
+- println!("cargo:rustc-cfg=libressl273");
+- }
+-
+- if version >= 0x2_08_00_00_0 {
+- println!("cargo:rustc-cfg=libressl280");
+- }
+-
+- if version >= 0x2_09_01_00_0 {
+- println!("cargo:rustc-cfg=libressl291");
+- }
+-
+- if version >= 0x3_02_01_00_0 {
+- println!("cargo:rustc-cfg=libressl321");
+- }
+-
+- if version >= 0x3_03_02_00_0 {
+- println!("cargo:rustc-cfg=libressl332");
+- }
+-
+- if version >= 0x3_04_00_00_0 {
+- println!("cargo:rustc-cfg=libressl340");
+- }
+-
+- if version >= 0x3_05_00_00_0 {
+- println!("cargo:rustc-cfg=libressl350");
+- }
+-
+- if version >= 0x3_06_00_00_0 {
+- println!("cargo:rustc-cfg=libressl360");
+- }
+-
+- if version >= 0x3_06_01_00_0 {
+- println!("cargo:rustc-cfg=libressl361");
+- }
+- }
+ }
+diff --git a/vendor/openssl-0.10.57/src/conf.rs b/vendor/openssl-0.10.57/src/conf.rs
+index 715519c5..88740298 100644
+--- a/vendor/openssl-0.10.57/src/conf.rs
++++ b/vendor/openssl-0.10.57/src/conf.rs
+@@ -8,7 +8,7 @@ foreign_type_and_impl_send_sync! {
+ pub struct ConfRef;
+ }
+
+-#[cfg(not(boringssl))]
++#[cfg(not(any(boringssl, libressl400)))]
+ mod methods {
+ use super::Conf;
+ use crate::cvt_p;
+@@ -61,5 +61,5 @@ mod methods {
+ }
+ }
+ }
+-#[cfg(not(boringssl))]
++#[cfg(not(any(boringssl, libressl400)))]
+ pub use methods::*;
+diff --git a/vendor/openssl-0.10.64/build.rs b/vendor/openssl-0.10.64/build.rs
+index 7677abc0..4f5ca600 100644
+--- a/vendor/openssl-0.10.64/build.rs
++++ b/vendor/openssl-0.10.64/build.rs
+@@ -75,6 +75,12 @@ fn main() {
+ if version >= 0x3_09_00_00_0 {
+ println!("cargo:rustc-cfg=libressl390");
+ }
++ if version >= 0x4_00_00_00_0 {
++ println!("cargo:rustc-cfg=libressl400");
++ }
++ if version >= 0x4_01_00_00_0 {
++ println!("cargo:rustc-cfg=libressl410");
++ }
+ }
+
+ if let Ok(vars) = env::var("DEP_OPENSSL_CONF") {
+diff --git a/vendor/openssl-0.10.64/src/conf.rs b/vendor/openssl-0.10.64/src/conf.rs
+index 715519c5..a4261cbc 100644
+--- a/vendor/openssl-0.10.64/src/conf.rs
++++ b/vendor/openssl-0.10.64/src/conf.rs
+@@ -8,7 +8,7 @@ foreign_type_and_impl_send_sync! {
+ pub struct ConfRef;
+ }
+
+-#[cfg(not(boringssl))]
++#[cfg(not(any(boringssl, libressl400)))]
+ mod methods {
+ use super::Conf;
+ use crate::cvt_p;
+@@ -61,5 +61,5 @@ mod methods {
+ }
+ }
+ }
+-#[cfg(not(boringssl))]
++#[cfg(not(and(boringssl, libressl400)))]
+ pub use methods::*;
+diff --git a/vendor/openssl-sys-0.9.102/build/cfgs.rs b/vendor/openssl-sys-0.9.102/build/cfgs.rs
+index 91cb734c..c53eabc4 100644
+--- a/vendor/openssl-sys-0.9.102/build/cfgs.rs
++++ b/vendor/openssl-sys-0.9.102/build/cfgs.rs
+@@ -65,6 +65,12 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&
+ if libressl_version >= 0x3_09_00_00_0 {
+ cfgs.push("libressl390");
+ }
++ if libressl_version >= 0x4_00_00_00_0 {
++ cfgs.push("libressl400");
++ }
++ if libressl_version >= 0x4_01_00_00_0 {
++ cfgs.push("libressl410");
++ }
+ } else {
+ let openssl_version = openssl_version.unwrap();
+
+diff --git a/vendor/openssl-sys-0.9.102/build/main.rs b/vendor/openssl-sys-0.9.102/build/main.rs
+index 606acc35..a30f788b 100644
+--- a/vendor/openssl-sys-0.9.102/build/main.rs
++++ b/vendor/openssl-sys-0.9.102/build/main.rs
+@@ -304,6 +304,10 @@ See rust-openssl documentation for more information:
+ (3, 8, _) => ('3', '8', 'x'),
+ (3, 9, 0) => ('3', '9', '0'),
+ (3, 9, _) => ('3', '9', 'x'),
++ (4, 0, 0) => ('4', '0', '0'),
++ (4, 0, _) => ('4', '0', 'x'),
++ (4, 1, 0) => ('4', '1', '0'),
++ (4, 1, _) => ('4', '1', 'x'),
+ _ => version_error(),
+ };
+
+@@ -346,7 +350,7 @@ fn version_error() -> ! {
+ "
+
+ This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3), or LibreSSL 2.5
+-through 3.9.x, but a different version of OpenSSL was found. The build is now aborting
++through 4.1.x, but a different version of OpenSSL was found. The build is now aborting
+ due to this version mismatch.
+
+ "
+diff --git a/vendor/openssl-sys-0.9.104/build/cfgs.rs b/vendor/openssl-sys-0.9.104/build/cfgs.rs
+index cd03888e..ca997074 100644
+--- a/vendor/openssl-sys-0.9.104/build/cfgs.rs
++++ b/vendor/openssl-sys-0.9.104/build/cfgs.rs
+@@ -68,6 +68,9 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&
+ if libressl_version >= 0x4_00_00_00_0 {
+ cfgs.push("libressl400");
+ }
++ if libressl_version >= 0x4_01_00_00_0 {
++ cfgs.push("libressl410");
++ }
+ } else {
+ let openssl_version = openssl_version.unwrap();
+
+diff --git a/vendor/openssl-sys-0.9.104/build/main.rs b/vendor/openssl-sys-0.9.104/build/main.rs
+index f379e1e6..0429f12a 100644
+--- a/vendor/openssl-sys-0.9.104/build/main.rs
++++ b/vendor/openssl-sys-0.9.104/build/main.rs
+@@ -103,6 +103,7 @@ fn main() {
+ println!("cargo:rustc-check-cfg=cfg(libressl382)");
+ println!("cargo:rustc-check-cfg=cfg(libressl390)");
+ println!("cargo:rustc-check-cfg=cfg(libressl400)");
++ println!("cargo:rustc-check-cfg=cfg(libressl410)");
+
+ println!("cargo:rustc-check-cfg=cfg(ossl101)");
+ println!("cargo:rustc-check-cfg=cfg(ossl102)");
+@@ -382,6 +383,8 @@ See rust-openssl documentation for more information:
+ (3, 9, _) => ('3', '9', 'x'),
+ (4, 0, 0) => ('4', '0', '0'),
+ (4, 0, _) => ('4', '0', 'x'),
++ (4, 1, 0) => ('4', '1', '0'),
++ (4, 1, _) => ('4', '1', 'x'),
+ _ => version_error(),
+ };
+
+@@ -424,7 +427,7 @@ fn version_error() -> ! {
+ "
+
+ This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3), or LibreSSL 2.5
+-through 4.0.x, but a different version of OpenSSL was found. The build is now aborting
++through 4.1.x, but a different version of OpenSSL was found. The build is now aborting
+ due to this version mismatch.
+
+ "
+diff --git a/vendor/openssl-sys-0.9.72/build/cfgs.rs b/vendor/openssl-sys-0.9.72/build/cfgs.rs
+index 18b3e3de..b2b234a9 100644
+--- a/vendor/openssl-sys-0.9.72/build/cfgs.rs
++++ b/vendor/openssl-sys-0.9.72/build/cfgs.rs
+@@ -34,6 +34,36 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&
+ if libressl_version >= 0x3_03_02_00_0 {
+ cfgs.push("libressl332");
+ }
++ if libressl_version >= 0x3_04_00_00_0 {
++ cfgs.push("libressl340");
++ }
++ if libressl_version >= 0x3_05_00_00_0 {
++ cfgs.push("libressl350");
++ }
++ if libressl_version >= 0x3_06_00_00_0 {
++ cfgs.push("libressl360");
++ }
++ if libressl_version >= 0x3_07_00_00_0 {
++ cfgs.push("libressl370");
++ }
++ if libressl_version >= 0x3_08_00_00_0 {
++ cfgs.push("libressl380");
++ }
++ if libressl_version >= 0x3_08_01_00_0 {
++ cfgs.push("libressl381");
++ }
++ if libressl_version >= 0x3_08_02_00_0 {
++ cfgs.push("libressl382");
++ }
++ if libressl_version >= 0x3_09_00_00_0 {
++ cfgs.push("libressl390");
++ }
++ if libressl_version >= 0x4_00_00_00_0 {
++ cfgs.push("libressl400");
++ }
++ if libressl_version >= 0x4_01_00_00_0 {
++ cfgs.push("libressl410");
++ }
+ } else {
+ let openssl_version = openssl_version.unwrap();
+
+diff --git a/vendor/openssl-sys-0.9.72/build/main.rs b/vendor/openssl-sys-0.9.72/build/main.rs
+index 243f146b..8aacb403 100644
+--- a/vendor/openssl-sys-0.9.72/build/main.rs
++++ b/vendor/openssl-sys-0.9.72/build/main.rs
+@@ -254,6 +254,21 @@ See rust-openssl README for more information:
+ (3, 3, _) => ('3', '3', 'x'),
+ (3, 4, 0) => ('3', '4', '0'),
+ (3, 4, _) => ('3', '4', 'x'),
++ (3, 5, _) => ('3', '5', 'x'),
++ (3, 6, 0) => ('3', '6', '0'),
++ (3, 6, _) => ('3', '6', 'x'),
++ (3, 7, 0) => ('3', '7', '0'),
++ (3, 7, 1) => ('3', '7', '1'),
++ (3, 7, _) => ('3', '7', 'x'),
++ (3, 8, 0) => ('3', '8', '0'),
++ (3, 8, 1) => ('3', '8', '1'),
++ (3, 8, _) => ('3', '8', 'x'),
++ (3, 9, 0) => ('3', '9', '0'),
++ (3, 9, _) => ('3', '9', 'x'),
++ (4, 0, 0) => ('4', '0', '0'),
++ (4, 0, _) => ('4', '0', 'x'),
++ (4, 1, 0) => ('4', '1', '0'),
++ (4, 1, _) => ('4', '1', 'x'),
+ _ => version_error(),
+ };
+
+@@ -296,7 +311,7 @@ fn version_error() -> ! {
+ "
+
+ This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3.0.0), or LibreSSL 2.5
+-through 3.4.1, but a different version of OpenSSL was found. The build is now aborting
++through 4.1.x, but a different version of OpenSSL was found. The build is now aborting
+ due to this version mismatch.
+
+ "
+diff --git a/vendor/openssl-sys-0.9.92/build/cfgs.rs b/vendor/openssl-sys-0.9.92/build/cfgs.rs
+index 2f3ff3ea..d800f3d1 100644
+--- a/vendor/openssl-sys-0.9.92/build/cfgs.rs
++++ b/vendor/openssl-sys-0.9.92/build/cfgs.rs
+@@ -53,6 +53,24 @@ pub fn get(openssl_version: Option<u64>, libressl_version: Option<u64>) -> Vec<&
+ if libressl_version >= 0x3_07_00_00_0 {
+ cfgs.push("libressl370");
+ }
++ if libressl_version >= 0x3_08_00_00_0 {
++ cfgs.push("libressl380");
++ }
++ if libressl_version >= 0x3_08_01_00_0 {
++ cfgs.push("libressl381");
++ }
++ if libressl_version >= 0x3_08_02_00_0 {
++ cfgs.push("libressl382");
++ }
++ if libressl_version >= 0x3_09_00_00_0 {
++ cfgs.push("libressl390");
++ }
++ if libressl_version >= 0x4_00_00_00_0 {
++ cfgs.push("libressl400");
++ }
++ if libressl_version >= 0x4_01_00_00_0 {
++ cfgs.push("libressl410");
++ }
+ } else {
+ let openssl_version = openssl_version.unwrap();
+
+diff --git a/vendor/openssl-sys-0.9.92/build/main.rs b/vendor/openssl-sys-0.9.92/build/main.rs
+index 21ccf3d0..2b06ee0f 100644
+--- a/vendor/openssl-sys-0.9.92/build/main.rs
++++ b/vendor/openssl-sys-0.9.92/build/main.rs
+@@ -273,6 +273,14 @@ See rust-openssl documentation for more information:
+ (3, 7, 1) => ('3', '7', '1'),
+ (3, 7, _) => ('3', '7', 'x'),
+ (3, 8, 0) => ('3', '8', '0'),
++ (3, 8, 1) => ('3', '8', '1'),
++ (3, 8, _) => ('3', '8', 'x'),
++ (3, 9, 0) => ('3', '9', '0'),
++ (3, 9, _) => ('3', '9', 'x'),
++ (4, 0, 0) => ('4', '0', '0'),
++ (4, 0, _) => ('4', '0', 'x'),
++ (4, 1, 0) => ('4', '1', '0'),
++ (4, 1, _) => ('4', '1', 'x'),
+ _ => version_error(),
+ };
+
+@@ -315,7 +323,7 @@ fn version_error() -> ! {
+ "
+
+ This crate is only compatible with OpenSSL (version 1.0.1 through 1.1.1, or 3.0.0), or LibreSSL 2.5
+-through 3.8.0, but a different version of OpenSSL was found. The build is now aborting
++through 4.1.x, but a different version of OpenSSL was found. The build is now aborting
+ due to this version mismatch.
+
+ "