| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 |
|
| 38 | (define-module (gnu packages rust)
|
| 39 | #:use-module (gnu packages base)
|
| 40 | #:use-module (gnu packages bash)
|
| 41 | #:use-module (gnu packages bison)
|
| 42 | #:use-module (gnu packages bootstrap)
|
| 43 | #:use-module (gnu packages cmake)
|
| 44 | #:use-module (gnu packages compression)
|
| 45 | #:use-module (gnu packages cross-base)
|
| 46 | #:use-module (gnu packages curl)
|
| 47 | #:use-module (gnu packages elf)
|
| 48 | #:use-module (gnu packages compiler-tools)
|
| 49 | #:use-module (gnu packages gcc)
|
| 50 | #:use-module (gnu packages gdb)
|
| 51 | #:use-module (gnu packages libffi)
|
| 52 | #:use-module (gnu packages linux)
|
| 53 | #:use-module (gnu packages llvm)
|
| 54 | #:use-module (gnu packages llvm-meta)
|
| 55 | #:use-module (gnu packages mingw)
|
| 56 | #:use-module (gnu packages pkg-config)
|
| 57 | #:use-module (gnu packages python)
|
| 58 | #:use-module (gnu packages python-build)
|
| 59 | #:use-module (gnu packages ssh)
|
| 60 | #:use-module (gnu packages tls)
|
| 61 | #:use-module (gnu packages version-control)
|
| 62 | #:use-module (gnu packages web)
|
| 63 | #:use-module (gnu packages)
|
| 64 | #:use-module (guix build-system cargo)
|
| 65 | #:use-module (guix build-system gnu)
|
| 66 | #:use-module (guix build-system trivial)
|
| 67 | #:use-module (guix search-paths)
|
| 68 | #:use-module (guix download)
|
| 69 | #:use-module (guix memoization)
|
| 70 | #:use-module (guix git-download)
|
| 71 | #:use-module ((guix licenses) #:prefix license:)
|
| 72 | #:use-module (guix packages)
|
| 73 | #:use-module (guix platform)
|
| 74 | #:use-module ((guix build utils) #:select (alist-replace))
|
| 75 | #:use-module (guix utils)
|
| 76 | #:use-module (guix gexp)
|
| 77 | #:use-module (ice-9 match)
|
| 78 | #:use-module (ice-9 optargs)
|
| 79 | #:use-module (srfi srfi-1)
|
| 80 | #:use-module (srfi srfi-26)
|
| 81 | #:use-module (srfi srfi-34)
|
| 82 | #:use-module (srfi srfi-35))
|
| 83 |
|
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | (define %cargo-reference-hash
|
| 111 | "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855")
|
| 112 |
|
| 113 | (define* (rust-uri version #:key (dist "static"))
|
| 114 | (string-append "https://" dist ".rust-lang.org/dist/"
|
| 115 | "rustc-" version "-src.tar.gz"))
|
| 116 |
|
| 117 | (define* (rust-bootstrapped-package base-rust version checksum)
|
| 118 | "Bootstrap rust VERSION with source checksum CHECKSUM using BASE-RUST."
|
| 119 | (package
|
| 120 | (inherit base-rust)
|
| 121 | (version version)
|
| 122 | (source
|
| 123 | (origin
|
| 124 | (inherit (package-source base-rust))
|
| 125 | (uri (rust-uri version))
|
| 126 | (sha256 (base32 checksum))))
|
| 127 | (arguments
|
| 128 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 129 | ((#:disallowed-references _ '())
|
| 130 | (list (this-package-native-input "rustc-bootstrap")))))
|
| 131 | (native-inputs
|
| 132 | (modify-inputs native-inputs
|
| 133 | (replace "rustc-bootstrap" base-rust)
|
| 134 | (replace "cargo-bootstrap" (list base-rust "cargo"))))))
|
| 135 |
|
| 136 | |
| 137 | |
| 138 | (define %mrustc-commit "06b87d1af49d2db3bd850fdee8888055dd540dd1")
|
| 139 | (define %mrustc-source
|
| 140 | (let* ((version "0.11.2")
|
| 141 | (commit %mrustc-commit)
|
| 142 | (revision "1")
|
| 143 | (name "mrustc"))
|
| 144 | (origin
|
| 145 | (method git-fetch)
|
| 146 | (uri (git-reference
|
| 147 | (url "https://github.com/thepowersgang/mrustc")
|
| 148 | (commit %mrustc-commit)))
|
| 149 | (file-name (git-file-name name (git-version version revision commit)))
|
| 150 | (sha256
|
| 151 | (base32 "1m6ya3d653b5z0ygvr4y8hay1445gww9s8vyk8h0jdi42zkhzqkf"))
|
| 152 | (patches (search-patches "mrustc-patches.patch"))
|
| 153 | (modules '((guix build utils)))
|
| 154 | (snippet
|
| 155 | '(begin
|
| 156 | |
| 157 | |
| 158 | (substitute* (find-files "." "Makefile")
|
| 159 | (("LINKFLAGS := -g") "LINKFLAGS :=")
|
| 160 | (("-g ") ""))
|
| 161 | (substitute* "minicargo.mk"
|
| 162 | |
| 163 | (("-xzf") "-xf")
|
| 164 | |
| 165 | (("--features vendored-openssl") "")))))))
|
| 166 |
|
| 167 | |
| 168 | |
| 169 | (define-public rust-bootstrap-1.54
|
| 170 | (package
|
| 171 | (name "rust")
|
| 172 | (version "1.54.0")
|
| 173 | (source
|
| 174 | (origin
|
| 175 | (method url-fetch)
|
| 176 | (uri (rust-uri version))
|
| 177 | (sha256 (base32 "0xk9dhfff16caambmwij67zgshd8v9djw6ha0fnnanlv7rii31dc"))
|
| 178 | (modules '((guix build utils)))
|
| 179 | (snippet
|
| 180 | '(begin
|
| 181 | (for-each delete-file-recursively
|
| 182 | '("src/llvm-project"
|
| 183 | "vendor/openssl-src/openssl"
|
| 184 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 185 | |
| 186 | |
| 187 | (delete-file "vendor/vte/vim10m_match")
|
| 188 | (delete-file "vendor/vte/vim10m_table")
|
| 189 | |
| 190 | |
| 191 | (for-each delete-file
|
| 192 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 193 | |
| 194 | |
| 195 | (substitute* (find-files "." "powerpc64le_unknown_linux_gnu.rs")
|
| 196 | (("e-m:e-i64:64-n32:64-v256:256:256-v512:512:512")
|
| 197 | "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"))))))
|
| 198 | (outputs '("out" "cargo"))
|
| 199 | (properties '((hidden? . #t)
|
| 200 | (timeout . 129600) |
| 201 | (max-silent-time . 18000))) |
| 202 | (build-system gnu-build-system)
|
| 203 | (inputs
|
| 204 | (list bash-minimal
|
| 205 | llvm-13
|
| 206 | openssl-1.1
|
| 207 | zlib))
|
| 208 | (native-inputs
|
| 209 | `(("pkg-config" ,pkg-config)
|
| 210 | ("mrustc-source" ,%mrustc-source)))
|
| 211 | (arguments
|
| 212 | `(#:imported-modules ,%cargo-utils-modules |
| 213 | #:modules ((guix build cargo-utils)
|
| 214 | (guix build utils)
|
| 215 | (guix build gnu-build-system))
|
| 216 | #:test-target "test"
|
| 217 | |
| 218 | |
| 219 | #:validate-runpath? #f
|
| 220 | #:make-flags
|
| 221 | ,#~(let ((source #$(package-source this-package)))
|
| 222 | (list (string-append "RUSTC_TARGET="
|
| 223 | #$(platform-rust-target
|
| 224 | (lookup-platform-by-target-or-system
|
| 225 | (or (%current-target-system)
|
| 226 | (%current-system)))))
|
| 227 | (string-append "RUSTC_VERSION=" #$version)
|
| 228 | (string-append "MRUSTC_TARGET_VER="
|
| 229 | #$(version-major+minor version))
|
| 230 | (string-append "RUSTC_SRC_TARBALL=" source)
|
| 231 | "OUTDIR_SUF=")) |
| 232 | #:phases
|
| 233 | (modify-phases %standard-phases
|
| 234 | (replace 'unpack
|
| 235 | (lambda* (#:key source inputs #:allow-other-keys)
|
| 236 | ((assoc-ref %standard-phases 'unpack)
|
| 237 | #:source (assoc-ref inputs "mrustc-source"))))
|
| 238 | (add-after 'unpack 'patch-makefiles
|
| 239 | |
| 240 | (lambda* (#:key inputs #:allow-other-keys)
|
| 241 | (substitute* '("minicargo.mk"
|
| 242 | "run_rustc/Makefile")
|
| 243 | |
| 244 | (("LLVM_CONFIG [:|?]= .*")
|
| 245 | (string-append "LLVM_CONFIG := "
|
| 246 | (search-input-file inputs "/bin/llvm-config") "\n")))
|
| 247 | (substitute* "Makefile"
|
| 248 | |
| 249 | ((" -D VERSION_GIT_FULLHASH=.*")
|
| 250 | (string-append
|
| 251 | " -D VERSION_GIT_FULLHASH=\\\"" ,%mrustc-commit "\\\""
|
| 252 | " -D VERSION_GIT_BRANCH=\\\"master\\\""
|
| 253 | " -D VERSION_GIT_SHORTHASH=\\\""
|
| 254 | ,(string-take %mrustc-commit 7) "\\\""
|
| 255 | " -D VERSION_BUILDTIME="
|
| 256 | "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\""
|
| 257 | " -D VERSION_GIT_ISDIRTY=0\n")))
|
| 258 | (substitute* '("run_rustc/Makefile"
|
| 259 | "run_rustc/rustc_proxy.sh")
|
| 260 | |
| 261 | (("#!/bin/sh")
|
| 262 | (string-append "#!" (which "sh"))))))
|
| 263 | (add-before 'configure 'configure-cargo-home
|
| 264 | (lambda _
|
| 265 | (let ((cargo-home (string-append (getcwd) "/.cargo")))
|
| 266 | (mkdir-p cargo-home)
|
| 267 | (setenv "CARGO_HOME" cargo-home))))
|
| 268 | (replace 'configure
|
| 269 | (lambda _
|
| 270 | (setenv "CC" "gcc")
|
| 271 | (setenv "CXX" "g++")
|
| 272 | |
| 273 | (setenv "LLVM_LINK_SHARED" "1")
|
| 274 | |
| 275 | |
| 276 | (mkdir-p "/tmp/bin")
|
| 277 | (symlink (which "gcc") "/tmp/bin/cc")
|
| 278 | (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))
|
| 279 | (delete 'patch-generated-file-shebangs)
|
| 280 | (replace 'build
|
| 281 | (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
|
| 282 | (let ((job-count (if parallel-build?
|
| 283 | (parallel-job-count)
|
| 284 | 1)))
|
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | (setenv "PARLEVEL" (number->string job-count))
|
| 290 | (display "Building mrustc...\n")
|
| 291 | (apply invoke "make" make-flags)
|
| 292 |
|
| 293 | |
| 294 | |
| 295 | (display "Building RUSTCSRC...\n")
|
| 296 | (apply invoke "make" "RUSTCSRC" make-flags)
|
| 297 |
|
| 298 | |
| 299 | (display "Building LIBS...\n")
|
| 300 | (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags)
|
| 301 |
|
| 302 | |
| 303 | (display "Building rustc...\n")
|
| 304 | (apply invoke "make" "-f" "minicargo.mk" "output/rustc"
|
| 305 | make-flags)
|
| 306 |
|
| 307 | (display "Building cargo...\n")
|
| 308 | (apply invoke "make" "-f" "minicargo.mk" "output/cargo"
|
| 309 | make-flags)
|
| 310 |
|
| 311 | |
| 312 | (display "Rebuilding stdlib with rustc...\n")
|
| 313 | (apply invoke "make" "-C" "run_rustc" make-flags))))
|
| 314 | (replace 'install
|
| 315 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 316 | (let* ((out (assoc-ref outputs "out"))
|
| 317 | (cargo (assoc-ref outputs "cargo"))
|
| 318 | (bin (string-append out "/bin"))
|
| 319 | (rustc (string-append bin "/rustc"))
|
| 320 | (cargo-bin (string-append cargo "/bin"))
|
| 321 | (lib (string-append out "/lib"))
|
| 322 | (system-lib-prefix
|
| 323 | (string-append lib "/rustlib/"
|
| 324 | ,(platform-rust-target
|
| 325 | (lookup-platform-by-target-or-system
|
| 326 | (or (%current-target-system)
|
| 327 | (%current-system)))) "/lib")))
|
| 328 | (with-directory-excursion "run_rustc/output/prefix"
|
| 329 | (mkdir-p (dirname rustc))
|
| 330 | (copy-file "bin/rustc_binary" rustc)
|
| 331 |
|
| 332 | (wrap-program rustc
|
| 333 | `("LD_LIBRARY_PATH" = (,system-lib-prefix)))
|
| 334 | (mkdir-p lib)
|
| 335 | (copy-recursively "lib" lib)
|
| 336 | (install-file "bin/cargo" cargo-bin))))))))
|
| 337 | (synopsis "Compiler for the Rust programming language")
|
| 338 | (description "Rust is a systems programming language that provides memory
|
| 339 | safety and thread safety guarantees.")
|
| 340 | (home-page "https://github.com/thepowersgang/mrustc")
|
| 341 |
|
| 342 | |
| 343 | |
| 344 | |
| 345 | |
| 346 | |
| 347 | (supported-systems '("x86_64-linux" "aarch64-linux"
|
| 348 | "riscv64-linux" "powerpc64le-linux"))
|
| 349 |
|
| 350 | |
| 351 | (license (list license:asl2.0 license:expat))))
|
| 352 |
|
| 353 | (define-public rust-bootstrap-1.74
|
| 354 | (package
|
| 355 | (name "rust")
|
| 356 | (version "1.74.0")
|
| 357 | (source
|
| 358 | (origin
|
| 359 | (method url-fetch)
|
| 360 | (uri (rust-uri version))
|
| 361 | (sha256 (base32 "0j8hrwjjjjf7spy0hy7gami96swhfzr6kandfzzdri91qd5mhaw8"))
|
| 362 | (modules '((guix build utils)))
|
| 363 | (snippet
|
| 364 | '(begin
|
| 365 | (for-each delete-file-recursively
|
| 366 | '("src/llvm-project"
|
| 367 | "vendor/openssl-src/openssl"
|
| 368 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 369 | |
| 370 | |
| 371 | |
| 372 | (for-each delete-file
|
| 373 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 374 | |
| 375 | (substitute* "vendor/tempfile/Cargo.toml"
|
| 376 | (("features = \\[\"fs\"" all)
|
| 377 | (string-append all ", \"use-libc\"")))))
|
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | (patches (search-patches "rust-1.70-fix-rustix-build.patch"))))
|
| 384 | (outputs '("out" "cargo"))
|
| 385 | (properties '((hidden? . #t)
|
| 386 | (timeout . 129600) |
| 387 | (max-silent-time . 18000))) |
| 388 | (build-system gnu-build-system)
|
| 389 | (inputs
|
| 390 | (list bash-minimal
|
| 391 | llvm-17
|
| 392 | openssl
|
| 393 | zlib))
|
| 394 | (native-inputs
|
| 395 | (list pkg-config %mrustc-source))
|
| 396 | (arguments
|
| 397 | (list
|
| 398 | #:imported-modules %cargo-utils-modules |
| 399 | #:modules '((guix build cargo-utils)
|
| 400 | (guix build utils)
|
| 401 | (guix build gnu-build-system))
|
| 402 | #:test-target "test"
|
| 403 | |
| 404 | |
| 405 | #:validate-runpath? #f
|
| 406 | #:make-flags
|
| 407 | #~(let ((source #$(package-source this-package)))
|
| 408 | (list (string-append "RUSTC_TARGET="
|
| 409 | #$(platform-rust-target
|
| 410 | (lookup-platform-by-target-or-system
|
| 411 | (or (%current-target-system)
|
| 412 | (%current-system)))))
|
| 413 | (string-append "RUSTC_VERSION=" #$version)
|
| 414 | (string-append "MRUSTC_TARGET_VER="
|
| 415 | #$(version-major+minor version))
|
| 416 | (string-append "RUSTC_SRC_TARBALL=" source)
|
| 417 | "OUTDIR_SUF=")) |
| 418 | #:phases
|
| 419 | #~(modify-phases %standard-phases
|
| 420 | (replace 'unpack
|
| 421 | (lambda* (#:key source inputs #:allow-other-keys)
|
| 422 | ((assoc-ref %standard-phases 'unpack)
|
| 423 | #:source #$(this-package-native-input
|
| 424 | (origin-file-name %mrustc-source)))))
|
| 425 | (add-after 'unpack 'patch-makefiles
|
| 426 | |
| 427 | (lambda* (#:key inputs #:allow-other-keys)
|
| 428 | (substitute* '("minicargo.mk"
|
| 429 | "run_rustc/Makefile")
|
| 430 | |
| 431 | (("LLVM_CONFIG [:|?]= .*")
|
| 432 | (string-append "LLVM_CONFIG := "
|
| 433 | (search-input-file inputs "/bin/llvm-config") "\n")))
|
| 434 | (substitute* "Makefile"
|
| 435 | |
| 436 | ((" -D VERSION_GIT_FULLHASH=.*")
|
| 437 | (string-append
|
| 438 | " -D VERSION_GIT_FULLHASH=\\\"" #$%mrustc-commit "\\\""
|
| 439 | " -D VERSION_GIT_BRANCH=\\\"master\\\""
|
| 440 | " -D VERSION_GIT_SHORTHASH=\\\""
|
| 441 | #$(string-take %mrustc-commit 7) "\\\""
|
| 442 | " -D VERSION_BUILDTIME="
|
| 443 | "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\""
|
| 444 | " -D VERSION_GIT_ISDIRTY=0\n")))
|
| 445 | (substitute* '("run_rustc/Makefile"
|
| 446 | "run_rustc/rustc_proxy.sh")
|
| 447 | |
| 448 | (("#!/bin/sh")
|
| 449 | (string-append "#!" (which "sh"))))))
|
| 450 | (add-before 'configure 'configure-cargo-home
|
| 451 | (lambda _
|
| 452 | (let ((cargo-home (string-append (getcwd) "/.cargo")))
|
| 453 | (mkdir-p cargo-home)
|
| 454 | (setenv "CARGO_HOME" cargo-home))))
|
| 455 | (replace 'configure
|
| 456 | (lambda _
|
| 457 | (setenv "CC" "gcc")
|
| 458 | (setenv "CXX" "g++")
|
| 459 | |
| 460 | (setenv "LLVM_LINK_SHARED" "1")
|
| 461 | |
| 462 | |
| 463 | (mkdir-p "/tmp/bin")
|
| 464 | (symlink (which "gcc") "/tmp/bin/cc")
|
| 465 | (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))
|
| 466 | (delete 'patch-generated-file-shebangs)
|
| 467 | (replace 'build
|
| 468 | (lambda* (#:key make-flags parallel-build? #:allow-other-keys)
|
| 469 | (let ((job-count (if parallel-build?
|
| 470 | (parallel-job-count)
|
| 471 | 1)))
|
| 472 | |
| 473 | |
| 474 | |
| 475 | |
| 476 | (setenv "PARLEVEL" (number->string job-count))
|
| 477 | (display "Building mrustc...\n")
|
| 478 | (apply invoke "make" make-flags)
|
| 479 |
|
| 480 | |
| 481 | |
| 482 | (display "Building RUSTCSRC...\n")
|
| 483 | (apply invoke "make" "RUSTCSRC" make-flags)
|
| 484 |
|
| 485 | |
| 486 | (display "Building LIBS...\n")
|
| 487 | (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags)
|
| 488 |
|
| 489 | (display "Building rustc...\n")
|
| 490 | (apply invoke "make" "-f" "minicargo.mk" "output/rustc"
|
| 491 | make-flags)
|
| 492 |
|
| 493 | (display "Building cargo...\n")
|
| 494 | (apply invoke "make" "-f" "minicargo.mk" "output/cargo"
|
| 495 | make-flags)
|
| 496 |
|
| 497 | |
| 498 | (display "Rebuilding stdlib with rustc...\n")
|
| 499 | (apply invoke "make" "-C" "run_rustc" make-flags))))
|
| 500 | (replace 'install
|
| 501 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 502 | (let* ((out (assoc-ref outputs "out"))
|
| 503 | (cargo (assoc-ref outputs "cargo"))
|
| 504 | (bin (string-append out "/bin"))
|
| 505 | (rustc (string-append bin "/rustc"))
|
| 506 | (cargo-bin (string-append cargo "/bin"))
|
| 507 | (lib (string-append out "/lib"))
|
| 508 | (system-lib-prefix
|
| 509 | (string-append lib "/rustlib/"
|
| 510 | #$(platform-rust-target
|
| 511 | (lookup-platform-by-target-or-system
|
| 512 | (or (%current-target-system)
|
| 513 | (%current-system)))) "/lib")))
|
| 514 | (with-directory-excursion "run_rustc/output/prefix"
|
| 515 | |
| 516 | |
| 517 | (for-each delete-file (find-files "." "\\.rmeta$"))
|
| 518 |
|
| 519 | (mkdir-p (dirname rustc))
|
| 520 | (copy-file "bin/rustc_binary" rustc)
|
| 521 |
|
| 522 | (wrap-program rustc
|
| 523 | `("LD_LIBRARY_PATH" = (,system-lib-prefix)))
|
| 524 | (mkdir-p lib)
|
| 525 | (copy-recursively "lib" lib)
|
| 526 | (install-file "bin/cargo" cargo-bin))))))))
|
| 527 | (synopsis "Compiler for the Rust programming language")
|
| 528 | (description "Rust is a systems programming language that provides memory
|
| 529 | safety and thread safety guarantees.")
|
| 530 | (home-page "https://github.com/thepowersgang/mrustc")
|
| 531 |
|
| 532 | |
| 533 | (supported-systems '("x86_64-linux"))
|
| 534 |
|
| 535 | |
| 536 | (license (list license:asl2.0 license:expat))))
|
| 537 |
|
| 538 | (define-public rust-1.55
|
| 539 | (package
|
| 540 | (name "rust")
|
| 541 | (version "1.55.0")
|
| 542 | (source
|
| 543 | (origin
|
| 544 | (method url-fetch)
|
| 545 | (uri (rust-uri version))
|
| 546 | (sha256 (base32 "07l28f7grdmi65naq71pbmvdd61hwcpi40ry7kp7dy7m233rldxj"))
|
| 547 | (modules '((guix build utils)))
|
| 548 | (snippet
|
| 549 | '(begin
|
| 550 | (for-each delete-file-recursively
|
| 551 | '("src/llvm-project"
|
| 552 | "vendor/openssl-src/openssl"
|
| 553 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 554 | |
| 555 | |
| 556 | (delete-file "vendor/vte/vim10m_match")
|
| 557 | (delete-file "vendor/vte/vim10m_table")
|
| 558 | |
| 559 | |
| 560 | (for-each delete-file
|
| 561 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 562 | |
| 563 | (substitute* "vendor/tikv-jemallocator/src/lib.rs"
|
| 564 | ((" target_arch = \"s390x\"," all)
|
| 565 | (string-append all "\n target_arch = \"riscv64\",")))))))
|
| 566 | (outputs '("out" "cargo"))
|
| 567 | (properties '((hidden? . #t)
|
| 568 | (timeout . 72000) |
| 569 | (max-silent-time . 18000))) |
| 570 | (build-system gnu-build-system)
|
| 571 | (arguments
|
| 572 | `(#:validate-runpath? #f
|
| 573 | |
| 574 | |
| 575 | #:tests? #f
|
| 576 | #:imported-modules ,%cargo-utils-modules |
| 577 | #:modules ((guix build cargo-utils)
|
| 578 | (guix build utils)
|
| 579 | (guix build gnu-build-system)
|
| 580 | (ice-9 match)
|
| 581 | (srfi srfi-1))
|
| 582 | #:phases
|
| 583 | (modify-phases %standard-phases
|
| 584 | (add-after 'unpack 'set-env
|
| 585 | (lambda* (#:key inputs #:allow-other-keys)
|
| 586 | (setenv "SHELL" (which "sh"))
|
| 587 | (setenv "CONFIG_SHELL" (which "sh"))
|
| 588 | (setenv "CC" (search-input-file inputs "/bin/gcc"))
|
| 589 | |
| 590 | (setenv "LLVM_LINK_SHARED" "1")))
|
| 591 | (add-after 'unpack 'set-linker-locale-to-utf8
|
| 592 | (lambda _
|
| 593 | (substitute* (find-files "." "^linker.rs$")
|
| 594 | (("linker.env\\(\"LC_ALL\", \"C\"\\);")
|
| 595 | "linker.env(\"LC_ALL\", \"C.UTF-8\");"))))
|
| 596 | (add-after 'unpack 'add-cc-shim-to-path
|
| 597 | (lambda _
|
| 598 | (mkdir-p "/tmp/bin")
|
| 599 | (symlink (which "gcc") "/tmp/bin/cc")
|
| 600 | (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))
|
| 601 | (replace 'configure
|
| 602 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 603 | (let* ((out (assoc-ref outputs "out"))
|
| 604 | (gcc (assoc-ref inputs "gcc"))
|
| 605 | (python (assoc-ref inputs "python"))
|
| 606 | (binutils (assoc-ref inputs "binutils"))
|
| 607 | (rustc (assoc-ref inputs "rustc-bootstrap"))
|
| 608 | (cargo (assoc-ref inputs "cargo-bootstrap"))
|
| 609 | (llvm (assoc-ref inputs "llvm")))
|
| 610 | (call-with-output-file "config.toml"
|
| 611 | (lambda (port)
|
| 612 | (display (string-append "
|
| 613 | [llvm]
|
| 614 | [build]
|
| 615 | cargo = \"" cargo "/bin/cargo" "\"
|
| 616 | rustc = \"" rustc "/bin/rustc" "\"
|
| 617 | docs = false
|
| 618 | python = \"" python "/bin/python" "\"
|
| 619 | vendor = true
|
| 620 | submodules = false
|
| 621 | [install]
|
| 622 | prefix = \"" out "\"
|
| 623 | sysconfdir = \"etc\"
|
| 624 | [rust]
|
| 625 | debug=false
|
| 626 | jemalloc=false
|
| 627 | default-linker = \"" gcc "/bin/gcc" "\"
|
| 628 | channel = \"stable\"
|
| 629 | rpath = true
|
| 630 | [target." ,(platform-rust-target (lookup-platform-by-system (%current-system))) "]
|
| 631 | llvm-config = \"" llvm "/bin/llvm-config" "\"
|
| 632 | cc = \"" gcc "/bin/gcc" "\"
|
| 633 | cxx = \"" gcc "/bin/g++" "\"
|
| 634 | ar = \"" binutils "/bin/ar" "\"
|
| 635 | [dist]
|
| 636 | ") port))))))
|
| 637 | (replace 'build
|
| 638 | |
| 639 | (lambda* (#:key parallel-build? #:allow-other-keys)
|
| 640 | (let ((job-spec (string-append
|
| 641 | "-j" (if parallel-build?
|
| 642 | (number->string (parallel-job-count))
|
| 643 | "1"))))
|
| 644 | (invoke "./x.py" job-spec "build" "--stage=1"
|
| 645 | "library/std"
|
| 646 | "src/tools/cargo"))))
|
| 647 | (replace 'install
|
| 648 | (lambda* (#:key outputs #:allow-other-keys)
|
| 649 | (let* ((out (assoc-ref outputs "out"))
|
| 650 | (cargo-out (assoc-ref outputs "cargo"))
|
| 651 | (build (string-append "build/"
|
| 652 | ,(platform-rust-target
|
| 653 | (lookup-platform-by-target-or-system
|
| 654 | (or (%current-target-system)
|
| 655 | (%current-system)))))))
|
| 656 | |
| 657 | |
| 658 | |
| 659 |
|
| 660 | |
| 661 | |
| 662 | |
| 663 | (with-directory-excursion build
|
| 664 | (install-file "stage1/bin/rustc" (string-append out "/bin"))
|
| 665 | (install-file "stage1-tools-bin/cargo"
|
| 666 | (string-append cargo-out "/bin"))
|
| 667 | |
| 668 | |
| 669 | (for-each delete-file (find-files "stage1/lib" "\\.rmeta$"))
|
| 670 | |
| 671 | |
| 672 | |
| 673 | (for-each delete-file
|
| 674 | (find-files "stage1/lib/rustlib"
|
| 675 | "^librustc_driver.*\\.so$"))
|
| 676 | (copy-recursively "stage1/lib" (string-append out "/lib"))))))
|
| 677 | (add-after 'install 'delete-install-logs
|
| 678 | (lambda* (#:key outputs #:allow-other-keys)
|
| 679 | (for-each (lambda (f)
|
| 680 | (false-if-exception (delete-file f)))
|
| 681 | (append-map (lambda (output)
|
| 682 | (find-files (string-append
|
| 683 | output "/lib/rustlib")
|
| 684 | "(^install.log$|^manifest-)"))
|
| 685 | (map cdr outputs)))))
|
| 686 | (add-after 'install 'wrap-rustc
|
| 687 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 688 | (let ((out (assoc-ref outputs "out"))
|
| 689 | (libc (assoc-ref inputs "libc"))
|
| 690 | (ld-wrapper (assoc-ref inputs "ld-wrapper")))
|
| 691 | |
| 692 | (wrap-program (string-append out "/bin/rustc")
|
| 693 | `("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
|
| 694 | `("LIBRARY_PATH" ":"
|
| 695 | suffix (,(string-append libc "/lib"))))))))))
|
| 696 | (native-inputs
|
| 697 | `(("pkg-config" ,pkg-config)
|
| 698 | ("python" ,python-minimal-wrapper)
|
| 699 | ("python-setuptools" ,python-setuptools-bootstrap)
|
| 700 | ("rustc-bootstrap" ,rust-bootstrap-1.54)
|
| 701 | ("cargo-bootstrap" ,rust-bootstrap-1.54 "cargo")))
|
| 702 | (inputs
|
| 703 | `(("bash" ,bash-minimal)
|
| 704 | ("llvm" ,llvm-13)
|
| 705 | ("openssl" ,openssl)))
|
| 706 | |
| 707 | (native-search-paths
|
| 708 | %gcc-search-paths)
|
| 709 | |
| 710 | (supported-systems '("x86_64-linux" "aarch64-linux" "riscv64-linux"))
|
| 711 | (synopsis "Compiler for the Rust programming language")
|
| 712 | (description "Rust is a systems programming language that provides memory
|
| 713 | safety and thread safety guarantees.")
|
| 714 | (home-page "https://www.rust-lang.org")
|
| 715 | |
| 716 | (license (list license:asl2.0 license:expat))))
|
| 717 |
|
| 718 | (define-public rust-1.56
|
| 719 | (let ((base-rust (rust-bootstrapped-package
|
| 720 | rust-1.55 "1.56.1"
|
| 721 | "04cmqx7nn63hzz7z27b2b0dj2qx18rck9ifvip43s6dampx8v2f3")))
|
| 722 | (package
|
| 723 | (inherit base-rust)
|
| 724 | (arguments
|
| 725 | (substitute-keyword-arguments
|
| 726 | (strip-keyword-arguments '(#:validate-runpath?)
|
| 727 | (package-arguments base-rust))
|
| 728 | ((#:phases phases)
|
| 729 | `(modify-phases ,phases
|
| 730 | (delete 'add-cc-shim-to-path)
|
| 731 | (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums
|
| 732 | (lambda _
|
| 733 | (substitute* "Cargo.lock"
|
| 734 | (("(checksum = )\".*\"" all name)
|
| 735 | (string-append name "\"" ,%cargo-reference-hash "\"")))
|
| 736 | (generate-all-checksums "vendor"))))))))))
|
| 737 |
|
| 738 | (define-public rust-1.57
|
| 739 | (rust-bootstrapped-package
|
| 740 | |
| 741 | |
| 742 | rust-1.56 "1.57.0" "06jw8ka2p3kls8p0gd4p0chhhb1ia1mlvj96zn78n7qvp71zjiim"))
|
| 743 |
|
| 744 | (define-public rust-1.58
|
| 745 | (rust-bootstrapped-package
|
| 746 | |
| 747 | |
| 748 | |
| 749 | |
| 750 | |
| 751 | |
| 752 | rust-1.57 "1.58.1" "1iq7kj16qfpkx8gvw50d8rf7glbm6s0pj2y1qkrz7mi56vfsyfd8"))
|
| 753 |
|
| 754 | (define-public rust-1.59
|
| 755 | (let ((base-rust
|
| 756 | (rust-bootstrapped-package
|
| 757 | |
| 758 | |
| 759 | |
| 760 | |
| 761 | |
| 762 | rust-1.58 "1.59.0" "1yc5bwcbmbwyvpfq7zvra78l0r8y3lbv60kbr62fzz2vx2pfxj57")))
|
| 763 | (package
|
| 764 | (inherit base-rust)
|
| 765 | (arguments
|
| 766 | (if (target-riscv64?)
|
| 767 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 768 | ((#:phases phases)
|
| 769 | `(modify-phases ,phases
|
| 770 | (add-after 'unpack 'revert-riscv-pause-instruction
|
| 771 | (lambda _
|
| 772 | |
| 773 | |
| 774 | |
| 775 | |
| 776 | |
| 777 | |
| 778 | (substitute*
|
| 779 | "library/stdarch/crates/core_arch/src/riscv_shared/mod.rs"
|
| 780 | (("\\.insn i 0x0F, 0, x0, x0, 0x010") ".word 0x0100000F")))))))
|
| 781 | (package-arguments base-rust))))))
|
| 782 |
|
| 783 | (define-public rust-1.60
|
| 784 | (rust-bootstrapped-package
|
| 785 | |
| 786 | |
| 787 | rust-1.59 "1.60.0" "1drqr0a26x1rb2w3kj0i6abhgbs3jx5qqkrcwbwdlx7n3inq5ji0"))
|
| 788 |
|
| 789 | (define-public rust-1.61
|
| 790 | (let ((base-rust
|
| 791 | (rust-bootstrapped-package
|
| 792 | rust-1.60 "1.61.0" "1vfs05hkf9ilk19b2vahqn8l6k17pl9nc1ky9kgspaascx8l62xd")))
|
| 793 | (package
|
| 794 | (inherit base-rust)
|
| 795 | (source
|
| 796 | (origin
|
| 797 | (inherit (package-source base-rust))
|
| 798 | (snippet
|
| 799 | '(begin
|
| 800 | (for-each delete-file-recursively
|
| 801 | '("src/llvm-project"
|
| 802 | "vendor/openssl-src/openssl"
|
| 803 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 804 | |
| 805 | |
| 806 | (delete-file "vendor/vte/vim10m_match")
|
| 807 | (delete-file "vendor/vte/vim10m_table")
|
| 808 | |
| 809 | (for-each delete-file
|
| 810 | (find-files "vendor" "\\.(a|dll|exe|lib)$")))))))))
|
| 811 |
|
| 812 | (define-public rust-1.62
|
| 813 | (rust-bootstrapped-package
|
| 814 | rust-1.61 "1.62.1" "0gqkg34ic77dcvsz69qbdng6g3zfhl6hnhx7ha1mjkyrzipvxb3j"))
|
| 815 |
|
| 816 | (define-public rust-1.63
|
| 817 | (rust-bootstrapped-package
|
| 818 | rust-1.62 "1.63.0" "1l4rrbzhxv88pnfq94nbyb9m6lfnjwixma3mwjkmvvs2aqlq158z"))
|
| 819 |
|
| 820 | (define-public rust-1.64
|
| 821 | (let ((base-rust
|
| 822 | (rust-bootstrapped-package
|
| 823 | rust-1.63 "1.64.0" "018j720b2n12slp4xk64jc6shkncd46d621qdyzh2a8s3r49zkdk")))
|
| 824 | (package
|
| 825 | (inherit base-rust)
|
| 826 | (source
|
| 827 | (origin
|
| 828 | (inherit (package-source base-rust))
|
| 829 | (snippet
|
| 830 | '(begin
|
| 831 | (for-each delete-file-recursively
|
| 832 | '("src/llvm-project"
|
| 833 | "vendor/openssl-src/openssl"
|
| 834 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 835 | |
| 836 | |
| 837 | |
| 838 | (substitute* "src/bootstrap/Cargo.lock"
|
| 839 | (("\"errno\",") "\"cc\",\n \"errno\","))
|
| 840 | |
| 841 | (substitute* "vendor/fd-lock/Cargo.toml"
|
| 842 | (("\"fs\"") "\"fs\", \"cc\""))
|
| 843 | |
| 844 | |
| 845 | (delete-file "vendor/vte/vim10m_match")
|
| 846 | (delete-file "vendor/vte/vim10m_table")
|
| 847 | |
| 848 | (for-each delete-file
|
| 849 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))))
|
| 850 | (patches (search-patches "rust-1.64-fix-riscv64-bootstrap.patch"))
|
| 851 | (patch-flags '("-p1" "--reverse"))))
|
| 852 | (arguments
|
| 853 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 854 | ((#:phases phases)
|
| 855 | `(modify-phases ,phases
|
| 856 | (replace 'patch-cargo-checksums
|
| 857 | (lambda _
|
| 858 | (substitute* '("Cargo.lock"
|
| 859 | "src/bootstrap/Cargo.lock"
|
| 860 | "src/tools/rust-analyzer/Cargo.lock")
|
| 861 | (("(checksum = )\".*\"" all name)
|
| 862 | (string-append name "\"" ,%cargo-reference-hash "\"")))
|
| 863 | (generate-all-checksums "vendor"))))))))))
|
| 864 |
|
| 865 | (define-public rust-1.65
|
| 866 | (let ((base-rust
|
| 867 | (rust-bootstrapped-package
|
| 868 | rust-1.64 "1.65.0" "0f005kc0vl7qyy298f443i78ibz71hmmh820726bzskpyrkvna2q")))
|
| 869 | (package
|
| 870 | (inherit base-rust)
|
| 871 | (source
|
| 872 | (origin
|
| 873 | (inherit (package-source base-rust))
|
| 874 | (patches '())
|
| 875 | (patch-flags '("-p1")))))))
|
| 876 |
|
| 877 | (define-public rust-1.66
|
| 878 | (rust-bootstrapped-package
|
| 879 | rust-1.65 "1.66.1" "1fjr94gsicsxd2ypz4zm8aad1zdbiccr7qjfbmq8f8f7jhx96g2v"))
|
| 880 |
|
| 881 | (define-public rust-1.67
|
| 882 | (let ((base-rust
|
| 883 | (rust-bootstrapped-package
|
| 884 | rust-1.66 "1.67.1" "0vpzv6rm3w1wbni17ryvcw83k5klhghklylfdza3nnp8blz3sj26")))
|
| 885 | (package
|
| 886 | (inherit base-rust)
|
| 887 | (source
|
| 888 | (origin
|
| 889 | (inherit (package-source base-rust))
|
| 890 | (snippet
|
| 891 | '(begin
|
| 892 | (for-each delete-file-recursively
|
| 893 | '("src/llvm-project"
|
| 894 | "vendor/openssl-src/openssl"
|
| 895 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 896 | |
| 897 | (substitute* '("Cargo.lock"
|
| 898 | "src/bootstrap/Cargo.lock")
|
| 899 | (("\"errno\",") "\"cc\",\n \"errno\","))
|
| 900 | |
| 901 | (substitute* "vendor/fd-lock/Cargo.toml"
|
| 902 | (("\"fs\"") "\"fs\", \"cc\""))
|
| 903 | (substitute* "vendor/is-terminal/Cargo.toml"
|
| 904 | (("\"termios\"") "\"termios\", \"cc\""))
|
| 905 | |
| 906 | |
| 907 | (delete-file "vendor/vte/vim10m_match")
|
| 908 | (delete-file "vendor/vte/vim10m_table")
|
| 909 | |
| 910 | (for-each delete-file
|
| 911 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))))))
|
| 912 | (inputs (modify-inputs inputs
|
| 913 | (replace "llvm" llvm-15))))))
|
| 914 |
|
| 915 | (define-public rust-1.68
|
| 916 | (rust-bootstrapped-package
|
| 917 | rust-1.67 "1.68.2" "15ifyd5jj8rd979dkakp887hgmhndr68pqaqvd2hqkfdywirqcwk"))
|
| 918 |
|
| 919 | (define-public rust-1.69
|
| 920 | (let ((base-rust
|
| 921 | (rust-bootstrapped-package
|
| 922 | rust-1.68 "1.69.0"
|
| 923 | "03zn7kx5bi5mdfsqfccj4h8gd6abm7spj0kjsfxwlv5dcwc9f1gv")))
|
| 924 | (package
|
| 925 | (inherit base-rust)
|
| 926 | (source
|
| 927 | (origin
|
| 928 | (inherit (package-source base-rust))
|
| 929 | (snippet
|
| 930 | '(begin
|
| 931 | (for-each delete-file-recursively
|
| 932 | '("src/llvm-project"
|
| 933 | "vendor/openssl-src/openssl"
|
| 934 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 935 | |
| 936 | (substitute* '("Cargo.lock"
|
| 937 | "src/bootstrap/Cargo.lock")
|
| 938 | (("\"errno\",") "\"cc\",\n \"errno\","))
|
| 939 | |
| 940 | (substitute* "vendor/fd-lock/Cargo.toml"
|
| 941 | (("\"fs\"") "\"fs\", \"cc\""))
|
| 942 | (substitute* "vendor/is-terminal/Cargo.toml"
|
| 943 | (("\"termios\"") "\"termios\", \"cc\""))
|
| 944 | |
| 945 | (for-each delete-file
|
| 946 | (find-files "vendor" "\\.(a|dll|exe|lib)$")))))))))
|
| 947 |
|
| 948 | (define-public rust-1.70
|
| 949 | (let ((base-rust
|
| 950 | (rust-bootstrapped-package
|
| 951 | rust-1.69 "1.70.0"
|
| 952 | "0z6j7d0ni0rmfznv0w3mrf882m11kyh51g2bxkj40l3s1c0axgxj")))
|
| 953 | (package
|
| 954 | (inherit base-rust)
|
| 955 | (source
|
| 956 | (origin
|
| 957 | (inherit (package-source base-rust))
|
| 958 | (snippet
|
| 959 | '(begin
|
| 960 | (for-each delete-file-recursively
|
| 961 | '("src/llvm-project"
|
| 962 | "vendor/openssl-src/openssl"
|
| 963 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 964 | |
| 965 | (substitute* "Cargo.lock"
|
| 966 | (("\"errno\",") "\"cc\",\n \"errno\","))
|
| 967 | |
| 968 | (substitute* '("vendor/is-terminal/Cargo.toml"
|
| 969 | "vendor/is-terminal-0.4.4/Cargo.toml")
|
| 970 | (("\"termios\"") "\"termios\", \"cc\""))
|
| 971 | |
| 972 | (for-each delete-file
|
| 973 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))))
|
| 974 | |
| 975 | |
| 976 | |
| 977 | |
| 978 | |
| 979 | (patches (search-patches "rust-1.70-fix-rustix-build.patch")))))))
|
| 980 |
|
| 981 | (define-public rust-1.71
|
| 982 | (let ((base-rust
|
| 983 | (rust-bootstrapped-package
|
| 984 | rust-1.70 "1.71.1" "0bj79syjap1kgpg9pc0r4jxc0zkxwm6phjf3digsfafms580vabg")))
|
| 985 | (package
|
| 986 | (inherit base-rust)
|
| 987 | (source
|
| 988 | (origin
|
| 989 | (inherit (package-source base-rust))
|
| 990 | (snippet
|
| 991 | '(begin
|
| 992 | (for-each delete-file-recursively
|
| 993 | '("src/llvm-project"
|
| 994 | "vendor/openssl-src/openssl"
|
| 995 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 996 | |
| 997 | (substitute* '("Cargo.lock"
|
| 998 | "src/tools/cargo/Cargo.lock")
|
| 999 | (("\"errno\",") "\"cc\",\n \"errno\","))
|
| 1000 | |
| 1001 | (substitute* '("vendor/is-terminal/Cargo.toml"
|
| 1002 | "vendor/is-terminal-0.4.6/Cargo.toml")
|
| 1003 | (("\"termios\"") "\"termios\", \"cc\""))
|
| 1004 | |
| 1005 | (for-each delete-file
|
| 1006 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))))))
|
| 1007 | (arguments
|
| 1008 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1009 | ((#:phases phases)
|
| 1010 | `(modify-phases ,phases
|
| 1011 | (replace 'patch-cargo-checksums
|
| 1012 | (lambda _
|
| 1013 | (substitute* (cons* "Cargo.lock"
|
| 1014 | "src/bootstrap/Cargo.lock"
|
| 1015 | (find-files "src/tools" "Cargo.lock"))
|
| 1016 | (("(checksum = )\".*\"" all name)
|
| 1017 | (string-append name "\"" ,%cargo-reference-hash "\"")))
|
| 1018 | (generate-all-checksums "vendor"))))))))))
|
| 1019 |
|
| 1020 | (define-public rust-1.72
|
| 1021 | (let ((base-rust
|
| 1022 | (rust-bootstrapped-package
|
| 1023 | rust-1.71 "1.72.1" "15gqd1jzhnc16a7gjmav4x1v83jjbzyjh1gvcdfvpkajd9gq8j3z")))
|
| 1024 | (package
|
| 1025 | (inherit base-rust)
|
| 1026 | (source
|
| 1027 | (origin
|
| 1028 | (inherit (package-source base-rust))
|
| 1029 | (snippet
|
| 1030 | '(begin
|
| 1031 | (for-each delete-file-recursively
|
| 1032 | '("src/llvm-project"
|
| 1033 | "vendor/openssl-src/openssl"
|
| 1034 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 1035 | |
| 1036 | |
| 1037 | |
| 1038 | (for-each delete-file
|
| 1039 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1040 | |
| 1041 | (substitute* '("vendor/is-terminal/Cargo.toml"
|
| 1042 | "vendor/is-terminal-0.4.7/Cargo.toml")
|
| 1043 | (("\"termios\"") "\"termios\", \"use-libc\""))
|
| 1044 | (substitute* "compiler/rustc_driver/Cargo.toml"
|
| 1045 | (("rustix = \"=0.37.11\"")
|
| 1046 | (string-append "rustix = { version = \"=0.37.11\","
|
| 1047 | " features = [\"use-libc\"] }"))))))))))
|
| 1048 |
|
| 1049 | (define-public rust-1.73
|
| 1050 | (let ((base-rust (rust-bootstrapped-package rust-1.72 "1.73.0"
|
| 1051 | "0fmvn7vg3qg9xprgfwv10g3ygy8i4j4bkcxcr1xdy89d3xnjxmln")))
|
| 1052 | (package
|
| 1053 | (inherit base-rust)
|
| 1054 | (source
|
| 1055 | (origin
|
| 1056 | (inherit (package-source base-rust))
|
| 1057 | (snippet
|
| 1058 | '(begin
|
| 1059 | (for-each delete-file-recursively
|
| 1060 | '("src/llvm-project"
|
| 1061 | "vendor/openssl-src/openssl"
|
| 1062 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 1063 | |
| 1064 | |
| 1065 | |
| 1066 | (for-each delete-file
|
| 1067 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1068 | |
| 1069 | (substitute* "vendor/tempfile-3.6.0/Cargo.toml"
|
| 1070 | (("features = \\[\"fs\"" all)
|
| 1071 | (string-append all ", \"use-libc\""))))))))))
|
| 1072 |
|
| 1073 | (define-public rust-1.74
|
| 1074 | (let ((base-rust (rust-bootstrapped-package rust-1.73 "1.74.1"
|
| 1075 | "07930r17dkj3dnsrmilywb6p9i2g2jx56ndfpa2wh8crzhi3xnv7")))
|
| 1076 | (package
|
| 1077 | (inherit base-rust)
|
| 1078 | (source
|
| 1079 | (origin
|
| 1080 | (inherit (package-source base-rust))
|
| 1081 | (snippet
|
| 1082 | '(begin
|
| 1083 | (for-each delete-file-recursively
|
| 1084 | '("src/llvm-project"
|
| 1085 | "vendor/openssl-src/openssl"
|
| 1086 | "vendor/tikv-jemalloc-sys/jemalloc"))
|
| 1087 | |
| 1088 | |
| 1089 | |
| 1090 | (for-each delete-file
|
| 1091 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1092 | |
| 1093 | (substitute* "vendor/tempfile/Cargo.toml"
|
| 1094 | (("features = \\[\"fs\"" all)
|
| 1095 | (string-append all ", \"use-libc\"")))))))
|
| 1096 | (arguments
|
| 1097 | (if (target-riscv64?)
|
| 1098 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1099 | ((#:phases phases)
|
| 1100 | `(modify-phases ,phases
|
| 1101 | |
| 1102 | (delete 'revert-riscv-pause-instruction))))
|
| 1103 | (package-arguments base-rust))))))
|
| 1104 |
|
| 1105 | (define-public rust-1.75
|
| 1106 | (let ((base-rust (rust-bootstrapped-package
|
| 1107 | rust-1.74 "1.75.0"
|
| 1108 | "1260mf3066ki6y55pvr35lnf54am6z96a3ap3hniwd4xpi2rywsv")))
|
| 1109 | (package
|
| 1110 | (inherit base-rust)
|
| 1111 | (source
|
| 1112 | (origin
|
| 1113 | (inherit (package-source base-rust))
|
| 1114 | (patches '())))
|
| 1115 | (arguments
|
| 1116 | (if (supported-package? rust-bootstrap-1.74)
|
| 1117 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1118 | ((#:phases phases)
|
| 1119 | `(modify-phases ,phases
|
| 1120 | (add-after 'unpack 'add-cc-shim-to-path
|
| 1121 | (lambda _
|
| 1122 | (mkdir-p "/tmp/bin")
|
| 1123 | (symlink (which "gcc") "/tmp/bin/cc")
|
| 1124 | (setenv "PATH" (string-append "/tmp/bin:" (getenv "PATH")))))
|
| 1125 | (replace 'install
|
| 1126 | (lambda* (#:key outputs #:allow-other-keys)
|
| 1127 | (let* ((out (assoc-ref outputs "out"))
|
| 1128 | (cargo-out (assoc-ref outputs "cargo"))
|
| 1129 | (build (string-append "build/"
|
| 1130 | ,(platform-rust-target
|
| 1131 | (lookup-platform-by-target-or-system
|
| 1132 | (or (%current-target-system)
|
| 1133 | (%current-system)))))))
|
| 1134 | |
| 1135 | |
| 1136 | |
| 1137 |
|
| 1138 | |
| 1139 | |
| 1140 | |
| 1141 | (with-directory-excursion build
|
| 1142 | (install-file "stage1/bin/rustc" (string-append out "/bin"))
|
| 1143 | (install-file "stage1-tools-bin/cargo"
|
| 1144 | (string-append cargo-out "/bin"))
|
| 1145 | |
| 1146 | |
| 1147 | (for-each delete-file (find-files "stage1/lib" "\\.rmeta$"))
|
| 1148 | |
| 1149 | |
| 1150 | |
| 1151 | (for-each delete-file
|
| 1152 | (find-files "stage1/lib/rustlib"
|
| 1153 | "^librustc_driver.*\\.so$"))
|
| 1154 | (copy-recursively "stage1/lib" (string-append out "/lib")))))))))
|
| 1155 | (package-arguments base-rust)))
|
| 1156 | (native-inputs
|
| 1157 | (if (supported-package? rust-bootstrap-1.74)
|
| 1158 | (modify-inputs native-inputs
|
| 1159 | (replace "cargo-bootstrap" (list rust-bootstrap-1.74 "cargo"))
|
| 1160 | (replace "rustc-bootstrap" rust-bootstrap-1.74))
|
| 1161 | (package-native-inputs base-rust)))
|
| 1162 | (inputs (modify-inputs inputs
|
| 1163 | (replace "llvm" llvm-17))))))
|
| 1164 |
|
| 1165 | (define-public rust-1.76
|
| 1166 | (let ((base-rust (rust-bootstrapped-package rust-1.75 "1.76.0"
|
| 1167 | "08f06shp6l72qrv5fwg1is7yzr6kwj8av0l9h5k243bz781zyp4y")))
|
| 1168 | (package
|
| 1169 | (inherit base-rust)
|
| 1170 | (arguments
|
| 1171 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1172 | ((#:phases phases)
|
| 1173 | `(modify-phases ,phases
|
| 1174 | (delete 'add-cc-shim-to-path))))))))
|
| 1175 |
|
| 1176 | (define-public rust-1.77
|
| 1177 | (let ((base-rust (rust-bootstrapped-package rust-1.76 "1.77.1"
|
| 1178 | "18d4ncdzp0nfimmw029xdf7vv1hgh82v30mjnnixnllzar66w47f")))
|
| 1179 | (package
|
| 1180 | (inherit base-rust)
|
| 1181 | (arguments
|
| 1182 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1183 | ((#:phases phases)
|
| 1184 | `(modify-phases ,phases
|
| 1185 | (add-after 'configure 'no-optimized-compiler-builtins
|
| 1186 | (lambda _
|
| 1187 | |
| 1188 | |
| 1189 | |
| 1190 | |
| 1191 | |
| 1192 | |
| 1193 | |
| 1194 | |
| 1195 | |
| 1196 | (substitute* "config.toml"
|
| 1197 | (("\\[build\\]")
|
| 1198 | "[build]\noptimized-compiler-builtins = false")))))))))))
|
| 1199 |
|
| 1200 | (define-public rust-1.78
|
| 1201 | (let ((base-rust (rust-bootstrapped-package rust-1.77 "1.78.0"
|
| 1202 | "1afmj5g3bz7439w4i8zjhd68zvh0gqg7ymr8h5rz49ybllilhm7z")))
|
| 1203 | (package
|
| 1204 | (inherit base-rust)
|
| 1205 | (source
|
| 1206 | (origin
|
| 1207 | (inherit (package-source base-rust))
|
| 1208 | |
| 1209 | (patches (search-patches "rust-1.78-unwinding-fix.patch")))))))
|
| 1210 |
|
| 1211 | (define-public rust-1.79
|
| 1212 | (let ((base-rust (rust-bootstrapped-package rust-1.78 "1.79.0"
|
| 1213 | "1h282jb1yxc69999w4nhvqb08rw2jy32i9njdjqrz78zglycybhp")))
|
| 1214 | (package
|
| 1215 | (inherit base-rust)
|
| 1216 | (source
|
| 1217 | (origin
|
| 1218 | (inherit (package-source base-rust))
|
| 1219 | (snippet
|
| 1220 | '(begin
|
| 1221 | (for-each delete-file-recursively
|
| 1222 | '("src/llvm-project"
|
| 1223 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1224 | "vendor/openssl-src-111.28.1+1.1.1w/openssl"
|
| 1225 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"))
|
| 1226 | |
| 1227 | |
| 1228 | |
| 1229 | (for-each delete-file
|
| 1230 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1231 | |
| 1232 | (substitute* '("vendor/tempfile-3.7.1/Cargo.toml"
|
| 1233 | "vendor/tempfile-3.10.1/Cargo.toml")
|
| 1234 | (("features = \\[\"fs\"" all)
|
| 1235 | (string-append all ", \"use-libc\""))))))))))
|
| 1236 |
|
| 1237 | (define-public rust-1.80
|
| 1238 | (let ((base-rust (rust-bootstrapped-package rust-1.79 "1.80.1"
|
| 1239 | "1i1dbpwnv6ak244lapsxvd26w6sbas9g4l6crc8bip2275j8y2rc")))
|
| 1240 | (package
|
| 1241 | (inherit base-rust)
|
| 1242 | (source
|
| 1243 | (origin
|
| 1244 | (inherit (package-source base-rust))
|
| 1245 | (snippet
|
| 1246 | '(begin
|
| 1247 | (for-each delete-file-recursively
|
| 1248 | '("src/llvm-project"
|
| 1249 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1250 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1251 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1252 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"))
|
| 1253 | |
| 1254 | |
| 1255 | |
| 1256 | (for-each delete-file
|
| 1257 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1258 | |
| 1259 | (substitute* '("vendor/tempfile-3.7.1/Cargo.toml"
|
| 1260 | "vendor/tempfile-3.10.1/Cargo.toml")
|
| 1261 | (("features = \\[\"fs\"" all)
|
| 1262 | (string-append all ", \"use-libc\""))))))))))
|
| 1263 |
|
| 1264 | (define-public rust-1.81
|
| 1265 | (let ((base-rust (rust-bootstrapped-package rust-1.80 "1.81.0"
|
| 1266 | "19yggj1qivdhf68gx2652cfi7nxjkdgy39wh7h6facpzppz4h947")))
|
| 1267 | (package
|
| 1268 | (inherit base-rust)
|
| 1269 | (source
|
| 1270 | (origin
|
| 1271 | (inherit (package-source base-rust))
|
| 1272 | |
| 1273 | (patches (search-patches "rust-1.81-fix-riscv64-bootstrap.patch")))))))
|
| 1274 |
|
| 1275 | (define-public rust-1.82
|
| 1276 | (let ((base-rust (rust-bootstrapped-package rust-1.81 "1.82.0"
|
| 1277 | "0ajiryki2aqsg3ydx3nfhrb5i1mmxvasfszs9qblw66skr8g8lvw")))
|
| 1278 | (package
|
| 1279 | (inherit base-rust)
|
| 1280 | (source
|
| 1281 | (origin
|
| 1282 | (inherit (package-source base-rust))
|
| 1283 | (patches '())))
|
| 1284 | (arguments
|
| 1285 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1286 | ((#:phases phases)
|
| 1287 | `(modify-phases ,phases
|
| 1288 | (replace 'patch-cargo-checksums
|
| 1289 | (lambda _
|
| 1290 | (substitute* (cons* "Cargo.lock"
|
| 1291 | "src/bootstrap/Cargo.lock"
|
| 1292 | "library/Cargo.lock"
|
| 1293 | (filter
|
| 1294 | |
| 1295 | |
| 1296 | (lambda (path)
|
| 1297 | (not (string-contains
|
| 1298 | path "cargo/tests/testsuite")))
|
| 1299 | (find-files "src/tools" "Cargo.lock")))
|
| 1300 | (("(checksum = )\".*\"" all name)
|
| 1301 | (string-append name "\"" ,%cargo-reference-hash "\"")))
|
| 1302 | (generate-all-checksums "vendor"))))))))))
|
| 1303 |
|
| 1304 | (define-public rust-1.83
|
| 1305 | (let ((base-rust (rust-bootstrapped-package rust-1.82 "1.83.0"
|
| 1306 | "0vhwhk4cbyppnz0lcazfjyddyz811fgvadfxswldicpashxpfbbj")))
|
| 1307 | (package
|
| 1308 | (inherit base-rust)
|
| 1309 | (source
|
| 1310 | (origin
|
| 1311 | (inherit (package-source base-rust))
|
| 1312 | (snippet
|
| 1313 | '(begin
|
| 1314 | (for-each delete-file-recursively
|
| 1315 | '("src/gcc"
|
| 1316 | "src/llvm-project"
|
| 1317 | "vendor/jemalloc-sys-0.3.2"
|
| 1318 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1319 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1320 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1321 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"))
|
| 1322 | |
| 1323 | |
| 1324 | |
| 1325 | (for-each delete-file
|
| 1326 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1327 | |
| 1328 | (substitute* '("vendor/tempfile-3.10.1/Cargo.toml"
|
| 1329 | "vendor/tempfile-3.13.0/Cargo.toml")
|
| 1330 | (("features = \\[\"fs\"" all)
|
| 1331 | (string-append all ", \"use-libc\"")))))))
|
| 1332 | (arguments
|
| 1333 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1334 | ((#:phases phases)
|
| 1335 | `(modify-phases ,phases
|
| 1336 | (add-after 'configure 'use-system-llvm
|
| 1337 | (lambda _
|
| 1338 | (substitute* "config.toml"
|
| 1339 | (("\\[llvm\\]") "[llvm]\ndownload-ci-llvm = false")
|
| 1340 | (("\\[rust\\]") "[rust]\ndownload-rustc = false"))))))))
|
| 1341 | |
| 1342 | (inputs (modify-inputs inputs
|
| 1343 | (replace "llvm" llvm-19))))))
|
| 1344 |
|
| 1345 | (define-public rust-1.84
|
| 1346 | (rust-bootstrapped-package rust-1.83 "1.84.1"
|
| 1347 | "0xdk3g1xq33fy4m7q6l38ba9ydxbanccyb0vczvlk998jvababsy"))
|
| 1348 |
|
| 1349 | (define-public rust-1.85
|
| 1350 | (let ((base-rust
|
| 1351 | (rust-bootstrapped-package rust-1.84 "1.85.1"
|
| 1352 | "12i3jkxrc2bbd2d423q7krwkbc39wlwkjacsimx7b61m1359aa8g")))
|
| 1353 | (package
|
| 1354 | (inherit base-rust)
|
| 1355 | (source
|
| 1356 | (origin
|
| 1357 | (inherit (package-source base-rust))
|
| 1358 | (snippet
|
| 1359 | '(begin
|
| 1360 | (for-each delete-file-recursively
|
| 1361 | '("src/llvm-project"
|
| 1362 | "vendor/jemalloc-sys-0.3.2"
|
| 1363 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1364 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1365 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1366 | "vendor/tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1367 | |
| 1368 | |
| 1369 | |
| 1370 | (for-each delete-file
|
| 1371 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1372 | |
| 1373 | (substitute* '("vendor/tempfile-3.10.1/Cargo.toml"
|
| 1374 | "vendor/tempfile-3.14.0/Cargo.toml")
|
| 1375 | (("features = \\[\"fs\"" all)
|
| 1376 | (string-append all ", \"use-libc\""))))))))))
|
| 1377 |
|
| 1378 | (define-public rust-1.86
|
| 1379 | (let ((base-rust
|
| 1380 | (rust-bootstrapped-package
|
| 1381 | rust-1.85 "1.86.0"
|
| 1382 | "107d3vbmwhn4b71gzr1kv31jwwyld7dxj9yj8jh00ygndll2fah2")))
|
| 1383 | (package
|
| 1384 | (inherit base-rust)
|
| 1385 | (source
|
| 1386 | (origin
|
| 1387 | (inherit (package-source base-rust))
|
| 1388 | (snippet
|
| 1389 | '(begin
|
| 1390 | (for-each delete-file-recursively
|
| 1391 | '("src/llvm-project"
|
| 1392 | "vendor/jemalloc-sys-0.3.2"
|
| 1393 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1394 | "vendor/openssl-src-111.17.0+1.1.1m/openssl"
|
| 1395 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1396 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1397 | "vendor/tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1398 | |
| 1399 | |
| 1400 | |
| 1401 | (for-each delete-file
|
| 1402 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1403 | |
| 1404 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1405 | "vendor/tempfile-3.15.0/Cargo.toml"
|
| 1406 | "vendor/tempfile-3.16.0/Cargo.toml")
|
| 1407 | (("features = \\[\"fs\"" all)
|
| 1408 | (string-append all ", \"use-libc\"")))))))
|
| 1409 | (arguments
|
| 1410 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1411 | ((#:phases phases)
|
| 1412 | `(modify-phases ,phases
|
| 1413 | (add-after 'use-system-llvm 'disable-lld-wrapper
|
| 1414 | (lambda _
|
| 1415 | (substitute* "config.toml"
|
| 1416 | (("\\[rust\\]") "[rust]\nlld = false")))))))))))
|
| 1417 |
|
| 1418 | (define-public rust-1.87
|
| 1419 | (let ((base-rust
|
| 1420 | (rust-bootstrapped-package rust-1.86 "1.87.0"
|
| 1421 | "0xlfzl24qhs4vlwn7d2hd2zkg6k2y1lgq03rx2j2sndy57yvk6ql")))
|
| 1422 | (package
|
| 1423 | (inherit base-rust)
|
| 1424 | (source
|
| 1425 | (origin
|
| 1426 | (inherit (package-source base-rust))
|
| 1427 | (snippet
|
| 1428 | '(begin
|
| 1429 | (for-each delete-file-recursively
|
| 1430 | '("src/llvm-project"
|
| 1431 | "vendor/jemalloc-sys-0.3.2"
|
| 1432 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1433 | "vendor/openssl-src-111.17.0+1.1.1m/openssl"
|
| 1434 | "vendor/openssl-src-300.4.2+3.4.1/openssl"
|
| 1435 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1436 | "vendor/tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1437 | |
| 1438 | |
| 1439 | |
| 1440 | (for-each delete-file
|
| 1441 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1442 | |
| 1443 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1444 | "vendor/tempfile-3.15.0/Cargo.toml"
|
| 1445 | "vendor/tempfile-3.17.1/Cargo.toml")
|
| 1446 | (("features = \\[\"fs\"" all)
|
| 1447 | (string-append all ", \"use-libc\"")))))))
|
| 1448 | (arguments
|
| 1449 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1450 | ((#:phases phases)
|
| 1451 | `(modify-phases ,phases
|
| 1452 | (replace 'build
|
| 1453 | |
| 1454 |
|
| 1455 | |
| 1456 | |
| 1457 | |
| 1458 | |
| 1459 | (lambda* (#:key parallel-build? #:allow-other-keys)
|
| 1460 | (let ((job-spec (string-append
|
| 1461 | "-j" (if parallel-build?
|
| 1462 | (number->string (parallel-job-count))
|
| 1463 | "1"))))
|
| 1464 | (invoke "./x.py" job-spec "build" "--stage=2"
|
| 1465 | "library/std"
|
| 1466 | "src/tools/cargo")))))))))))
|
| 1467 |
|
| 1468 | (define-public rust-1.88
|
| 1469 | (let ((base-rust
|
| 1470 | (rust-bootstrapped-package
|
| 1471 | rust-1.87 "1.88.0"
|
| 1472 | "1gngrxjfqiyybyamzn8s4rfbhk7jss1vrmnijg8y72l46i2595rs")))
|
| 1473 | (package
|
| 1474 | (inherit base-rust)
|
| 1475 | (source
|
| 1476 | (origin
|
| 1477 | (inherit (package-source base-rust))
|
| 1478 | (snippet
|
| 1479 | '(begin
|
| 1480 | (for-each delete-file-recursively
|
| 1481 | '("src/llvm-project"
|
| 1482 | "vendor/jemalloc-sys-0.3.2"
|
| 1483 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1484 | "vendor/openssl-src-111.17.0+1.1.1m/openssl"
|
| 1485 | "vendor/openssl-src-300.4.2+3.4.1/openssl"
|
| 1486 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1487 | "vendor/tikv-jemalloc-sys-0.6.0+5.3.0-1-ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1488 | |
| 1489 | |
| 1490 | |
| 1491 | (for-each delete-file
|
| 1492 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1493 | |
| 1494 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1495 | "vendor/tempfile-3.17.1/Cargo.toml"
|
| 1496 | "vendor/tempfile-3.19.0/Cargo.toml"
|
| 1497 | "vendor/tempfile-3.19.1/Cargo.toml")
|
| 1498 | (("features = \\[\"fs\"" all)
|
| 1499 | (string-append all ", \"use-libc\""))))))))))
|
| 1500 |
|
| 1501 | (define-public rust-1.89
|
| 1502 | (let ((base-rust
|
| 1503 | (rust-bootstrapped-package
|
| 1504 | rust-1.88 "1.89.0"
|
| 1505 | "0395ax8d138ch65fzm1y9xf2s4661am5k3yj3cav16fx83sgjxi5")))
|
| 1506 | (package
|
| 1507 | (inherit base-rust)
|
| 1508 | (source
|
| 1509 | (origin
|
| 1510 | (inherit (package-source base-rust))
|
| 1511 | (snippet
|
| 1512 | '(begin
|
| 1513 | (for-each delete-file-recursively
|
| 1514 | '("src/llvm-project"
|
| 1515 | "vendor/curl-sys-0.4.79+curl-8.12.0/curl"
|
| 1516 | "vendor/curl-sys-0.4.80+curl-8.12.1/curl"
|
| 1517 | "vendor/curl-sys-0.4.82+curl-8.14.1/curl"
|
| 1518 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1519 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1520 | "vendor/libffi-sys-3.3.1/libffi"
|
| 1521 | "vendor/libz-sys-1.1.21/src/zlib"
|
| 1522 | "vendor/libz-sys-1.1.22/src/zlib"
|
| 1523 | "vendor/libmimalloc-sys-0.1.42/c_src/mimalloc"
|
| 1524 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1525 | "vendor/openssl-src-300.5.0+3.5.0/openssl"
|
| 1526 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1527 | "vendor/tikv-jemalloc-sys-0.6.0+5.3.0-1-\
|
| 1528 | ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1529 | |
| 1530 | |
| 1531 | |
| 1532 | (for-each delete-file
|
| 1533 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1534 | |
| 1535 | (for-each
|
| 1536 | (lambda (ver)
|
| 1537 | (let ((vendored-dir
|
| 1538 | (format #f "vendor/libnghttp2-sys-~a/nghttp2" ver))
|
| 1539 | (build-rs
|
| 1540 | (format #f "vendor/libnghttp2-sys-~a/build.rs" ver)))
|
| 1541 | (delete-file-recursively vendored-dir)
|
| 1542 | (delete-file build-rs)
|
| 1543 | (call-with-output-file build-rs
|
| 1544 | (lambda (port)
|
| 1545 | (format port "fn main() {~@
|
| 1546 | println!(\"cargo:rustc-link-lib=nghttp2\");~@
|
| 1547 | }~%")))))
|
| 1548 | '("0.1.11+1.64.0"))
|
| 1549 | |
| 1550 | |
| 1551 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1552 | "vendor/tempfile-3.16.0/Cargo.toml"
|
| 1553 | "vendor/tempfile-3.19.0/Cargo.toml"
|
| 1554 | "vendor/tempfile-3.19.1/Cargo.toml"
|
| 1555 | "vendor/tempfile-3.20.0/Cargo.toml")
|
| 1556 | (("features = \\[\"fs\"" all)
|
| 1557 | (string-append all ", \"use-libc\"")))))))
|
| 1558 | (inputs
|
| 1559 | (modify-inputs inputs
|
| 1560 | (prepend curl `(,nghttp2 "lib") libffi))))))
|
| 1561 |
|
| 1562 | (define-public rust-1.90
|
| 1563 | (let ((base-rust
|
| 1564 | (rust-bootstrapped-package
|
| 1565 | rust-1.89 "1.90.0"
|
| 1566 | "0zlv3ybd8za07brxwj4n03cma1snnpvbqj0h0wg3bmafpaf9z6kr")))
|
| 1567 | (package
|
| 1568 | (inherit base-rust)
|
| 1569 | (source
|
| 1570 | (origin
|
| 1571 | (inherit (package-source base-rust))
|
| 1572 | (snippet
|
| 1573 | '(begin
|
| 1574 | (for-each delete-file-recursively
|
| 1575 | '("src/llvm-project"
|
| 1576 | "vendor/curl-sys-0.4.79+curl-8.12.0/curl"
|
| 1577 | "vendor/curl-sys-0.4.82+curl-8.14.1/curl"
|
| 1578 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1579 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1580 | "vendor/libffi-sys-3.3.2/libffi"
|
| 1581 | "vendor/libz-sys-1.1.21/src/zlib"
|
| 1582 | "vendor/libz-sys-1.1.22/src/zlib"
|
| 1583 | "vendor/libmimalloc-sys-0.1.42/c_src/mimalloc"
|
| 1584 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1585 | "vendor/openssl-src-300.5.0+3.5.0/openssl"
|
| 1586 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1587 | "vendor/tikv-jemalloc-sys-0.6.0+5.3.0-1-\
|
| 1588 | ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1589 | |
| 1590 | |
| 1591 | |
| 1592 | (for-each delete-file
|
| 1593 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1594 | |
| 1595 | (for-each
|
| 1596 | (lambda (ver)
|
| 1597 | (let ((vendored-dir
|
| 1598 | (format #f "vendor/libnghttp2-sys-~a/nghttp2" ver))
|
| 1599 | (build-rs
|
| 1600 | (format #f "vendor/libnghttp2-sys-~a/build.rs" ver)))
|
| 1601 | (delete-file-recursively vendored-dir)
|
| 1602 | (delete-file build-rs)
|
| 1603 | (call-with-output-file build-rs
|
| 1604 | (lambda (port)
|
| 1605 | (format port "fn main() {~@
|
| 1606 | println!(\"cargo:rustc-link-lib=nghttp2\");~@
|
| 1607 | }~%")))))
|
| 1608 | '("0.1.11+1.64.0"))
|
| 1609 | |
| 1610 | |
| 1611 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1612 | "vendor/tempfile-3.16.0/Cargo.toml"
|
| 1613 | "vendor/tempfile-3.19.0/Cargo.toml"
|
| 1614 | "vendor/tempfile-3.19.1/Cargo.toml"
|
| 1615 | "vendor/tempfile-3.20.0/Cargo.toml")
|
| 1616 | (("features = \\[\"fs\"" all)
|
| 1617 | (string-append all ", \"use-libc\"")))))))
|
| 1618 | (inputs
|
| 1619 | (modify-inputs inputs
|
| 1620 | (replace "llvm" llvm-21))))))
|
| 1621 |
|
| 1622 | (define-public rust-1.91
|
| 1623 | (let ((base-rust
|
| 1624 | (rust-bootstrapped-package
|
| 1625 | rust-1.90 "1.91.0"
|
| 1626 | "12iysk87bmhlcdcbr939y8cdfcx0an4z9ixjlbq16c3ma60m4zrj")))
|
| 1627 | (package
|
| 1628 | (inherit base-rust)
|
| 1629 | (source
|
| 1630 | (origin
|
| 1631 | (inherit (package-source base-rust))
|
| 1632 | (snippet
|
| 1633 | '(begin
|
| 1634 | (for-each delete-file-recursively
|
| 1635 | '("src/llvm-project"
|
| 1636 | "vendor/curl-sys-0.4.79+curl-8.12.0/curl"
|
| 1637 | "vendor/curl-sys-0.4.83+curl-8.15.0/curl"
|
| 1638 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1639 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1640 | "vendor/libffi-sys-3.3.2/libffi"
|
| 1641 | "vendor/libz-sys-1.1.21/src/zlib"
|
| 1642 | "vendor/libz-sys-1.1.22/src/zlib"
|
| 1643 | "vendor/libmimalloc-sys-0.1.42/c_src/mimalloc"
|
| 1644 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1645 | "vendor/openssl-src-300.5.0+3.5.0/openssl"
|
| 1646 | "vendor/openssl-src-300.5.2+3.5.2/openssl"
|
| 1647 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1648 | "vendor/tikv-jemalloc-sys-0.6.0+5.3.0-1-\
|
| 1649 | ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1650 | |
| 1651 | |
| 1652 | |
| 1653 | (for-each delete-file
|
| 1654 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1655 | |
| 1656 | (for-each
|
| 1657 | (lambda (ver)
|
| 1658 | (let ((vendored-dir
|
| 1659 | (format #f "vendor/libnghttp2-sys-~a/nghttp2" ver))
|
| 1660 | (build-rs
|
| 1661 | (format #f "vendor/libnghttp2-sys-~a/build.rs" ver)))
|
| 1662 | (delete-file-recursively vendored-dir)
|
| 1663 | (delete-file build-rs)
|
| 1664 | (call-with-output-file build-rs
|
| 1665 | (lambda (port)
|
| 1666 | (format port "fn main() {~@
|
| 1667 | println!(\"cargo:rustc-link-lib=nghttp2\");~@
|
| 1668 | }~%")))))
|
| 1669 | '("0.1.11+1.64.0"))
|
| 1670 | |
| 1671 | |
| 1672 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1673 | "vendor/tempfile-3.16.0/Cargo.toml"
|
| 1674 | "vendor/tempfile-3.19.1/Cargo.toml"
|
| 1675 | "vendor/tempfile-3.20.0/Cargo.toml"
|
| 1676 | "vendor/tempfile-3.21.0/Cargo.toml")
|
| 1677 | (("features = \\[\"fs\"" all)
|
| 1678 | (string-append all ", \"use-libc\"")))))))
|
| 1679 | (arguments
|
| 1680 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1681 | ((#:phases phases)
|
| 1682 | `(modify-phases ,phases
|
| 1683 | |
| 1684 | #;
|
| 1685 | (add-before 'build 'set-stack-size
|
| 1686 | (lambda _
|
| 1687 | (setenv "RUST_MIN_STACK" "16777216")))
|
| 1688 | (replace 'install
|
| 1689 | |
| 1690 | |
| 1691 | |
| 1692 | (lambda* (#:key outputs #:allow-other-keys)
|
| 1693 | (let* ((out (assoc-ref outputs "out"))
|
| 1694 | (cargo-out (assoc-ref outputs "cargo"))
|
| 1695 | (build (string-append "build/"
|
| 1696 | ,(platform-rust-target
|
| 1697 | (lookup-platform-by-target-or-system
|
| 1698 | (or (%current-target-system)
|
| 1699 | (%current-system)))))))
|
| 1700 | (with-directory-excursion build
|
| 1701 | (install-file "stage2/bin/rustc"
|
| 1702 | (string-append out "/bin"))
|
| 1703 | (install-file "stage2-tools-bin/cargo"
|
| 1704 | (string-append cargo-out "/bin"))
|
| 1705 | (for-each delete-file
|
| 1706 | (find-files "stage2/lib" "\\.rmeta$"))
|
| 1707 | (for-each delete-file
|
| 1708 | (find-files "stage2/lib/rustlib"
|
| 1709 | "^librustc_driver.*\\.so$"))
|
| 1710 | (copy-recursively "stage2/lib"
|
| 1711 | (string-append out "/lib")))))))))))))
|
| 1712 |
|
| 1713 | (define-public rust-1.92
|
| 1714 | (let ((base-rust
|
| 1715 | (rust-bootstrapped-package
|
| 1716 | rust-1.91 "1.92.0"
|
| 1717 | "1f6305lkp4vwj132fq232mfxdcxg0d5vymc2fpf5y9vybjkjq3cy")))
|
| 1718 | (package
|
| 1719 | (inherit base-rust)
|
| 1720 | (source
|
| 1721 | (origin
|
| 1722 | (inherit (package-source base-rust))
|
| 1723 | (snippet
|
| 1724 | '(begin
|
| 1725 | (for-each delete-file-recursively
|
| 1726 | '("src/llvm-project"
|
| 1727 | "vendor/curl-sys-0.4.79+curl-8.12.0/curl"
|
| 1728 | "vendor/curl-sys-0.4.83+curl-8.15.0/curl"
|
| 1729 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1730 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1731 | "vendor/libffi-sys-4.0.0/libffi"
|
| 1732 | "vendor/libz-sys-1.1.21/src/zlib"
|
| 1733 | "vendor/libz-sys-1.1.22/src/zlib"
|
| 1734 | "vendor/libmimalloc-sys-0.1.44/c_src/mimalloc"
|
| 1735 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1736 | "vendor/openssl-src-300.5.0+3.5.0/openssl"
|
| 1737 | "vendor/openssl-src-300.5.3+3.5.4/openssl"
|
| 1738 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1739 | "vendor/tikv-jemalloc-sys-0.6.0+5.3.0-1-\
|
| 1740 | ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1741 | |
| 1742 | |
| 1743 | |
| 1744 | (for-each delete-file
|
| 1745 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1746 | |
| 1747 | (for-each
|
| 1748 | (lambda (ver)
|
| 1749 | (let ((vendored-dir
|
| 1750 | (format #f "vendor/libnghttp2-sys-~a/nghttp2" ver))
|
| 1751 | (build-rs
|
| 1752 | (format #f "vendor/libnghttp2-sys-~a/build.rs" ver)))
|
| 1753 | (delete-file-recursively vendored-dir)
|
| 1754 | (delete-file build-rs)
|
| 1755 | (call-with-output-file build-rs
|
| 1756 | (lambda (port)
|
| 1757 | (format port "fn main() {~@
|
| 1758 | println!(\"cargo:rustc-link-lib=nghttp2\");~@
|
| 1759 | }~%")))))
|
| 1760 | '("0.1.11+1.64.0"))
|
| 1761 | |
| 1762 | |
| 1763 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1764 | "vendor/tempfile-3.16.0/Cargo.toml"
|
| 1765 | "vendor/tempfile-3.19.1/Cargo.toml"
|
| 1766 | "vendor/tempfile-3.20.0/Cargo.toml"
|
| 1767 | "vendor/tempfile-3.21.0/Cargo.toml"
|
| 1768 | "vendor/tempfile-3.23.0/Cargo.toml")
|
| 1769 | (("features = \\[\"fs\"" all)
|
| 1770 | (string-append all ", \"use-libc\""))))))))))
|
| 1771 |
|
| 1772 | (define-public rust-1.93
|
| 1773 | (let ((base-rust
|
| 1774 | (rust-bootstrapped-package
|
| 1775 | rust-1.92 "1.93.0"
|
| 1776 | "01d7a1mvyvqmq9khyw5cbnwyngzgb4pxpdwhqgzl669j7kc2n4b9")))
|
| 1777 | (package
|
| 1778 | (inherit base-rust)
|
| 1779 | (source
|
| 1780 | (origin
|
| 1781 | (inherit (package-source base-rust))
|
| 1782 | (snippet
|
| 1783 | '(begin
|
| 1784 | (for-each delete-file-recursively
|
| 1785 | '("src/llvm-project"
|
| 1786 | "vendor/curl-sys-0.4.79+curl-8.12.0/curl"
|
| 1787 | "vendor/curl-sys-0.4.83+curl-8.15.0/curl"
|
| 1788 | "vendor/curl-sys-0.4.84+curl-8.17.0/curl"
|
| 1789 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1790 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1791 | "vendor/libffi-sys-4.0.0/libffi"
|
| 1792 | "vendor/libz-sys-1.1.21/src/zlib"
|
| 1793 | "vendor/libz-sys-1.1.23/src/zlib"
|
| 1794 | "vendor/libmimalloc-sys-0.1.44/c_src/mimalloc"
|
| 1795 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1796 | "vendor/openssl-src-300.5.0+3.5.0/openssl"
|
| 1797 | "vendor/openssl-src-300.5.4+3.5.4/openssl"
|
| 1798 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1799 | "vendor/tikv-jemalloc-sys-0.6.1+5.3.0-1-\
|
| 1800 | ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1801 | |
| 1802 | |
| 1803 | |
| 1804 | (for-each delete-file
|
| 1805 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1806 | |
| 1807 | (for-each
|
| 1808 | (lambda (ver)
|
| 1809 | (let ((vendored-dir
|
| 1810 | (format #f "vendor/libnghttp2-sys-~a/nghttp2" ver))
|
| 1811 | (build-rs
|
| 1812 | (format #f "vendor/libnghttp2-sys-~a/build.rs" ver)))
|
| 1813 | (delete-file-recursively vendored-dir)
|
| 1814 | (delete-file build-rs)
|
| 1815 | (call-with-output-file build-rs
|
| 1816 | (lambda (port)
|
| 1817 | (format port "fn main() {~@
|
| 1818 | println!(\"cargo:rustc-link-lib=nghttp2\");~@
|
| 1819 | }~%")))))
|
| 1820 | '("0.1.11+1.64.0"))
|
| 1821 | |
| 1822 | |
| 1823 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1824 | "vendor/tempfile-3.16.0/Cargo.toml"
|
| 1825 | "vendor/tempfile-3.19.1/Cargo.toml"
|
| 1826 | "vendor/tempfile-3.20.0/Cargo.toml"
|
| 1827 | "vendor/tempfile-3.21.0/Cargo.toml"
|
| 1828 | "vendor/tempfile-3.23.0/Cargo.toml")
|
| 1829 | (("features = \\[\"fs\"" all)
|
| 1830 | (string-append all ", \"use-libc\""))))))))))
|
| 1831 |
|
| 1832 | (define-public rust-1.94
|
| 1833 | (let ((base-rust
|
| 1834 | (rust-bootstrapped-package
|
| 1835 | rust-1.93 "1.94.1"
|
| 1836 | "056mbblkhn5ig62v09r6938qmnb09ygy32n62vvwvqqjbxi2l52c")))
|
| 1837 | (package
|
| 1838 | (inherit base-rust)
|
| 1839 | (source
|
| 1840 | (origin
|
| 1841 | (inherit (package-source base-rust))
|
| 1842 | (patches (search-patches
|
| 1843 | "rust-1.94-clippy-fix-proc-macros-aux-race.patch"))
|
| 1844 | (snippet
|
| 1845 | '(begin
|
| 1846 | (for-each delete-file-recursively
|
| 1847 | '("src/llvm-project"
|
| 1848 | "vendor/curl-sys-0.4.79+curl-8.12.0/curl"
|
| 1849 | "vendor/curl-sys-0.4.84+curl-8.17.0/curl"
|
| 1850 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1851 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1852 | "vendor/libffi-sys-4.1.0/libffi"
|
| 1853 | "vendor/libz-sys-1.1.21/src/zlib"
|
| 1854 | "vendor/libz-sys-1.1.23/src/zlib"
|
| 1855 | "vendor/libmimalloc-sys-0.1.44/c_src/mimalloc"
|
| 1856 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1857 | "vendor/openssl-src-300.5.0+3.5.0/openssl"
|
| 1858 | "vendor/openssl-src-300.5.4+3.5.4/openssl"
|
| 1859 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1860 | "vendor/tikv-jemalloc-sys-0.6.1+5.3.0-1-\
|
| 1861 | ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1862 | |
| 1863 | |
| 1864 | |
| 1865 | (for-each delete-file
|
| 1866 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1867 | |
| 1868 | (for-each
|
| 1869 | (lambda (ver)
|
| 1870 | (let ((vendored-dir
|
| 1871 | (format #f "vendor/libnghttp2-sys-~a/nghttp2" ver))
|
| 1872 | (build-rs
|
| 1873 | (format #f "vendor/libnghttp2-sys-~a/build.rs" ver)))
|
| 1874 | (delete-file-recursively vendored-dir)
|
| 1875 | (delete-file build-rs)
|
| 1876 | (call-with-output-file build-rs
|
| 1877 | (lambda (port)
|
| 1878 | (format port "fn main() {~@
|
| 1879 | println!(\"cargo:rustc-link-lib=nghttp2\");~@
|
| 1880 | }~%")))))
|
| 1881 | '("0.1.11+1.64.0"))
|
| 1882 | |
| 1883 | |
| 1884 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1885 | "vendor/tempfile-3.16.0/Cargo.toml"
|
| 1886 | "vendor/tempfile-3.19.1/Cargo.toml"
|
| 1887 | "vendor/tempfile-3.20.0/Cargo.toml"
|
| 1888 | "vendor/tempfile-3.21.0/Cargo.toml"
|
| 1889 | "vendor/tempfile-3.23.0/Cargo.toml"
|
| 1890 | "vendor/tempfile-3.24.0/Cargo.toml")
|
| 1891 | (("features = \\[\"fs\"" all)
|
| 1892 | (string-append all ", \"use-libc\"")))))))
|
| 1893 | (arguments
|
| 1894 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 1895 | ((#:phases phases)
|
| 1896 | `(modify-phases ,phases
|
| 1897 | (replace 'install
|
| 1898 | |
| 1899 | |
| 1900 | |
| 1901 | |
| 1902 | (lambda* (#:key outputs #:allow-other-keys)
|
| 1903 | (let* ((out (assoc-ref outputs "out"))
|
| 1904 | (cargo-out (assoc-ref outputs "cargo"))
|
| 1905 | (build (string-append "build/"
|
| 1906 | ,(platform-rust-target
|
| 1907 | (lookup-platform-by-target-or-system
|
| 1908 | (or (%current-target-system)
|
| 1909 | (%current-system)))))))
|
| 1910 | (with-directory-excursion build
|
| 1911 | (install-file "stage2/bin/rustc"
|
| 1912 | (string-append out "/bin"))
|
| 1913 | (install-file "stage2-tools-bin/cargo"
|
| 1914 | (string-append cargo-out "/bin"))
|
| 1915 | (for-each delete-file
|
| 1916 | (find-files "stage2/lib/rustlib"
|
| 1917 | "^librustc_driver.*\\.so$"))
|
| 1918 | (copy-recursively "stage2/lib"
|
| 1919 | (string-append out "/lib")))))))))))))
|
| 1920 |
|
| 1921 | (define-public rust-1.95
|
| 1922 | (let ((base-rust
|
| 1923 | (rust-bootstrapped-package
|
| 1924 | rust-1.94 "1.95.0"
|
| 1925 | "05d53hj717ildhvm3rln7821r08nzbbfk72nqcvpb5j67sl856za")))
|
| 1926 | (package
|
| 1927 | (inherit base-rust)
|
| 1928 | (source
|
| 1929 | (origin
|
| 1930 | (inherit (package-source base-rust))
|
| 1931 | (snippet
|
| 1932 | '(begin
|
| 1933 | (for-each delete-file-recursively
|
| 1934 | '("src/llvm-project"
|
| 1935 | "vendor/curl-sys-0.4.79+curl-8.12.0/curl"
|
| 1936 | "vendor/curl-sys-0.4.83+curl-8.15.0/curl"
|
| 1937 | "vendor/curl-sys-0.4.84+curl-8.17.0/curl"
|
| 1938 | "vendor/jemalloc-sys-0.5.3+5.3.0-patched/jemalloc"
|
| 1939 | "vendor/jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1940 | "vendor/libffi-sys-4.1.0/libffi"
|
| 1941 | "vendor/libmimalloc-sys-0.1.44/c_src/mimalloc"
|
| 1942 | "vendor/libz-sys-1.1.21/src/zlib"
|
| 1943 | "vendor/libz-sys-1.1.23/src/zlib"
|
| 1944 | "vendor/openssl-src-111.28.2+1.1.1w/openssl"
|
| 1945 | "vendor/openssl-src-300.5.0+3.5.0/openssl"
|
| 1946 | "vendor/openssl-src-300.5.4+3.5.4/openssl"
|
| 1947 | "vendor/tikv-jemalloc-sys-0.5.4+5.3.0-patched/jemalloc"
|
| 1948 | "vendor/tikv-jemalloc-sys-0.6.1+5.3.0-1-\
|
| 1949 | ge13ca993e8ccb9ba9847cc330696e02839f328f7/jemalloc"))
|
| 1950 | |
| 1951 | |
| 1952 | |
| 1953 | (for-each delete-file
|
| 1954 | (find-files "vendor" "\\.(a|dll|exe|lib)$"))
|
| 1955 | |
| 1956 | (for-each
|
| 1957 | (lambda (ver)
|
| 1958 | (let ((vendored-dir
|
| 1959 | (format #f "vendor/libnghttp2-sys-~a/nghttp2" ver))
|
| 1960 | (build-rs
|
| 1961 | (format #f "vendor/libnghttp2-sys-~a/build.rs" ver)))
|
| 1962 | (delete-file-recursively vendored-dir)
|
| 1963 | (delete-file build-rs)
|
| 1964 | (call-with-output-file build-rs
|
| 1965 | (lambda (port)
|
| 1966 | (format port "fn main() {~@
|
| 1967 | println!(\"cargo:rustc-link-lib=nghttp2\");~@
|
| 1968 | }~%")))))
|
| 1969 | '("0.1.11+1.64.0"))
|
| 1970 | |
| 1971 | |
| 1972 | (substitute* '("vendor/tempfile-3.14.0/Cargo.toml"
|
| 1973 | "vendor/tempfile-3.16.0/Cargo.toml"
|
| 1974 | "vendor/tempfile-3.19.1/Cargo.toml"
|
| 1975 | "vendor/tempfile-3.20.0/Cargo.toml"
|
| 1976 | "vendor/tempfile-3.21.0/Cargo.toml"
|
| 1977 | "vendor/tempfile-3.23.0/Cargo.toml"
|
| 1978 | "vendor/tempfile-3.24.0/Cargo.toml")
|
| 1979 | (("features = \\[\"fs\"" all)
|
| 1980 | (string-append all ", \"use-libc\""))))))))))
|
| 1981 |
|
| 1982 | (define (make-ignore-test-list strs)
|
| 1983 | "Function to make creating a list to ignore tests a bit easier."
|
| 1984 | (map (lambda (str)
|
| 1985 | `((,str) (string-append "#[ignore]\n" ,str)))
|
| 1986 | strs))
|
| 1987 |
|
| 1988 | |
| 1989 | |
| 1990 | |
| 1991 | |
| 1992 | |
| 1993 | |
| 1994 | |
| 1995 | (define-public rust
|
| 1996 | (let ((base-rust rust-1.93))
|
| 1997 | (package
|
| 1998 | (inherit base-rust)
|
| 1999 | (properties (append
|
| 2000 | (alist-delete 'hidden? (package-properties base-rust))
|
| 2001 | |
| 2002 | (clang-compiler-cpu-architectures "21")))
|
| 2003 | (outputs (cons* "rust-src" "tools" (package-outputs base-rust)))
|
| 2004 | (arguments
|
| 2005 | (substitute-keyword-arguments
|
| 2006 | (strip-keyword-arguments '(#:tests?)
|
| 2007 | (package-arguments base-rust))
|
| 2008 | ((#:disallowed-references _ '())
|
| 2009 | (list (this-package-native-input "rustc-bootstrap")
|
| 2010 | |
| 2011 | (gexp-input (this-package-native-input "rustc-bootstrap")
|
| 2012 | "cargo")))
|
| 2013 | ((#:modules modules)
|
| 2014 | (cons '(srfi srfi-26) modules))
|
| 2015 | ((#:phases phases)
|
| 2016 | `(modify-phases ,phases
|
| 2017 | (add-after 'unpack 'disable-tests-requiring-git
|
| 2018 | (lambda _
|
| 2019 | (substitute* "src/tools/cargo/tests/testsuite/publish_lockfile.rs"
|
| 2020 | ,@(make-ignore-test-list
|
| 2021 | '("fn note_resolve_changes")))))
|
| 2022 | (add-after 'unpack 'disable-tests-using-cargo-publish
|
| 2023 | (lambda _
|
| 2024 | (substitute* "src/tools/cargo/tests/testsuite/install.rs"
|
| 2025 | ,@(make-ignore-test-list
|
| 2026 | '("fn failed_install_retains_temp_directory")))))
|
| 2027 | ,@(if (target-riscv64?)
|
| 2028 | |
| 2029 | |
| 2030 | `((add-after 'unpack 'disable-tests-broken-on-riscv64
|
| 2031 | (lambda _
|
| 2032 | (with-directory-excursion "src/tools/cargo/tests/testsuite"
|
| 2033 | (substitute* "build.rs"
|
| 2034 | ,@(make-ignore-test-list
|
| 2035 | '("fn uplift_dwp_of_bin_on_linux")))
|
| 2036 | (substitute* "cache_lock.rs"
|
| 2037 | ,@(make-ignore-test-list
|
| 2038 | '("fn multiple_shared"
|
| 2039 | "fn multiple_download"
|
| 2040 | "fn download_then_mutate"
|
| 2041 | "fn mutate_err_is_atomic")))
|
| 2042 | (substitute* "global_cache_tracker.rs"
|
| 2043 | ,@(make-ignore-test-list
|
| 2044 | '("fn package_cache_lock_during_build"))))
|
| 2045 | (with-directory-excursion "src/tools/clippy/tests"
|
| 2046 | |
| 2047 | (delete-file "ui/missing_const_for_fn/could_be_const.rs")
|
| 2048 | (substitute* "missing-test-files.rs"
|
| 2049 | ,@(make-ignore-test-list
|
| 2050 | '("fn test_missing_tests")))))))
|
| 2051 | `())
|
| 2052 | (add-after 'unpack 'skip-unupdated-clippy-tests
|
| 2053 | (lambda _
|
| 2054 | (with-directory-excursion "src/tools/clippy/tests/ui"
|
| 2055 | (delete-file "cognitive_complexity.rs")
|
| 2056 | (delete-file "cognitive_complexity.stderr"))))
|
| 2057 | (add-after 'unpack 'disable-tests-requiring-network-access
|
| 2058 | (lambda _
|
| 2059 | (substitute* "src/tools/cargo/tests/testsuite/git_auth.rs"
|
| 2060 | ,@(make-ignore-test-list
|
| 2061 | '("fn net_err_suggests_fetch_with_cli")))
|
| 2062 | (substitute* "src/tools/cargo/tests/testsuite/package.rs"
|
| 2063 | ,@(make-ignore-test-list
|
| 2064 | '("fn publish_to_crates_io_warns")))))
|
| 2065 | (add-after 'unpack 'patch-process-tests
|
| 2066 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2067 | (let ((bash (assoc-ref inputs "bash")))
|
| 2068 | (with-directory-excursion "library/std/src"
|
| 2069 | (substitute* "process/tests.rs"
|
| 2070 | (("\"/bin/sh\"")
|
| 2071 | (string-append "\"" bash "/bin/sh\"")))
|
| 2072 | |
| 2073 | |
| 2074 | |
| 2075 | (substitute* "sys/process/unix/common/tests.rs"
|
| 2076 | |
| 2077 | |
| 2078 | (("target_arch = \"arm\"" arm)
|
| 2079 | (string-append "target_os = \"linux\",\n"
|
| 2080 | " " arm)))))))
|
| 2081 | (add-after 'unpack 'disable-interrupt-tests
|
| 2082 | (lambda _
|
| 2083 | |
| 2084 | (substitute* "src/tools/cargo/tests/testsuite/freshness.rs"
|
| 2085 | ,@(make-ignore-test-list
|
| 2086 | '("fn linking_interrupted")))
|
| 2087 | |
| 2088 | (substitute* "src/tools/cargo/tests/testsuite/death.rs"
|
| 2089 | ,@(make-ignore-test-list
|
| 2090 | '("fn ctrl_c_kills_everyone")))))
|
| 2091 | (add-after 'unpack 'patch-cargo-test-compat-curl-8.18
|
| 2092 | (lambda _
|
| 2093 | |
| 2094 | |
| 2095 | |
| 2096 | (substitute* '("src/tools/cargo/tests/testsuite/artifact_dep.rs"
|
| 2097 | "src/tools/cargo/tests/testsuite/vendor.rs")
|
| 2098 | (("Couldn't") "Could[..]t"))))
|
| 2099 | (add-after 'unpack 'adjust-rpath-values
|
| 2100 | |
| 2101 | |
| 2102 | (lambda* (#:key outputs #:allow-other-keys)
|
| 2103 | (let ((out (assoc-ref outputs "out")))
|
| 2104 | (substitute* "src/bootstrap/src/core/builder/cargo.rs"
|
| 2105 | ((" = rpath.*" all)
|
| 2106 | (string-append all
|
| 2107 | " "
|
| 2108 | "self.rustflags.arg(\"-Clink-args=-Wl,-rpath="
|
| 2109 | out "/lib\");\n"))))))
|
| 2110 | (add-after 'unpack 'unpack-profiler-rt
|
| 2111 | |
| 2112 | |
| 2113 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2114 | (mkdir-p "src/llvm-project/compiler-rt")
|
| 2115 | (copy-recursively
|
| 2116 | (string-append (assoc-ref inputs "clang-source")
|
| 2117 | "/compiler-rt")
|
| 2118 | "src/llvm-project/compiler-rt")))
|
| 2119 | (add-after 'unpack 'unpack-libunwind
|
| 2120 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2121 | (mkdir-p "src/llvm-project/libunwind")
|
| 2122 | (copy-recursively
|
| 2123 | (string-append (assoc-ref inputs "clang-source")
|
| 2124 | "/libunwind")
|
| 2125 | "src/llvm-project/libunwind")))
|
| 2126 | (replace 'patch-cargo-checksums
|
| 2127 | (lambda _
|
| 2128 | (substitute*
|
| 2129 | (append '("Cargo.lock"
|
| 2130 | "src/bootstrap/Cargo.lock")
|
| 2131 | (find-files "compiler" "Cargo.lock")
|
| 2132 | (find-files "library" "Cargo.lock")
|
| 2133 | (find-files "src/doc" "Cargo.lock")
|
| 2134 | (remove
|
| 2135 | |
| 2136 | |
| 2137 | (cut string-contains <>
|
| 2138 | "cargo/tests/testsuite")
|
| 2139 | (find-files "src/tools" "Cargo.lock")))
|
| 2140 | (("(checksum = )\".*\"" all name)
|
| 2141 | (string-append name "\"" ,%cargo-reference-hash "\"")))
|
| 2142 | (generate-all-checksums "vendor")))
|
| 2143 | (add-after 'configure 'enable-profiling
|
| 2144 | (lambda _
|
| 2145 | (substitute* "config.toml"
|
| 2146 | (("^profiler =.*$") "")
|
| 2147 | (("\\[build\\]") "\n[build]\nprofiler = true\n"))))
|
| 2148 | (add-after 'configure 'add-gdb-to-config
|
| 2149 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2150 | (let ((gdb (assoc-ref inputs "gdb")))
|
| 2151 | (substitute* "config.toml"
|
| 2152 | (("^python =.*" all)
|
| 2153 | (string-append all
|
| 2154 | "gdb = \"" gdb "/bin/gdb\"\n"))))))
|
| 2155 | (replace 'build
|
| 2156 | |
| 2157 | (lambda* (#:key parallel-build? #:allow-other-keys)
|
| 2158 | (let ((job-spec (string-append
|
| 2159 | "-j" (if parallel-build?
|
| 2160 | (number->string (parallel-job-count))
|
| 2161 | "1"))))
|
| 2162 | (invoke "./x.py" job-spec "build"
|
| 2163 | "library/std" |
| 2164 | "src/tools/cargo"
|
| 2165 | "src/tools/clippy"
|
| 2166 | "src/tools/rust-analyzer"
|
| 2167 | "src/tools/rustfmt"))))
|
| 2168 | (replace 'check
|
| 2169 | |
| 2170 | (lambda* (#:key tests? parallel-build? #:allow-other-keys)
|
| 2171 | (when tests?
|
| 2172 | (let ((job-spec (string-append
|
| 2173 | "-j" (if parallel-build?
|
| 2174 | (number->string (parallel-job-count))
|
| 2175 | "1"))))
|
| 2176 | (invoke "./x.py" job-spec "test" "-vv"
|
| 2177 | "library/std"
|
| 2178 | "src/tools/cargo"
|
| 2179 | "src/tools/clippy"
|
| 2180 | "src/tools/rust-analyzer"
|
| 2181 | "src/tools/rustfmt")))))
|
| 2182 | (replace 'install
|
| 2183 | |
| 2184 | (lambda* (#:key outputs #:allow-other-keys)
|
| 2185 | (invoke "./x.py" "install")
|
| 2186 | (substitute* "config.toml"
|
| 2187 | |
| 2188 | (("prefix = \"[^\"]*\"")
|
| 2189 | (format #f "prefix = ~s" (assoc-ref outputs "cargo"))))
|
| 2190 | (invoke "./x.py" "install" "cargo")
|
| 2191 | (substitute* "config.toml"
|
| 2192 | |
| 2193 | (("prefix = \"[^\"]*\"")
|
| 2194 | (format #f "prefix = ~s" (assoc-ref outputs "tools"))))
|
| 2195 | (invoke "./x.py" "install" "clippy")
|
| 2196 | (invoke "./x.py" "install" "rust-analyzer")
|
| 2197 | (invoke "./x.py" "install" "rustfmt")))
|
| 2198 | (add-before 'patch-cargo-checksums 'save-old-library-manifest
|
| 2199 | (lambda _
|
| 2200 | (copy-file "library/Cargo.lock" ".old-library-manifest")))
|
| 2201 | (add-after 'install 'install-rust-src
|
| 2202 | (lambda* (#:key outputs #:allow-other-keys)
|
| 2203 | (let ((out (assoc-ref outputs "rust-src"))
|
| 2204 | (dest "/lib/rustlib/src/rust"))
|
| 2205 | (mkdir-p (string-append out dest))
|
| 2206 | (copy-recursively "library" (string-append out dest "/library"))
|
| 2207 | |
| 2208 | |
| 2209 | |
| 2210 | |
| 2211 | |
| 2212 | |
| 2213 | |
| 2214 | |
| 2215 | |
| 2216 | |
| 2217 | |
| 2218 | |
| 2219 | (copy-file ".old-library-manifest"
|
| 2220 | (string-append out dest "/library/Cargo.lock"))
|
| 2221 | (copy-recursively "src" (string-append out dest "/src")))))
|
| 2222 | (add-before 'install 'remove-uninstall-script
|
| 2223 | (lambda _
|
| 2224 | |
| 2225 | |
| 2226 | (substitute* "src/tools/rust-installer/install-template.sh"
|
| 2227 | (("install_uninstaller \"") "# install_uninstaller \""))))
|
| 2228 | (add-after 'install-rust-src 'dont-reference-previous-cargo-version
|
| 2229 | (lambda* (#:key outputs #:allow-other-keys)
|
| 2230 | (with-directory-excursion
|
| 2231 | (string-append (assoc-ref outputs "rust-src")
|
| 2232 | "/lib/rustlib/src/rust/src/tools/")
|
| 2233 | (substitute* (find-files "." "\\.rs$")
|
| 2234 | (("#!.*/bin/cargo")
|
| 2235 | (string-append "#!" (assoc-ref outputs "cargo")
|
| 2236 | "/bin/cargo"))))))
|
| 2237 | (add-after 'install-rust-src 'wrap-rust-analyzer
|
| 2238 | (lambda* (#:key outputs #:allow-other-keys)
|
| 2239 | (let ((bin (string-append (assoc-ref outputs "tools") "/bin")))
|
| 2240 | (rename-file (string-append bin "/rust-analyzer")
|
| 2241 | (string-append bin "/.rust-analyzer-real"))
|
| 2242 | (call-with-output-file (string-append bin "/rust-analyzer")
|
| 2243 | (lambda (port)
|
| 2244 | (format port "#!~a
|
| 2245 | if test -z \"${RUST_SRC_PATH}\";then export RUST_SRC_PATH=~S;fi;
|
| 2246 | exec -a \"$0\" \"~a\" \"$@\""
|
| 2247 | (which "bash")
|
| 2248 | (string-append (assoc-ref outputs "rust-src")
|
| 2249 | "/lib/rustlib/src/rust/library")
|
| 2250 | (string-append bin "/.rust-analyzer-real"))))
|
| 2251 | (chmod (string-append bin "/rust-analyzer") #o755))))))))
|
| 2252 | (native-inputs (cons*
|
| 2253 | |
| 2254 | `("clang-source" ,(package-source clang-runtime-21))
|
| 2255 | |
| 2256 | `("gdb" ,gdb/pinned)
|
| 2257 | `("git-minimal" ,git-minimal/pinned)
|
| 2258 | `("procps" ,procps)
|
| 2259 | (package-native-inputs base-rust)))
|
| 2260 | (native-search-paths
|
| 2261 | (cons*
|
| 2262 | |
| 2263 | |
| 2264 | |
| 2265 | (search-path-specification
|
| 2266 | (variable "CARGO_HTTP_CAINFO")
|
| 2267 | (file-type 'regular)
|
| 2268 | (separator #f) |
| 2269 | (files '("etc/ssl/certs/ca-certificates.crt")))
|
| 2270 | |
| 2271 | (search-path-specification
|
| 2272 | (variable "RUST_SRC_PATH")
|
| 2273 | (separator #f) |
| 2274 | (files '("lib/rustlib/src/rust/library")))
|
| 2275 | |
| 2276 | %gcc-search-paths)))))
|
| 2277 |
|
| 2278 | (define*-public (make-rust-sysroot target)
|
| 2279 | (make-rust-sysroot/implementation target rust))
|
| 2280 |
|
| 2281 | (define make-rust-sysroot/implementation
|
| 2282 | (mlambda (target base-rust)
|
| 2283 | (unless (platform-rust-target (lookup-platform-by-target target))
|
| 2284 | (raise
|
| 2285 | (condition
|
| 2286 | (&package-unsupported-target-error
|
| 2287 | (package base-rust)
|
| 2288 | (target target)))))
|
| 2289 |
|
| 2290 | (package
|
| 2291 | (inherit base-rust)
|
| 2292 | (name (string-append "rust-sysroot-for-" target))
|
| 2293 | (outputs '("out"))
|
| 2294 | (arguments
|
| 2295 | (substitute-keyword-arguments (package-arguments base-rust)
|
| 2296 | ((#:tests? _ #f) #f) |
| 2297 | ((#:phases phases)
|
| 2298 | #~(modify-phases #$phases
|
| 2299 | (add-after 'unpack 'unbundle-xz
|
| 2300 | (lambda _
|
| 2301 | (delete-file-recursively "vendor/lzma-sys-0.1.20/xz-5.2")
|
| 2302 | |
| 2303 | |
| 2304 | (substitute* "vendor/lzma-sys-0.1.20/build.rs"
|
| 2305 | (("!want_static && ") ""))))
|
| 2306 | #$@(if (target-mingw? target)
|
| 2307 | `((add-after 'set-env 'patch-for-mingw
|
| 2308 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2309 | (let* ((arch ,(string-take target
|
| 2310 | (string-index target #\-)))
|
| 2311 | (mingw (assoc-ref inputs
|
| 2312 | (string-append "mingw-w64-" arch
|
| 2313 | "-winpthreads"))))
|
| 2314 | (setenv "LIBRARY_PATH"
|
| 2315 | (string-join
|
| 2316 | (delete
|
| 2317 | (string-append mingw "/lib")
|
| 2318 | (string-split (getenv "LIBRARY_PATH") #\:))
|
| 2319 | ":"))
|
| 2320 | (setenv "CPLUS_INCLUDE_PATH"
|
| 2321 | (string-join
|
| 2322 | (delete
|
| 2323 | (string-append mingw "/include")
|
| 2324 | (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
|
| 2325 | ":"))))))
|
| 2326 | `())
|
| 2327 | (replace 'set-env
|
| 2328 | (lambda* (#:key inputs #:allow-other-keys)
|
| 2329 | (setenv "SHELL" (which "sh"))
|
| 2330 | (setenv "CONFIG_SHELL" (which "sh"))
|
| 2331 | (setenv "CC" (which "gcc"))
|
| 2332 | |
| 2333 | (setenv "LLVM_LINK_SHARED" "1")
|
| 2334 |
|
| 2335 | (setenv "CROSS_LIBRARY_PATH" (getenv "LIBRARY_PATH"))
|
| 2336 | (setenv "CROSS_CPLUS_INCLUDE_PATH" (getenv "CPLUS_INCLUDE_PATH"))
|
| 2337 | (when (assoc-ref inputs (string-append "glibc-cross-" #$target))
|
| 2338 | (setenv "LIBRARY_PATH"
|
| 2339 | (string-join
|
| 2340 | (delete
|
| 2341 | (string-append
|
| 2342 | (assoc-ref inputs
|
| 2343 | (string-append "glibc-cross-" #$target))
|
| 2344 | "/lib")
|
| 2345 | (string-split (getenv "LIBRARY_PATH") #\:))
|
| 2346 | ":"))
|
| 2347 | (setenv "CPLUS_INCLUDE_PATH"
|
| 2348 | (string-join
|
| 2349 | (delete
|
| 2350 | (string-append
|
| 2351 | (assoc-ref inputs
|
| 2352 | (string-append "glibc-cross-" #$target))
|
| 2353 | "/include")
|
| 2354 | (string-split (getenv "CPLUS_INCLUDE_PATH") #\:))
|
| 2355 | ":")))))
|
| 2356 | (replace 'configure
|
| 2357 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 2358 | (let* ((out (assoc-ref outputs "out"))
|
| 2359 | (target-cc
|
| 2360 | (search-input-file
|
| 2361 | inputs (string-append "/bin/" #$(cc-for-target target)))))
|
| 2362 | (call-with-output-file "config.toml"
|
| 2363 | (lambda (port)
|
| 2364 | (display (string-append "
|
| 2365 | [llvm]
|
| 2366 | [build]
|
| 2367 | cargo = \"" (search-input-file inputs "/bin/cargo") "\"
|
| 2368 | rustc = \"" (search-input-file inputs "/bin/rustc") "\"
|
| 2369 | docs = false
|
| 2370 | python = \"" (which "python") "\"
|
| 2371 | vendor = true
|
| 2372 | submodules = false
|
| 2373 | target = [\"" #$(platform-rust-target (lookup-platform-by-target target)) "\"]
|
| 2374 | [install]
|
| 2375 | prefix = \"" out "\"
|
| 2376 | sysconfdir = \"etc\"
|
| 2377 | [rust]
|
| 2378 | debug = false
|
| 2379 | jemalloc = false
|
| 2380 | default-linker = \"" target-cc "\"
|
| 2381 | channel = \"stable\"
|
| 2382 | [target." #$(platform-rust-target (lookup-platform-by-system (%current-system))) "]
|
| 2383 | # These are all native tools
|
| 2384 | llvm-config = \"" (search-input-file inputs "/bin/llvm-config") "\"
|
| 2385 | linker = \"" (which "gcc") "\"
|
| 2386 | cc = \"" (which "gcc") "\"
|
| 2387 | cxx = \"" (which "g++") "\"
|
| 2388 | ar = \"" (which "ar") "\"
|
| 2389 | [target." #$(platform-rust-target (lookup-platform-by-target target)) "]
|
| 2390 | llvm-config = \"" (search-input-file inputs "/bin/llvm-config") "\"
|
| 2391 | linker = \"" target-cc "\"
|
| 2392 | cc = \"" target-cc "\"
|
| 2393 | cxx = \"" (search-input-file inputs (string-append "/bin/" #$(cxx-for-target target))) "\"
|
| 2394 | ar = \"" (search-input-file inputs (string-append "/bin/" #$(ar-for-target target))) "\"
|
| 2395 | [dist]
|
| 2396 | ") port))))))
|
| 2397 | (replace 'build
|
| 2398 | |
| 2399 | (lambda* (#:key parallel-build? #:allow-other-keys)
|
| 2400 | (let ((job-spec (string-append
|
| 2401 | "-j" (if parallel-build?
|
| 2402 | (number->string (parallel-job-count))
|
| 2403 | "1"))))
|
| 2404 | |
| 2405 | |
| 2406 | (invoke "./x.py" job-spec "build" "library/std"))))
|
| 2407 | (replace 'install
|
| 2408 | (lambda _
|
| 2409 | (invoke "./x.py" "install" "library/std")))
|
| 2410 | (delete 'enable-profiling)
|
| 2411 | (delete 'install-rust-src)
|
| 2412 | (delete 'dont-reference-previous-cargo-version)
|
| 2413 | (delete 'wrap-rust-analyzer)
|
| 2414 | (delete 'wrap-rustc)))))
|
| 2415 | (inputs
|
| 2416 | (modify-inputs inputs
|
| 2417 | (prepend xz))) |
| 2418 | (propagated-inputs
|
| 2419 | (if (target-mingw? target)
|
| 2420 | (modify-inputs propagated-inputs
|
| 2421 | (prepend
|
| 2422 | (make-mingw-w64
|
| 2423 | (string-take target (string-index target #\-))
|
| 2424 | #:with-winpthreads? #t)))
|
| 2425 | (package-propagated-inputs base-rust)))
|
| 2426 | (native-inputs
|
| 2427 | (modify-inputs native-inputs
|
| 2428 | (prepend (cross-gcc target
|
| 2429 | #:libc (cross-libc target)))
|
| 2430 | (prepend (if (target-mingw? target)
|
| 2431 | (make-mingw-w64
|
| 2432 | (string-take target (string-index target #\-))
|
| 2433 | #:with-winpthreads? #t)
|
| 2434 | (cross-libc target)))
|
| 2435 | (prepend (cross-binutils target))))
|
| 2436 | (properties
|
| 2437 | `((hidden? . #t) ,(package-properties base-rust))))))
|
| 2438 |
|
| 2439 | (define-public rust-sysroot-for-wasm32-unknown-unknown
|
| 2440 | (package
|
| 2441 | (inherit (make-rust-sysroot "i686-linux-gnu"))
|
| 2442 | (name "rust-sysroot-for-wasm32-unknown-unknown")
|
| 2443 | (arguments
|
| 2444 | (substitute-keyword-arguments arguments
|
| 2445 | ((#:phases phases)
|
| 2446 | #~(modify-phases #$phases
|
| 2447 | (replace 'set-env
|
| 2448 | (lambda _
|
| 2449 | (setenv "SHELL" (which "sh"))
|
| 2450 | (setenv "CONFIG_SHELL" (which "sh"))
|
| 2451 | (setenv "CC" (which "clang"))
|
| 2452 | |
| 2453 | (setenv "LLVM_LINK_SHARED" "1")))
|
| 2454 | (replace 'configure
|
| 2455 | (lambda* (#:key inputs outputs #:allow-other-keys)
|
| 2456 | (call-with-output-file "config.toml"
|
| 2457 | (lambda (port)
|
| 2458 | (display (string-append "
|
| 2459 | [llvm]
|
| 2460 | [build]
|
| 2461 | cargo = \"" (search-input-file inputs "/bin/cargo") "\"
|
| 2462 | rustc = \"" (search-input-file inputs "/bin/rustc") "\"
|
| 2463 | docs = false
|
| 2464 | python = \"" (which "python") "\"
|
| 2465 | vendor = true
|
| 2466 | submodules = false
|
| 2467 | target = [\"wasm32-unknown-unknown\"]
|
| 2468 | [install]
|
| 2469 | prefix = \"" (assoc-ref outputs "out") "\"
|
| 2470 | sysconfdir = \"etc\"
|
| 2471 | [rust]
|
| 2472 | debug = false
|
| 2473 | jemalloc = false
|
| 2474 | default-linker = \"lld\"
|
| 2475 | channel = \"stable\"
|
| 2476 | [target." #$(platform-rust-target (lookup-platform-by-system (%current-system))) "]
|
| 2477 | # These are all native tools
|
| 2478 | llvm-config = \"" (search-input-file inputs "/bin/llvm-config") "\"
|
| 2479 | linker = \"" (which "gcc") "\"
|
| 2480 | cc = \"" (which "gcc") "\"
|
| 2481 | cxx = \"" (which "g++") "\"
|
| 2482 | ar = \"" (which "ar") "\"
|
| 2483 | [target.wasm32-unknown-unknown]
|
| 2484 | llvm-config = \"" (search-input-file inputs "/bin/llvm-config") "\"
|
| 2485 | linker = \"lld\"
|
| 2486 | cc = \"clang\"
|
| 2487 | cxx = \"clang++\"
|
| 2488 | ar = \"ar\"
|
| 2489 | [dist]
|
| 2490 | ") port)))))))))
|
| 2491 | |
| 2492 | (native-inputs (package-native-inputs rust))))
|
| 2493 |
|
| 2494 | (define-public rust-analyzer
|
| 2495 | (package
|
| 2496 | (name "rust-analyzer")
|
| 2497 | (version (package-version rust))
|
| 2498 | (source #f)
|
| 2499 | (build-system trivial-build-system)
|
| 2500 | (arguments
|
| 2501 | (list
|
| 2502 | #:modules '((guix build utils))
|
| 2503 | #:builder
|
| 2504 | #~(begin
|
| 2505 | (use-modules (guix build utils))
|
| 2506 | (let ((rust (assoc-ref %build-inputs "rust")))
|
| 2507 | (install-file (string-append rust "/bin/rust-analyzer")
|
| 2508 | (string-append #$output "/bin"))
|
| 2509 | (copy-recursively (string-append rust "/share")
|
| 2510 | (string-append #$output "/share"))))))
|
| 2511 | (inputs
|
| 2512 | (list (list rust "tools")))
|
| 2513 | (home-page "https://rust-analyzer.github.io/")
|
| 2514 | (synopsis "Experimental Rust compiler front-end for IDEs")
|
| 2515 | (description "Rust-analyzer is a modular compiler frontend for the Rust
|
| 2516 | language. It is a part of a larger rls-2.0 effort to create excellent IDE
|
| 2517 | support for Rust.")
|
| 2518 | (license (list license:expat license:asl2.0))))
|