guix_mirror_bot pushed a commit to branch rust-team
in repository guix.
commit f2d57ed6ecc619b9ba09798b5c0e27778e86206e
Author: Efraim Flashner <[email protected]>
AuthorDate: Thu Oct 1 13:41:48 2026 +0300
gnu: Add rust-bootstrap-1.90.
* gnu/packages/rust.scm (rust-bootstrap-1.90): New variable.
(%mrustc-commit): Rename to %mrustc-commit-1.54.
(%mrustc-source): Rename to %mrustc-source-1.54.
(%mrustc-commit-1.90, %mrustc-source-1.90): New variables.
(rust-bootstrap-1.54, rust-bootstrap-1.74): Adjust accordingly.
(rust-1.91)[arguments]: Add a phase when building with
rust-bootstrap-1.90.
[native-inputs]: Build with rust-bootstrap-1.90 when supported.
(rust-1.92)[arguments]: Remove added phase.
* gnu/packages/patches/mrustc-patches.patch: Rename to
mrustc-patches-1.54.patch.
* gnu/packages/patches/mrustc-patches-1.90.patch: New file.
* gnu/local.mk (dist_patch_DATA): Update it.
---
gnu/local.mk | 3 +-
...stc-patches.patch => mrustc-patches-1.54.patch} | 0
gnu/packages/patches/mrustc-patches-1.90.patch | 56 +++++
gnu/packages/rust.scm | 269 +++++++++++++++++++--
4 files changed, 308 insertions(+), 20 deletions(-)
diff --git a/gnu/local.mk b/gnu/local.mk
index d1821055c77..8505ddc3316 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2016,7 +2016,8 @@ dist_patch_DATA =
\
%D%/packages/patches/mono-mcs-patches-from-5.10.0.patch \
%D%/packages/patches/mosaicatcher-unbundle-htslib.patch \
%D%/packages/patches/mrrescue-support-love-11.patch \
- %D%/packages/patches/mrustc-patches.patch \
+ %D%/packages/patches/mrustc-patches-1.54.patch \
+ %D%/packages/patches/mrustc-patches-1.90.patch \
%D%/packages/patches/mswebrtc-b64-refactor.patch \
%D%/packages/patches/mswebrtc-cmake.patch \
%D%/packages/patches/mtools-mformat-uninitialized.patch \
diff --git a/gnu/packages/patches/mrustc-patches.patch
b/gnu/packages/patches/mrustc-patches-1.54.patch
similarity index 100%
rename from gnu/packages/patches/mrustc-patches.patch
rename to gnu/packages/patches/mrustc-patches-1.54.patch
diff --git a/gnu/packages/patches/mrustc-patches-1.90.patch
b/gnu/packages/patches/mrustc-patches-1.90.patch
new file mode 100644
index 00000000000..879cba56059
--- /dev/null
+++ b/gnu/packages/patches/mrustc-patches-1.90.patch
@@ -0,0 +1,56 @@
+diff --git a/rustc-1.54.0-src.patch b/rustc-1.54.0-src.patch
+index c258f486..ee6e8f0a 100644
+--- a/rustc-1.54.0-src.patch
++++ b/rustc-1.54.0-src.patch
+@@ -303,17 +303,6 @@
+
+ pub use self::arch::{vec128_storage, vec256_storage, vec512_storage};
+
+---- src/llvm-project/llvm/include/llvm/Support/Signals.h
+-+++ src/llvm-project/llvm/include/llvm/Support/Signals.h
+-@@ -14,6 +14,7 @@
+- #ifndef LLVM_SUPPORT_SIGNALS_H
+- #define LLVM_SUPPORT_SIGNALS_H
+-
+-+#include <cstdint>
+- #include <string>
+-
+- namespace llvm {
+-
+ # MSVC Cannot handle structs larger than 32-bit, so disable this for windows
with mrustc
+ --- vendor/hex-0.3.2/src/lib.rs
+ +++ vendor/hex-0.3.2/src/lib.rs
+diff --git a/rustc-1.74.0-src.patch b/rustc-1.74.0-src.patch
+index 25ecc2a2..fe8aeef7 100644
+--- a/rustc-1.74.0-src.patch
++++ b/rustc-1.74.0-src.patch
+@@ -124,29 +124,6 @@
+ +#[cfg(all(target_pointer_width = "64", not(rust_compiler = "mrustc")))]
+ from_hex_array_impl! {
+
+---- src/llvm-project/llvm/include/llvm/ADT/SmallVector.h
+-+++ src/llvm-project/llvm/include/llvm/ADT/SmallVector.h
+-@@ -21,2 +21,3 @@
+- #include <cstddef>
+-+#include <cstdint>
+- #include <cstdlib>
+---- src/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
+-+++ src/llvm-project/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
+-@@ -14,4 +14,5 @@
+- #define LLVM_LIB_TARGET_X86_MCTARGETDESC_X86MCTARGETDESC_H
+-
+-+#include <cstdint>
+- #include <memory>
+- #include <string>
+---- src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h
+-+++ src/llvm-project/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUMCTargetDesc.h
+-@@ -16,4 +16,5 @@
+- #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUMCTARGETDESC_H
+-
+-+#include <cstdint>
+- #include <memory>
+-
+-
+ # macos_weak only defines the fdopendir weak symbol for x86/x86_64; other
macOS targets emit neither arm.
+ # 10.4/10.5 have no $INODE64 variants, so the plain symbol is the correct one
there.
+ --- library/std/src/sys/unix/fs.rs
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index d2c4588f985..448f947a0b0 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -139,21 +139,50 @@
;;; Note: mrustc's only purpose is to be able to bootstrap Rust; it's designed
;;; to be used in source form.
-(define %mrustc-commit "06b87d1af49d2db3bd850fdee8888055dd540dd1")
-(define %mrustc-source
+(define %mrustc-commit-1.54 "06b87d1af49d2db3bd850fdee8888055dd540dd1")
+(define %mrustc-source-1.54
(let* ((version "0.11.2")
- (commit %mrustc-commit)
+ (commit %mrustc-commit-1.54)
(revision "1")
(name "mrustc"))
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/thepowersgang/mrustc")
- (commit %mrustc-commit)))
+ (commit %mrustc-commit-1.54)))
(file-name (git-file-name name (git-version version revision commit)))
(sha256
(base32 "1m6ya3d653b5z0ygvr4y8hay1445gww9s8vyk8h0jdi42zkhzqkf"))
- (patches (search-patches "mrustc-patches.patch"))
+ (patches (search-patches "mrustc-patches-1.54.patch"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ ;; Drastically reduces memory and build time requirements
+ ;; by disabling debug by default.
+ (substitute* (find-files "." "Makefile")
+ (("LINKFLAGS := -g") "LINKFLAGS :=")
+ (("-g ") ""))
+ (substitute* "minicargo.mk"
+ ;; Don't assume tarball with gzip compression.
+ (("-xzf") "-xf")
+ ;; Don't use the vendored openssl sources.
+ (("--features vendored-openssl") "")))))))
+
+(define %mrustc-commit-1.90 "a822472b9ee744e58d8b1a79bdd8080f7a7b008f")
+(define %mrustc-source-1.90
+ (let* ((version "0.12.0")
+ (commit %mrustc-commit-1.90)
+ (revision "1")
+ (name "mrustc"))
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/thepowersgang/mrustc")
+ (commit %mrustc-commit-1.90)))
+ (file-name (git-file-name name (git-version version revision commit)))
+ (sha256
+ (base32 "0abf6z6nkgdrfzky99k81k3fqj9bc1sgplxgpi58m0vgz9pd0szz"))
+ (patches (search-patches "mrustc-patches-1.90.patch"))
(modules '((guix build utils)))
(snippet
'(begin
@@ -211,7 +240,7 @@
zlib))
(native-inputs
`(("pkg-config" ,pkg-config)
- ("mrustc-source" ,%mrustc-source)))
+ ("mrustc-source" ,%mrustc-source-1.54)))
(arguments
`(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
#:modules ((guix build cargo-utils)
@@ -252,10 +281,10 @@
;; Patch date and git obtained version information.
((" -D VERSION_GIT_FULLHASH=.*")
(string-append
- " -D VERSION_GIT_FULLHASH=\\\"" ,%mrustc-commit "\\\""
+ " -D VERSION_GIT_FULLHASH=\\\"" ,%mrustc-commit-1.54 "\\\""
" -D VERSION_GIT_BRANCH=\\\"master\\\""
" -D VERSION_GIT_SHORTHASH=\\\""
- ,(string-take %mrustc-commit 7) "\\\""
+ ,(string-take %mrustc-commit-1.54 7) "\\\""
" -D VERSION_BUILDTIME="
"\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\""
" -D VERSION_GIT_ISDIRTY=0\n")))
@@ -396,7 +425,7 @@ safety and thread safety guarantees.")
openssl
zlib))
(native-inputs
- (list pkg-config %mrustc-source))
+ (list pkg-config %mrustc-source-1.54))
(arguments
(list
#:imported-modules %cargo-utils-modules ;for `generate-all-checksums'
@@ -425,7 +454,7 @@ safety and thread safety guarantees.")
(lambda* (#:key source inputs #:allow-other-keys)
((assoc-ref %standard-phases 'unpack)
#:source #$(this-package-native-input
- (origin-file-name %mrustc-source)))))
+ (origin-file-name %mrustc-source-1.54)))))
(add-after 'unpack 'patch-makefiles
;; This disables building the (unbundled) LLVM.
(lambda* (#:key inputs #:allow-other-keys)
@@ -439,10 +468,10 @@ safety and thread safety guarantees.")
;; Patch date and git obtained version information.
((" -D VERSION_GIT_FULLHASH=.*")
(string-append
- " -D VERSION_GIT_FULLHASH=\\\"" #$%mrustc-commit "\\\""
+ " -D VERSION_GIT_FULLHASH=\\\"" #$%mrustc-commit-1.54 "\\\""
" -D VERSION_GIT_BRANCH=\\\"master\\\""
" -D VERSION_GIT_SHORTHASH=\\\""
- #$(string-take %mrustc-commit 7) "\\\""
+ #$(string-take %mrustc-commit-1.54 7) "\\\""
" -D VERSION_BUILDTIME="
"\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\""
" -D VERSION_GIT_ISDIRTY=0\n")))
@@ -539,6 +568,192 @@ safety and thread safety guarantees.")
;; Dual licensed.
(license (list license:asl2.0 license:expat))))
+(define-public rust-bootstrap-1.90
+ (package
+ (name "rust")
+ (version "1.90.0")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (rust-uri version))
+ (sha256 (base32 "0zlv3ybd8za07brxwj4n03cma1snnpvbqj0h0wg3bmafpaf9z6kr"))
+ (modules '((guix build utils)))
+ (snippet
+ '(begin
+ (for-each delete-file-recursively
+ '("src/llvm-project"
+ "vendor/openssl-src-111.28.2+1.1.1w/openssl"
+ "vendor/openssl-src-300.5.0+3.5.0/openssl"
+ "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
+ "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"))
+ ;; Remove vendored dynamically linked libraries.
+ ;; find . -not -type d -executable -exec file {} \+ | grep ELF
+ ;; Also remove the bundled (mostly Windows) libraries.
+ (for-each delete-file
+ (find-files "vendor" "\\.(a|dll|exe|lib)$"))
+ ;; Adjust vendored dependency to explicitly use rustix with libc
+ ;; backend.
+ (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
+ "vendor/tempfile-3.16.0/Cargo.toml"
+ "vendor/tempfile-3.19.0/Cargo.toml"
+ "vendor/tempfile-3.19.1/Cargo.toml"
+ "vendor/tempfile-3.20.0/Cargo.toml")
+ (("features = \\[\"fs\"" all)
+ (string-append all ", \"use-libc\"")))))))
+ (outputs '("out" "cargo"))
+ (properties '((hidden? . #t)
+ (timeout . 129600) ;36 hours
+ (max-silent-time . 18000))) ;5 hours (for riscv64)
+ (build-system gnu-build-system)
+ (inputs
+ (list bash-minimal
+ llvm-21
+ openssl
+ zlib))
+ (native-inputs
+ (list pkg-config %mrustc-source-1.90))
+ (arguments
+ (list
+ #:imported-modules %cargo-utils-modules ;for `generate-all-checksums'
+ #:modules '((guix build cargo-utils)
+ (guix build utils)
+ (guix build gnu-build-system))
+ #:test-target "test"
+ ;; Rust's own .so library files are not found in any RUNPATH, but
+ ;; that doesn't seem to cause issues.
+ #:validate-runpath? #f
+ #:make-flags
+ #~(let ((source #$(package-source this-package)))
+ (list (string-append "RUSTC_TARGET="
+ #$(platform-rust-target
+ (lookup-platform-by-target-or-system
+ (or (%current-target-system)
+ (%current-system)))))
+ (string-append "RUSTC_VERSION=" #$version)
+ (string-append "MRUSTC_TARGET_VER="
+ #$(version-major+minor version))
+ (string-append "RUSTC_SRC_TARBALL=" source)
+ "OUTDIR_SUF=")) ;do not add version suffix to output dir
+ #:phases
+ #~(modify-phases %standard-phases
+ (replace 'unpack
+ (lambda* (#:key source inputs #:allow-other-keys)
+ ((assoc-ref %standard-phases 'unpack)
+ #:source #$(this-package-native-input
+ (origin-file-name %mrustc-source-1.90)))))
+ (add-after 'unpack 'patch-makefiles
+ ;; This disables building the (unbundled) LLVM.
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* '("minicargo.mk"
+ "run_rustc/Makefile")
+ ;; Use the system-provided LLVM.
+ (("LLVM_CONFIG [:|?]= .*")
+ (string-append "LLVM_CONFIG := "
+ (search-input-file inputs "/bin/llvm-config")
"\n")))
+ (substitute* "Makefile"
+ ;; Patch date and git obtained version information.
+ ((" -D VERSION_GIT_FULLHASH=.*")
+ (string-append
+ " -D VERSION_GIT_FULLHASH=\\\"" #$%mrustc-commit-1.90 "\\\""
+ " -D VERSION_GIT_BRANCH=\\\"master\\\""
+ " -D VERSION_GIT_SHORTHASH=\\\""
+ #$(string-take %mrustc-commit-1.90 7) "\\\""
+ " -D VERSION_BUILDTIME="
+ "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\""
+ " -D VERSION_GIT_ISDIRTY=0\n")))
+ (substitute* '("run_rustc/Makefile"
+ "run_rustc/rustc_proxy.sh")
+ ;; Patch the shebang of a generated wrapper for rustc
+ (("#!/bin/sh")
+ (string-append "#!" (which "sh"))))))
+ (add-before 'configure 'configure-cargo-home
+ (lambda _
+ (let ((cargo-home (string-append (getcwd) "/.cargo")))
+ (mkdir-p cargo-home)
+ (setenv "CARGO_HOME" cargo-home))))
+ (replace 'configure
+ (lambda _
+ (setenv "CC" "gcc")
+ (setenv "CXX" "g++")
+ ;; The Guix LLVM package installs only shared libraries.
+ (setenv "LLVM_LINK_SHARED" "1")
+ ;; rustc still insists on having 'cc' on PATH in some places
+ ;; (e.g. when building the 'test' library crate).
+ (mkdir-p "/tmp/bin")
+ (symlink (which "gcc") "/tmp/bin/cc")
+ (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))
+ (delete 'patch-generated-file-shebangs)
+ (replace 'build
+ (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
+ (let ((job-count (if parallel-build?
+ (parallel-job-count)
+ 1)))
+ ;; Adapted from:
+ ;;
https://github.com/dtolnay/bootstrap/blob/master/build-1.90.0.sh.
+ ;; Use PARLEVEL since both minicargo and mrustc use it
+ ;; to set the level of parallelism.
+ (setenv "PARLEVEL" (number->string job-count))
+ (display "Building mrustc...\n")
+ (apply invoke "make" make-flags)
+
+ ;; This doesn't seem to build anything, but it
+ ;; sets additional minicargo flags.
+ (display "Building RUSTCSRC...\n")
+ (apply invoke "make" "RUSTCSRC" make-flags)
+
+ ;; This probably doesn't need to be called explicitly.
+ (display "Building LIBS...\n")
+ (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags)
+
+ (display "Building rustc...\n")
+ (apply invoke "make" "-f" "minicargo.mk" "output/rustc"
+ make-flags)
+
+ (display "Building cargo...\n")
+ (apply invoke "make" "-f" "minicargo.mk" "output/cargo"
+ make-flags)
+
+ ;; This one is listed in the README.
+ (display "Rebuilding stdlib with rustc...\n")
+ (apply invoke "make" "-C" "run_rustc" make-flags))))
+ (replace 'install
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (cargo (assoc-ref outputs "cargo"))
+ (bin (string-append out "/bin"))
+ (rustc (string-append bin "/rustc"))
+ (cargo-bin (string-append cargo "/bin"))
+ (lib (string-append out "/lib"))
+ (system-lib-prefix
+ (string-append lib "/rustlib/"
+ #$(platform-rust-target
+ (lookup-platform-by-target-or-system
+ (or (%current-target-system)
+ (%current-system)))) "/lib")))
+ (with-directory-excursion "run_rustc/output/prefix"
+ ;; The .rmeta files of the bootstrap compiler are not meant
+ ;; to be installed.
+ (for-each delete-file (find-files "." "\\.rmeta$"))
+
+ (mkdir-p (dirname rustc))
+ (copy-file "bin/rustc_binary" rustc)
+
+ (wrap-program rustc
+ `("LD_LIBRARY_PATH" = (,system-lib-prefix)))
+ (mkdir-p lib)
+ (copy-recursively "lib" lib)
+ (install-file "bin/cargo" cargo-bin))))))))
+ (synopsis "Compiler for the Rust programming language")
+ (description "Rust is a systems programming language that provides memory
+safety and thread safety guarantees.")
+ (home-page "https://github.com/thepowersgang/mrustc")
+
+ ;; List of systems where rust-bootstrap is explicitly known to build:
+ (supported-systems '("x86_64-linux"))
+
+ ;; Dual licensed.
+ (license (list license:asl2.0 license:expat))))
+
(define-public rust-1.55
(package
(name "rust")
@@ -1679,11 +1894,14 @@ ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
(substitute-keyword-arguments (package-arguments base-rust)
((#:phases phases)
`(modify-phases ,phases
- ;; Adjust the stack size so we don't error out on some machines.
- #;
- (add-before 'build 'set-stack-size
- (lambda _
- (setenv "RUST_MIN_STACK" "16777216")))
+ ,@(if (supported-package? rust-bootstrap-1.90)
+ `((add-after 'unpack 'add-cc-shim-to-path
+ (lambda _
+ (mkdir-p "/tmp/bin")
+ (symlink (which "gcc") "/tmp/bin/cc")
+ (setenv "PATH"
+ (string-append "/tmp/bin:" (getenv
"PATH"))))))
+ '())
(replace 'install
;; Rust 1.91+ outputs to stage2 instead of stage1.
;; Cannot use './x.py install' as it runs generate-copyright
@@ -1707,7 +1925,15 @@ ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
(find-files "stage2/lib/rustlib"
"^librustc_driver.*\\.so$"))
(copy-recursively "stage2/lib"
- (string-append out "/lib")))))))))))))
+ (string-append out "/lib"))))))))))
+ (native-inputs
+ (if (supported-package? rust-bootstrap-1.90)
+ (list pkg-config
+ python-minimal-wrapper
+ python-setuptools-bootstrap
+ rust-bootstrap-1.90
+ (list rust-bootstrap-1.90 "cargo"))
+ (package-native-inputs base-rust))))))
(define-public rust-1.92
(let ((base-rust
@@ -1766,7 +1992,12 @@ ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
"vendor/tempfile-3.21.0/Cargo.toml"
"vendor/tempfile-3.23.0/Cargo.toml")
(("features = \\[\"fs\"" all)
- (string-append all ", \"use-libc\""))))))))))
+ (string-append all ", \"use-libc\"")))))))
+ (arguments
+ (substitute-keyword-arguments (package-arguments base-rust)
+ ((#:phases phases)
+ `(modify-phases ,phases
+ (delete 'add-cc-shim-to-path))))))))
(define-public rust-1.93
(let ((base-rust