diff options
| author | Morgan Smith <Morgan.J.Smith@outlook.com> | 2025-04-07 16:07:46 -0400 |
|---|---|---|
| committer | Hilton Chain <hako@ultrarare.space> | 2025-08-21 19:08:56 +0800 |
| commit | e4169eafef1e29ff2fd2e5b6c110a69e1745409c (patch) | |
| tree | d48444149b1b162e74b0aea62b2f6ed5755970df /gnu/packages | |
| parent | 14c3cb13410722d17222d975190875552ff8b6f3 (diff) | |
gnu: Add rust-bootstrap-1.74.
* gnu/packages/rust.scm(rust-bootstrap-1.74): New variable.
(rust-bootstrap): Rename to rust-bootstrap-1.54.
(rust-1.55)[native-inputs]: Adjust accordingly.
* gnu/packages/emacs-xyz.scm (emacs-flycheck-rust)[native-inputs]: Adjust
accordingly.
Change-Id: Id88e200015ed6ab246407e37eeb4159cb4df195d
Signed-off-by: Efraim Flashner <efraim@flashner.co.il>
Signed-off-by: Hilton Chain <hako@ultrarare.space>
Diffstat (limited to 'gnu/packages')
| -rw-r--r-- | gnu/packages/emacs-xyz.scm | 7 | ||||
| -rw-r--r-- | gnu/packages/rust.scm | 189 |
2 files changed, 188 insertions, 8 deletions
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm index e03eba1e984..0acf7f15a13 100644 --- a/gnu/packages/emacs-xyz.scm +++ b/gnu/packages/emacs-xyz.scm | |||
| @@ -10406,9 +10406,10 @@ errors.") | |||
| 10406 | (base32 "1fh6j5w2387nh2fwwjphkhq17cgj5m2q5k0fhidvgc2w65lzbr1r")))) | 10406 | (base32 "1fh6j5w2387nh2fwwjphkhq17cgj5m2q5k0fhidvgc2w65lzbr1r")))) |
| 10407 | (propagated-inputs | 10407 | (propagated-inputs |
| 10408 | (list emacs-dash emacs-flycheck emacs-let-alist)) | 10408 | (list emacs-dash emacs-flycheck emacs-let-alist)) |
| 10409 | (native-inputs (list emacs-buttercup | 10409 | (native-inputs |
| 10410 | rust-bootstrap | 10410 | (list emacs-buttercup |
| 10411 | `(,rust-bootstrap "cargo"))) | 10411 | rust-bootstrap-1.54 |
| 10412 | `(,rust-bootstrap-1.54 "cargo"))) | ||
| 10412 | (build-system emacs-build-system) | 10413 | (build-system emacs-build-system) |
| 10413 | (home-page "https://github.com/flycheck/flycheck-rust") | 10414 | (home-page "https://github.com/flycheck/flycheck-rust") |
| 10414 | (synopsis "Rust/Cargo support for Flycheck") | 10415 | (synopsis "Rust/Cargo support for Flycheck") |
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 67ce9c57d6c..8dd3f2eb0ac 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm | |||
| @@ -157,9 +157,9 @@ | |||
| 157 | ;; Don't use the vendored openssl sources. | 157 | ;; Don't use the vendored openssl sources. |
| 158 | (("--features vendored-openssl") ""))))))) | 158 | (("--features vendored-openssl") ""))))))) |
| 159 | 159 | ||
| 160 | ;;; Rust 1.54 is special in that it is built with mrustc, which shortens the | 160 | ;;; The rust-bootstrap packages are special in that they are built with mrustc, |
| 161 | ;;; bootstrap path. | 161 | ;;; which shortens the bootstrap path. |
| 162 | (define-public rust-bootstrap | 162 | (define-public rust-bootstrap-1.54 |
| 163 | (package | 163 | (package |
| 164 | (name "rust") | 164 | (name "rust") |
| 165 | (version "1.54.0") | 165 | (version "1.54.0") |
| @@ -341,6 +341,185 @@ safety and thread safety guarantees.") | |||
| 341 | ;; Dual licensed. | 341 | ;; Dual licensed. |
| 342 | (license (list license:asl2.0 license:expat)))) | 342 | (license (list license:asl2.0 license:expat)))) |
| 343 | 343 | ||
| 344 | (define-public rust-bootstrap-1.74 | ||
| 345 | (package | ||
| 346 | (name "rust") | ||
| 347 | (version "1.74.0") | ||
| 348 | (source | ||
| 349 | (origin | ||
| 350 | (method url-fetch) | ||
| 351 | (uri (rust-uri version)) | ||
| 352 | (sha256 (base32 "0j8hrwjjjjf7spy0hy7gami96swhfzr6kandfzzdri91qd5mhaw8")) | ||
| 353 | (modules '((guix build utils))) | ||
| 354 | (snippet | ||
| 355 | '(begin | ||
| 356 | (for-each delete-file-recursively | ||
| 357 | '("src/llvm-project" | ||
| 358 | "vendor/openssl-src/openssl" | ||
| 359 | "vendor/tikv-jemalloc-sys/jemalloc")) | ||
| 360 | ;; Remove vendored dynamically linked libraries. | ||
| 361 | ;; find . -not -type d -executable -exec file {} \+ | grep ELF | ||
| 362 | ;; Also remove the bundled (mostly Windows) libraries. | ||
| 363 | (for-each delete-file | ||
| 364 | (find-files "vendor" "\\.(a|dll|exe|lib)$")) | ||
| 365 | ;; Adjust vendored dependency to explicitly use rustix with libc backend. | ||
| 366 | (substitute* "vendor/tempfile/Cargo.toml" | ||
| 367 | (("features = \\[\"fs\"" all) | ||
| 368 | (string-append all ", \"use-libc\""))))) | ||
| 369 | ;; Rust 1.70 adds the rustix library which depends on the vendored | ||
| 370 | ;; fd-lock crate. The fd-lock crate uses Outline assembly which expects | ||
| 371 | ;; a precompiled static library. Enabling the "cc" feature tells the | ||
| 372 | ;; build.rs script to compile the assembly files instead of searching | ||
| 373 | ;; for a precompiled library. | ||
| 374 | (patches (search-patches "rust-1.70-fix-rustix-build.patch")))) | ||
| 375 | (outputs '("out" "cargo")) | ||
| 376 | (properties '((hidden? . #t) | ||
| 377 | (timeout . 129600) ;36 hours | ||
| 378 | (max-silent-time . 18000))) ;5 hours (for riscv64) | ||
| 379 | (build-system gnu-build-system) | ||
| 380 | (inputs | ||
| 381 | (list bash-minimal | ||
| 382 | llvm-17 | ||
| 383 | openssl | ||
| 384 | zlib)) | ||
| 385 | (native-inputs | ||
| 386 | (list pkg-config %mrustc-source)) | ||
| 387 | (arguments | ||
| 388 | (list | ||
| 389 | #:imported-modules %cargo-utils-modules ;for `generate-all-checksums' | ||
| 390 | #:modules '((guix build cargo-utils) | ||
| 391 | (guix build utils) | ||
| 392 | (guix build gnu-build-system)) | ||
| 393 | #:test-target "test" | ||
| 394 | ;; Rust's own .so library files are not found in any RUNPATH, but | ||
| 395 | ;; that doesn't seem to cause issues. | ||
| 396 | #:validate-runpath? #f | ||
| 397 | #:make-flags | ||
| 398 | #~(let ((source #$(package-source this-package))) | ||
| 399 | (list (string-append "RUSTC_TARGET=" | ||
| 400 | #$(platform-rust-target | ||
| 401 | (lookup-platform-by-target-or-system | ||
| 402 | (or (%current-target-system) | ||
| 403 | (%current-system))))) | ||
| 404 | (string-append "RUSTC_VERSION=" #$version) | ||
| 405 | (string-append "MRUSTC_TARGET_VER=" | ||
| 406 | #$(version-major+minor version)) | ||
| 407 | (string-append "RUSTC_SRC_TARBALL=" source) | ||
| 408 | "OUTDIR_SUF=")) ;do not add version suffix to output dir | ||
| 409 | #:phases | ||
| 410 | #~(modify-phases %standard-phases | ||
| 411 | (replace 'unpack | ||
| 412 | (lambda* (#:key source inputs #:allow-other-keys) | ||
| 413 | ((assoc-ref %standard-phases 'unpack) | ||
| 414 | #:source #$(this-package-native-input | ||
| 415 | (origin-file-name %mrustc-source))))) | ||
| 416 | (add-after 'unpack 'patch-makefiles | ||
| 417 | ;; This disables building the (unbundled) LLVM. | ||
| 418 | (lambda* (#:key inputs #:allow-other-keys) | ||
| 419 | (substitute* '("minicargo.mk" | ||
| 420 | "run_rustc/Makefile") | ||
| 421 | ;; Use the system-provided LLVM. | ||
| 422 | (("LLVM_CONFIG [:|?]= .*") | ||
| 423 | (string-append "LLVM_CONFIG := " | ||
| 424 | (search-input-file inputs "/bin/llvm-config") "\n"))) | ||
| 425 | (substitute* "Makefile" | ||
| 426 | ;; Patch date and git obtained version information. | ||
| 427 | ((" -D VERSION_GIT_FULLHASH=.*") | ||
| 428 | (string-append | ||
| 429 | " -D VERSION_GIT_FULLHASH=\\\"" #$%mrustc-commit "\\\"" | ||
| 430 | " -D VERSION_GIT_BRANCH=\\\"master\\\"" | ||
| 431 | " -D VERSION_GIT_SHORTHASH=\\\"" | ||
| 432 | #$(string-take %mrustc-commit 7) "\\\"" | ||
| 433 | " -D VERSION_BUILDTIME=" | ||
| 434 | "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\"" | ||
| 435 | " -D VERSION_GIT_ISDIRTY=0\n"))) | ||
| 436 | (substitute* '("run_rustc/Makefile" | ||
| 437 | "run_rustc/rustc_proxy.sh") | ||
| 438 | ;; Patch the shebang of a generated wrapper for rustc | ||
| 439 | (("#!/bin/sh") | ||
| 440 | (string-append "#!" (which "sh")))))) | ||
| 441 | (add-before 'configure 'configure-cargo-home | ||
| 442 | (lambda _ | ||
| 443 | (let ((cargo-home (string-append (getcwd) "/.cargo"))) | ||
| 444 | (mkdir-p cargo-home) | ||
| 445 | (setenv "CARGO_HOME" cargo-home)))) | ||
| 446 | (replace 'configure | ||
| 447 | (lambda _ | ||
| 448 | (setenv "CC" "gcc") | ||
| 449 | (setenv "CXX" "g++") | ||
| 450 | ;; The Guix LLVM package installs only shared libraries. | ||
| 451 | (setenv "LLVM_LINK_SHARED" "1") | ||
| 452 | ;; rustc still insists on having 'cc' on PATH in some places | ||
| 453 | ;; (e.g. when building the 'test' library crate). | ||
| 454 | (mkdir-p "/tmp/bin") | ||
| 455 | (symlink (which "gcc") "/tmp/bin/cc") | ||
| 456 | (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH"))))) | ||
| 457 | (delete 'patch-generated-file-shebangs) | ||
| 458 | (replace 'build | ||
| 459 | (lambda* (#:key make-flags parallel-build? #:allow-other-keys) | ||
| 460 | (let ((job-count (if parallel-build? | ||
| 461 | (parallel-job-count) | ||
| 462 | 1))) | ||
| 463 | ;; Adapted from: | ||
| 464 | ;; https://github.com/dtolnay/bootstrap/blob/master/build-1.54.0.sh. | ||
| 465 | ;; Use PARLEVEL since both minicargo and mrustc use it | ||
| 466 | ;; to set the level of parallelism. | ||
| 467 | (setenv "PARLEVEL" (number->string job-count)) | ||
| 468 | (display "Building mrustc...\n") | ||
| 469 | (apply invoke "make" make-flags) | ||
| 470 | |||
| 471 | ;; This doesn't seem to build anything, but it | ||
| 472 | ;; sets additional minicargo flags. | ||
| 473 | (display "Building RUSTCSRC...\n") | ||
| 474 | (apply invoke "make" "RUSTCSRC" make-flags) | ||
| 475 | |||
| 476 | ;; This probably doesn't need to be called explicitly. | ||
| 477 | (display "Building LIBS...\n") | ||
| 478 | (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags) | ||
| 479 | |||
| 480 | (display "Building rustc...\n") | ||
| 481 | (apply invoke "make" "-f" "minicargo.mk" "output/rustc" | ||
| 482 | make-flags) | ||
| 483 | |||
| 484 | (display "Building cargo...\n") | ||
| 485 | (apply invoke "make" "-f" "minicargo.mk" "output/cargo" | ||
| 486 | make-flags) | ||
| 487 | |||
| 488 | ;; This one isn't listed in the build script. | ||
| 489 | (display "Rebuilding stdlib with rustc...\n") | ||
| 490 | (apply invoke "make" "-C" "run_rustc" make-flags)))) | ||
| 491 | (replace 'install | ||
| 492 | (lambda* (#:key inputs outputs #:allow-other-keys) | ||
| 493 | (let* ((out (assoc-ref outputs "out")) | ||
| 494 | (cargo (assoc-ref outputs "cargo")) | ||
| 495 | (bin (string-append out "/bin")) | ||
| 496 | (rustc (string-append bin "/rustc")) | ||
| 497 | (cargo-bin (string-append cargo "/bin")) | ||
| 498 | (lib (string-append out "/lib")) | ||
| 499 | (system-lib-prefix | ||
| 500 | (string-append lib "/rustlib/" | ||
| 501 | #$(platform-rust-target | ||
| 502 | (lookup-platform-by-target-or-system | ||
| 503 | (or (%current-target-system) | ||
| 504 | (%current-system)))) "/lib"))) | ||
| 505 | (mkdir-p (dirname rustc)) | ||
| 506 | (copy-file "run_rustc/output/prefix/bin/rustc_binary" rustc) | ||
| 507 | (wrap-program rustc | ||
| 508 | `("LD_LIBRARY_PATH" = (,system-lib-prefix))) | ||
| 509 | (mkdir-p lib) | ||
| 510 | (copy-recursively "run_rustc/output/prefix/lib" lib) | ||
| 511 | (install-file "run_rustc/output/prefix/bin/cargo" cargo-bin))))))) | ||
| 512 | (synopsis "Compiler for the Rust programming language") | ||
| 513 | (description "Rust is a systems programming language that provides memory | ||
| 514 | safety and thread safety guarantees.") | ||
| 515 | (home-page "https://github.com/thepowersgang/mrustc") | ||
| 516 | |||
| 517 | ;; List of systems where rust-bootstrap is explicitly known to build: | ||
| 518 | (supported-systems '("x86_64-linux")) | ||
| 519 | |||
| 520 | ;; Dual licensed. | ||
| 521 | (license (list license:asl2.0 license:expat)))) | ||
| 522 | |||
| 344 | (define-public rust-1.55 | 523 | (define-public rust-1.55 |
| 345 | (package | 524 | (package |
| 346 | (name "rust") | 525 | (name "rust") |
| @@ -490,8 +669,8 @@ ar = \"" binutils "/bin/ar" "\" | |||
| 490 | (native-inputs | 669 | (native-inputs |
| 491 | `(("pkg-config" ,pkg-config) | 670 | `(("pkg-config" ,pkg-config) |
| 492 | ("python" ,python-minimal-wrapper) | 671 | ("python" ,python-minimal-wrapper) |
| 493 | ("rustc-bootstrap" ,rust-bootstrap) | 672 | ("rustc-bootstrap" ,rust-bootstrap-1.54) |
| 494 | ("cargo-bootstrap" ,rust-bootstrap "cargo"))) | 673 | ("cargo-bootstrap" ,rust-bootstrap-1.54 "cargo"))) |
| 495 | (inputs | 674 | (inputs |
| 496 | `(("bash" ,bash-minimal) | 675 | `(("bash" ,bash-minimal) |
| 497 | ("llvm" ,llvm-13) | 676 | ("llvm" ,llvm-13) |
