Commit | Line | Data |
---|---|---|
423f9e44 DC |
1 | ;;; GNU Guix --- Functional package management for GNU |
2 | ;;; Copyright © 2016 David Craven <david@craven.ch> | |
ecee2147 | 3 | ;;; Copyright © 2016 Eric Le Bihan <eric.le.bihan.dev@free.fr> |
3c986a7d | 4 | ;;; Copyright © 2016 Nikita <nikita@n0.is> |
fa73a7c1 | 5 | ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com> |
f342bb58 | 6 | ;;; Copyright © 2017, 2018 Nikolai Merinov <nikolai.merinov@member.fsf.org> |
e07b0488 | 7 | ;;; Copyright © 2017, 2019 Efraim Flashner <efraim@flashner.co.il> |
03f9a8c3 | 8 | ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr> |
a92bf11c | 9 | ;;; Copyright © 2018 Danny Milosavljevic <dannym+a@scratchpost.org> |
7d141788 | 10 | ;;; Copyright © 2019 Ivan Petkov <ivanppetkov@gmail.com> |
7befec25 | 11 | ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net> |
423f9e44 DC |
12 | ;;; |
13 | ;;; This file is part of GNU Guix. | |
14 | ;;; | |
15 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
16 | ;;; under the terms of the GNU General Public License as published by | |
17 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
18 | ;;; your option) any later version. | |
19 | ;;; | |
20 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
21 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | ;;; GNU General Public License for more details. | |
24 | ;;; | |
25 | ;;; You should have received a copy of the GNU General Public License | |
26 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
27 | ||
28 | (define-module (gnu packages rust) | |
29 | #:use-module (gnu packages base) | |
5f3d46ce | 30 | #:use-module (gnu packages bison) |
423f9e44 | 31 | #:use-module (gnu packages bootstrap) |
ecee2147 | 32 | #:use-module (gnu packages cmake) |
423f9e44 | 33 | #:use-module (gnu packages compression) |
b5a09649 | 34 | #:use-module (gnu packages curl) |
423f9e44 | 35 | #:use-module (gnu packages elf) |
5f3d46ce | 36 | #:use-module (gnu packages flex) |
423f9e44 | 37 | #:use-module (gnu packages gcc) |
d53fb678 | 38 | #:use-module (gnu packages gdb) |
ecee2147 | 39 | #:use-module (gnu packages jemalloc) |
5f3d46ce | 40 | #:use-module (gnu packages linux) |
ecee2147 | 41 | #:use-module (gnu packages llvm) |
b5a09649 | 42 | #:use-module (gnu packages pkg-config) |
ecee2147 | 43 | #:use-module (gnu packages python) |
b5a09649 DC |
44 | #:use-module (gnu packages ssh) |
45 | #:use-module (gnu packages tls) | |
d53fb678 | 46 | #:use-module (gnu packages) |
b5a09649 | 47 | #:use-module (guix build-system cargo) |
423f9e44 DC |
48 | #:use-module (guix build-system gnu) |
49 | #:use-module (guix build-system trivial) | |
50 | #:use-module (guix download) | |
a92bf11c | 51 | #:use-module (guix git-download) |
423f9e44 DC |
52 | #:use-module ((guix licenses) #:prefix license:) |
53 | #:use-module (guix packages) | |
f342bb58 NM |
54 | #:use-module ((guix build utils) #:select (alist-replace)) |
55 | #:use-module (guix utils) | |
423f9e44 DC |
56 | #:use-module (ice-9 match) |
57 | #:use-module (srfi srfi-26)) | |
58 | ||
9483782a JK |
59 | ;; This is the hash for the empty file, and the reason it's relevant is not |
60 | ;; the most obvious. | |
61 | ;; | |
62 | ;; The root of the problem is that Cargo keeps track of a file called | |
63 | ;; Cargo.lock, that contains the hash of the tarball source of each dependency. | |
64 | ;; | |
65 | ;; However, tarball sources aren't handled well by Guix because of the need to | |
66 | ;; patch shebangs in any helper scripts. This is why we use Cargo's vendoring | |
67 | ;; capabilities, where instead of the tarball, a directory is provided in its | |
68 | ;; place. (In the case of rustc, the source code already ships with vendored | |
69 | ;; dependencies, but crates built with cargo-build-system undergo vendoring | |
70 | ;; during the build.) | |
71 | ;; | |
72 | ;; To preserve the advantages of checksumming, vendored dependencies contain | |
73 | ;; a file called .cargo-checksum.json, which contains the hash of the tarball, | |
74 | ;; as well as the list of files in it, with the hash of each file. | |
75 | ;; | |
76 | ;; The patch-cargo-checksums phase of cargo-build-system runs after | |
77 | ;; any Guix-specific patches to the vendored dependencies and regenerates the | |
78 | ;; .cargo-checksum.json files, but it's hard to know the tarball checksum that | |
79 | ;; should be written to the file - and taking care of any unhandled edge case | |
80 | ;; would require rebuilding everything that depends on rust. This is why we lie, | |
81 | ;; and say that the tarball has the hash of an empty file. It's not a problem | |
82 | ;; because cargo-build-system removes the Cargo.lock file. We can't do that | |
83 | ;; for rustc because of a quirk of its build system, so we modify the lock file | |
84 | ;; to substitute the hash. | |
d53fb678 NM |
85 | (define %cargo-reference-hash |
86 | "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855") | |
423f9e44 | 87 | |
2c790226 MW |
88 | (define* (nix-system->gnu-triplet-for-rust |
89 | #:optional (system (%current-system))) | |
90 | (match system | |
91 | ("x86_64-linux" "x86_64-unknown-linux-gnu") | |
92 | ("i686-linux" "i686-unknown-linux-gnu") | |
93 | ("armhf-linux" "armv7-unknown-linux-gnueabihf") | |
94 | ("aarch64-linux" "aarch64-unknown-linux-gnu") | |
95 | ("mips64el-linux" "mips64el-unknown-linux-gnuabi64") | |
96 | (_ (nix-system->gnu-triplet system)))) | |
97 | ||
4ed20d3c IP |
98 | (define* (rust-uri version #:key (dist "static")) |
99 | (string-append "https://" dist ".rust-lang.org/dist/" | |
100 | "rustc-" version "-src.tar.gz")) | |
339c1365 | 101 | |
4ed20d3c IP |
102 | (define* (rust-bootstrapped-package base-rust version checksum) |
103 | "Bootstrap rust VERSION with source checksum CHECKSUM using BASE-RUST." | |
339c1365 IP |
104 | (package |
105 | (inherit base-rust) | |
106 | (version version) | |
107 | (source | |
4ed20d3c IP |
108 | (origin |
109 | (inherit (package-source base-rust)) | |
110 | (uri (rust-uri version)) | |
111 | (sha256 (base32 checksum)))) | |
24d298b4 DM |
112 | (native-inputs |
113 | (alist-replace "cargo-bootstrap" (list base-rust "cargo") | |
114 | (alist-replace "rustc-bootstrap" (list base-rust) | |
115 | (package-native-inputs base-rust)))))) | |
116 | ||
117 | (define-public mrustc | |
118 | (let ((rustc-version "1.19.0")) | |
119 | (package | |
120 | (name "mrustc") | |
5b600fca | 121 | (version "0.9") |
24d298b4 DM |
122 | (source (origin |
123 | (method git-fetch) | |
124 | (uri (git-reference | |
b0e7b699 | 125 | (url "https://github.com/thepowersgang/mrustc") |
24d298b4 DM |
126 | (commit (string-append "v" version)))) |
127 | (file-name (git-file-name name version)) | |
128 | (sha256 | |
129 | (base32 | |
5b600fca | 130 | "194ny7vsks5ygiw7d8yxjmp1qwigd71ilchis6xjl6bb2sj97rd2")))) |
24d298b4 DM |
131 | (outputs '("out" "cargo")) |
132 | (build-system gnu-build-system) | |
133 | (inputs | |
b07384b5 | 134 | `(("zlib" ,zlib))) |
24d298b4 DM |
135 | (native-inputs |
136 | `(("bison" ,bison) | |
137 | ("flex" ,flex) | |
138 | ;; Required for the libstd sources. | |
b07384b5 | 139 | ("rustc" ,(package-source rust-1.19)))) |
24d298b4 | 140 | (arguments |
5b600fca | 141 | `(#:test-target "test" |
b07384b5 DM |
142 | #:make-flags |
143 | (list ,(string-append "RUSTC_TARGET=" | |
144 | (or (%current-target-system) | |
145 | (nix-system->gnu-triplet-for-rust)))) | |
24d298b4 DM |
146 | #:phases |
147 | (modify-phases %standard-phases | |
148 | (add-after 'unpack 'patch-date | |
149 | (lambda _ | |
150 | (substitute* "Makefile" | |
151 | (("shell date") "shell date -d @1")) | |
b07384b5 DM |
152 | (substitute* "run_rustc/Makefile" |
153 | (("[$]Vtime ") "$V ")) | |
24d298b4 DM |
154 | #t)) |
155 | (add-after 'patch-date 'unpack-target-compiler | |
156 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
24d298b4 | 157 | (invoke "tar" "xf" (assoc-ref inputs "rustc")) |
b07384b5 | 158 | (chdir ,(string-append "rustc-" rustc-version "-src")) |
5b600fca DM |
159 | (invoke "patch" "-p0" ,(string-append "../rustc-" rustc-version |
160 | "-src.patch")) | |
24d298b4 | 161 | (chdir "..") |
5b600fca DM |
162 | (setenv "RUSTC_VERSION" ,rustc-version) |
163 | (setenv "MRUSTC_TARGET_VER" | |
164 | ,(version-major+minor rustc-version)) | |
165 | (setenv "OUTDIR_SUF" "") | |
24d298b4 DM |
166 | #t)) |
167 | (replace 'configure | |
168 | (lambda* (#:key inputs #:allow-other-keys) | |
b07384b5 DM |
169 | (setenv "CC" (string-append (assoc-ref inputs "gcc") |
170 | "/bin/gcc")) | |
171 | (setenv "CXX" (string-append (assoc-ref inputs "gcc") | |
172 | "/bin/g++")) | |
24d298b4 DM |
173 | #t)) |
174 | (add-after 'build 'build-minicargo | |
b07384b5 | 175 | (lambda* (#:key make-flags #:allow-other-keys) |
5b600fca | 176 | ;; TODO: minicargo.mk: RUSTC_VERSION=$(RUSTC_VERSION) RUSTC_CHANNEL=$(RUSTC_SRC_TY) OUTDIR_SUF=$(OUTDIR_SUF) |
b07384b5 DM |
177 | (apply invoke "make" "-f" "minicargo.mk" "LIBS" make-flags) |
178 | (apply invoke "make" "-C" "tools/minicargo" make-flags))) | |
5b600fca DM |
179 | ;(add-after 'check 'check-locally |
180 | ; (lambda* (#:key make-flags #:allow-other-keys) | |
181 | ; ;; The enum test wouldn't work otherwise. | |
182 | ; ;; See <https://github.com/thepowersgang/mrustc/issues/137>. | |
183 | ; (setenv "MRUSTC_TARGET_VER" ,(version-major+minor rustc-version)) | |
184 | ; (apply invoke "make" "local_tests" make-flags))) | |
24d298b4 DM |
185 | (replace 'install |
186 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
187 | (let* ((out (assoc-ref outputs "out")) | |
188 | (bin (string-append out "/bin")) | |
189 | (tools-bin (string-append out "/tools/bin")) | |
190 | (cargo-out (assoc-ref outputs "cargo")) | |
191 | (cargo-bin (string-append cargo-out "/bin")) | |
192 | (lib (string-append out "/lib")) | |
193 | (lib/rust (string-append lib "/mrust")) | |
b07384b5 | 194 | (gcc (assoc-ref inputs "gcc")) |
5b600fca DM |
195 | (run_rustc (string-append out |
196 | "/share/mrustc/run_rustc"))) | |
24d298b4 DM |
197 | ;; These files are not reproducible. |
198 | (for-each delete-file (find-files "output" "\\.txt$")) | |
5b600fca DM |
199 | ;(delete-file-recursively "output/local_tests") |
200 | (mkdir-p (dirname lib/rust)) | |
24d298b4 DM |
201 | (copy-recursively "output" lib/rust) |
202 | (mkdir-p bin) | |
203 | (mkdir-p tools-bin) | |
204 | (install-file "bin/mrustc" bin) | |
205 | ;; minicargo uses relative paths to resolve mrustc. | |
206 | (install-file "tools/bin/minicargo" tools-bin) | |
207 | (install-file "tools/bin/minicargo" cargo-bin) | |
b07384b5 DM |
208 | (mkdir-p run_rustc) |
209 | (copy-file "run_rustc/Makefile" | |
210 | (string-append run_rustc "/Makefile")) | |
24d298b4 | 211 | #t)))))) |
7af0f215 | 212 | (synopsis "Compiler for the Rust programming language") |
24d298b4 DM |
213 | (description "Rust is a systems programming language that provides memory |
214 | safety and thread safety guarantees.") | |
215 | (home-page "https://github.com/thepowersgang/mrustc") | |
216 | ;; Dual licensed. | |
217 | (license (list license:asl2.0 license:expat))))) | |
218 | ||
4f963b6f | 219 | (define rust-1.19 |
ecee2147 | 220 | (package |
f342bb58 | 221 | (name "rust") |
8fdde581 | 222 | (version "1.19.0") |
4ed20d3c IP |
223 | (source |
224 | (origin | |
225 | (method url-fetch) | |
226 | (uri (rust-uri "1.19.0")) | |
227 | (sha256 (base32 "0l8c14qsf42rmkqy92ahij4vf356dbyspxcips1aswpvad81y8qm")) | |
228 | (modules '((guix build utils))) | |
229 | (snippet '(begin (delete-file-recursively "src/llvm") #t)) | |
e28a824f | 230 | (patches (search-patches "rust-1.19-mrustc.patch")))) |
8fdde581 | 231 | (outputs '("out" "cargo")) |
b7c1c2b8 DM |
232 | (properties '((timeout . 72000) ;20 hours |
233 | (max-silent-time . 18000))) ;5 hours (for armel) | |
ecee2147 | 234 | (arguments |
e07b0488 | 235 | `(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums' |
3159ef7c | 236 | #:modules ((guix build utils) (ice-9 match) (guix build gnu-build-system)) |
d53fb678 | 237 | #:phases |
ecee2147 | 238 | (modify-phases %standard-phases |
ecee2147 | 239 | (add-after 'unpack 'set-env |
1bb23335 NM |
240 | (lambda* (#:key inputs #:allow-other-keys) |
241 | ;; Disable test for cross compilation support. | |
242 | (setenv "CFG_DISABLE_CROSS_TESTS" "1") | |
ecee2147 | 243 | (setenv "SHELL" (which "sh")) |
326249ba | 244 | (setenv "CONFIG_SHELL" (which "sh")) |
1bb23335 | 245 | (setenv "CC" (string-append (assoc-ref inputs "gcc") "/bin/gcc")) |
d53fb678 NM |
246 | ;; guix llvm-3.9.1 package installs only shared libraries |
247 | (setenv "LLVM_LINK_SHARED" "1") | |
326249ba | 248 | #t)) |
3159ef7c DM |
249 | (add-after 'unpack 'patch-cargo-tomls |
250 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
251 | (substitute* "src/librustc_errors/Cargo.toml" | |
252 | (("[[]dependencies[]]") " | |
253 | [dependencies] | |
254 | term = \"0.4.4\" | |
255 | ")) | |
256 | (substitute* "src/librustc/Cargo.toml" | |
257 | (("[[]dependencies[]]") " | |
258 | [dependencies] | |
259 | getopts = { path = \"../libgetopts\" } | |
260 | ")) | |
261 | (substitute* "src/librustdoc/Cargo.toml" | |
262 | (("[[]dependencies[]]") " | |
263 | [dependencies] | |
264 | test = { path = \"../libtest\" } | |
265 | ")) | |
266 | #t)) | |
84aac61c DM |
267 | (add-after 'unpack 'patch-tests |
268 | (lambda* (#:key inputs #:allow-other-keys) | |
9b7a9580 | 269 | (let ((bash (assoc-ref inputs "bash"))) |
9b7a9580 | 270 | (substitute* "src/libstd/process.rs" |
5f3d46ce DM |
271 | ;; The newline is intentional. |
272 | ;; There's a line length "tidy" check in Rust which would | |
273 | ;; fail otherwise. | |
d53fb678 NM |
274 | (("\"/bin/sh\"") (string-append "\n\"" bash "/bin/sh\""))) |
275 | (substitute* "src/libstd/net/tcp.rs" | |
276 | ;; There is no network in build environment | |
277 | (("fn connect_timeout_unroutable") | |
278 | "#[ignore]\nfn connect_timeout_unroutable")) | |
279 | ;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00222.html> | |
5f3d46ce | 280 | (substitute* "src/libstd/sys/unix/process/process_common.rs" |
237587f1 DM |
281 | (("fn test_process_mask") "#[allow(unused_attributes)] |
282 | #[ignore] | |
af4ea9c5 | 283 | fn test_process_mask")) |
9b7a9580 | 284 | #t))) |
b47b2d32 NM |
285 | (add-after 'patch-tests 'patch-aarch64-test |
286 | (lambda* _ | |
287 | (substitute* "src/librustc_back/dynamic_lib.rs" | |
288 | ;; This test is known to fail on aarch64 and powerpc64le: | |
289 | ;; https://github.com/rust-lang/rust/issues/45410 | |
290 | (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) | |
291 | #t)) | |
292 | (add-after 'patch-tests 'use-readelf-for-tests | |
293 | (lambda* _ | |
294 | ;; nm doesn't recognize the file format because of the | |
295 | ;; nonstandard sections used by the Rust compiler, but readelf | |
296 | ;; ignores them. | |
297 | (substitute* "src/test/run-make/atomic-lock-free/Makefile" | |
298 | (("\tnm ") | |
299 | "\treadelf -c ")) | |
300 | #t)) | |
301 | (add-after 'patch-tests 'remove-unsupported-tests | |
302 | (lambda* _ | |
303 | ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH. | |
304 | ;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html> | |
305 | (delete-file-recursively "src/test/run-make/linker-output-non-utf8") | |
306 | #t)) | |
d53fb678 | 307 | (add-after 'patch-source-shebangs 'patch-cargo-checksums |
f342bb58 | 308 | (lambda* _ |
4585859f | 309 | (use-modules (guix build cargo-utils)) |
d53fb678 NM |
310 | (substitute* "src/Cargo.lock" |
311 | (("(\"checksum .* = )\".*\"" all name) | |
312 | (string-append name "\"" ,%cargo-reference-hash "\""))) | |
e07b0488 | 313 | (generate-all-checksums "src/vendor") |
d53fb678 | 314 | #t)) |
3159ef7c | 315 | ;; This phase is overridden by newer versions. |
ecee2147 | 316 | (replace 'configure |
8fdde581 | 317 | (const #t)) |
3159ef7c DM |
318 | ;; This phase is overridden by newer versions. |
319 | (replace 'build | |
320 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
321 | (let ((rustc-bootstrap (assoc-ref inputs "rustc-bootstrap"))) | |
322 | (setenv "CFG_COMPILER_HOST_TRIPLE" | |
323 | ,(nix-system->gnu-triplet (%current-system))) | |
324 | (setenv "CFG_RELEASE" "") | |
325 | (setenv "CFG_RELEASE_CHANNEL" "stable") | |
326 | (setenv "CFG_LIBDIR_RELATIVE" "lib") | |
327 | (setenv "CFG_VERSION" "1.19.0-stable-mrustc") | |
5b600fca | 328 | (setenv "MRUSTC_TARGET_VER" ,(version-major+minor version)) |
3159ef7c DM |
329 | ; bad: (setenv "CFG_PREFIX" "mrustc") ; FIXME output path. |
330 | (mkdir-p "output") | |
5b600fca DM |
331 | ;; mrustc 0.9 doesn't check the search paths for crates anymore. |
332 | (copy-recursively (string-append rustc-bootstrap "/lib/mrust") | |
333 | "output") | |
3159ef7c DM |
334 | (invoke (string-append rustc-bootstrap "/tools/bin/minicargo") |
335 | "src/rustc" "--vendor-dir" "src/vendor" | |
336 | "--output-dir" "output/rustc-build" | |
337 | "-L" (string-append rustc-bootstrap "/lib/mrust") | |
338 | "-j" "1") | |
3159ef7c DM |
339 | (setenv "CFG_COMPILER_HOST_TRIPLE" #f) |
340 | (setenv "CFG_RELEASE" #f) | |
341 | (setenv "CFG_RELEASE_CHANNEL" #f) | |
342 | (setenv "CFG_VERSION" #f) | |
343 | (setenv "CFG_PREFIX" #f) | |
344 | (setenv "CFG_LIBDIR_RELATIVE" #f) | |
345 | (invoke (string-append rustc-bootstrap "/tools/bin/minicargo") | |
346 | "src/tools/cargo" "--vendor-dir" "src/vendor" | |
347 | "--output-dir" "output/cargo-build" | |
348 | "-L" "output/" | |
349 | "-L" (string-append rustc-bootstrap "/lib/mrust") | |
350 | "-j" "1") | |
351 | ;; Now use the newly-built rustc to build the libraries. | |
352 | ;; One day that could be replaced by: | |
353 | ;; (invoke "output/cargo-build/cargo" "build" | |
354 | ;; "--manifest-path" "src/bootstrap/Cargo.toml" | |
355 | ;; "--verbose") ; "--locked" "--frozen" | |
356 | ;; but right now, Cargo has problems with libstd's circular | |
357 | ;; dependencies. | |
358 | (mkdir-p "output/target-libs") | |
0bcd1bc7 | 359 | (for-each (match-lambda |
3159ef7c DM |
360 | ((name . flags) |
361 | (write name) | |
362 | (newline) | |
363 | (apply invoke | |
364 | "output/rustc-build/rustc" | |
365 | "-C" (string-append "linker=" | |
366 | (getenv "CC")) | |
6c1a6584 DM |
367 | ;; Required for libterm. |
368 | "-Z" "force-unstable-if-unmarked" | |
3159ef7c DM |
369 | "-L" "output/target-libs" |
370 | (string-append "src/" name "/lib.rs") | |
371 | "-o" | |
372 | (string-append "output/target-libs/" | |
373 | (car (string-split name #\/)) | |
374 | ".rlib") | |
375 | flags))) | |
376 | '(("libcore") | |
377 | ("libstd_unicode") | |
378 | ("liballoc") | |
379 | ("libcollections") | |
380 | ("librand") | |
381 | ("liblibc/src" "--cfg" "stdbuild") | |
382 | ("libunwind" "-l" "gcc_s") | |
383 | ("libcompiler_builtins") | |
384 | ("liballoc_system") | |
385 | ("libpanic_unwind") | |
386 | ;; Uses "cc" to link. | |
387 | ("libstd" "-l" "dl" "-l" "rt" "-l" "pthread") | |
6c1a6584 DM |
388 | ("libarena") |
389 | ||
390 | ;; Test dependencies: | |
391 | ||
392 | ("libgetopts") | |
393 | ("libterm") | |
394 | ("libtest"))) | |
3159ef7c DM |
395 | #t))) |
396 | ;; This phase is overridden by newer versions. | |
8fdde581 DM |
397 | (replace 'check |
398 | (const #t)) | |
3159ef7c | 399 | ;; This phase is overridden by newer versions. |
8fdde581 | 400 | (replace 'install |
3159ef7c DM |
401 | (lambda* (#:key inputs outputs #:allow-other-keys) |
402 | (let* ((out (assoc-ref outputs "out")) | |
403 | (target-system ,(or (%current-target-system) | |
404 | (nix-system->gnu-triplet | |
405 | (%current-system)))) | |
406 | (out-libs (string-append out "/lib/rustlib/" | |
407 | target-system "/lib"))) | |
408 | ;(setenv "CFG_PREFIX" out) | |
409 | (mkdir-p out-libs) | |
410 | (copy-recursively "output/target-libs" out-libs) | |
411 | (install-file "output/rustc-build/rustc" | |
412 | (string-append out "/bin")) | |
5a3fcf5b DM |
413 | (install-file "output/rustc-build/rustdoc" |
414 | (string-append out "/bin")) | |
3159ef7c DM |
415 | (install-file "output/cargo-build/cargo" |
416 | (string-append (assoc-ref outputs "cargo") | |
417 | "/bin"))) | |
418 | #t))))) | |
8fdde581 DM |
419 | (build-system gnu-build-system) |
420 | (native-inputs | |
421 | `(("bison" ,bison) ; For the tests | |
c69959f0 | 422 | ("cmake" ,cmake-minimal) |
8fdde581 DM |
423 | ("flex" ,flex) ; For the tests |
424 | ("gdb" ,gdb) ; For the tests | |
8fdde581 DM |
425 | ("procps" ,procps) ; For the tests |
426 | ("python-2" ,python-2) | |
3159ef7c DM |
427 | ("rustc-bootstrap" ,mrustc) |
428 | ("cargo-bootstrap" ,mrustc "cargo") | |
8fdde581 DM |
429 | ("pkg-config" ,pkg-config) ; For "cargo" |
430 | ("which" ,which))) | |
431 | (inputs | |
432 | `(("jemalloc" ,jemalloc-4.5.0) | |
433 | ("llvm" ,llvm-3.9.1) | |
e74f153a | 434 | ("openssl" ,openssl-1.0) |
e027a494 NM |
435 | ("libssh2" ,libssh2) ; For "cargo" |
436 | ("libcurl" ,curl))) ; For "cargo" | |
afc2bf53 | 437 | |
8fdde581 | 438 | ;; rustc invokes gcc, so we need to set its search paths accordingly. |
afc2bf53 LC |
439 | ;; Note: duplicate its value here to cope with circular dependencies among |
440 | ;; modules (see <https://bugs.gnu.org/31392>). | |
441 | (native-search-paths | |
442 | (list (search-path-specification | |
fd1fde60 | 443 | (variable "C_INCLUDE_PATH") |
afc2bf53 | 444 | (files '("include"))) |
fd1fde60 LC |
445 | (search-path-specification |
446 | (variable "CPLUS_INCLUDE_PATH") | |
447 | (files '("include/c++" "include"))) | |
afc2bf53 LC |
448 | (search-path-specification |
449 | (variable "LIBRARY_PATH") | |
03f9a8c3 | 450 | (files '("lib" "lib64"))))) |
afc2bf53 | 451 | |
8fdde581 DM |
452 | (synopsis "Compiler for the Rust progamming language") |
453 | (description "Rust is a systems programming language that provides memory | |
454 | safety and thread safety guarantees.") | |
455 | (home-page "https://www.rust-lang.org") | |
456 | ;; Dual licensed. | |
457 | (license (list license:asl2.0 license:expat)))) | |
458 | ||
614cfd5c DM |
459 | (define-public rust-1.20 |
460 | (let ((base-rust | |
4ed20d3c | 461 | (rust-bootstrapped-package rust-1.19 "1.20.0" |
614cfd5c DM |
462 | "0542y4rnzlsrricai130mqyxl8r6rd991frb4qsnwb27yigqg91a"))) |
463 | (package | |
464 | (inherit base-rust) | |
4ed20d3c IP |
465 | (source |
466 | (origin | |
467 | (inherit (package-source base-rust)) | |
468 | (snippet '(begin | |
469 | (delete-file-recursively "src/jemalloc") | |
470 | (delete-file-recursively "src/llvm") | |
471 | #t)) | |
472 | (patches '()))) | |
47cd0feb MB |
473 | (native-inputs |
474 | `(;; The tests fail with newer versions of GNU Make. | |
475 | ("make" ,gnu-make-4.2) | |
476 | ,@(package-native-inputs base-rust))) | |
614cfd5c | 477 | (outputs '("out" "doc" "cargo")) |
7311ed3f DM |
478 | ;; Since rust-1.19 is local, it's quite probable that Hydra |
479 | ;; will build rust-1.19 only as a dependency of rust-1.20. | |
480 | ;; But then Hydra will use the wrong properties, the ones here, | |
481 | ;; for rust-1.19. Therefore, we copied the properties of | |
482 | ;; rust-1.19 here. | |
483 | (properties '((timeout . 72000) ;20 hours | |
484 | (max-silent-time . 18000))) ;5 hours (for armel) | |
614cfd5c DM |
485 | (arguments |
486 | (substitute-keyword-arguments (package-arguments rust-1.19) | |
487 | ((#:phases phases) | |
488 | `(modify-phases ,phases | |
1bfaae25 DM |
489 | (add-after 'patch-tests 'patch-cargo-tests |
490 | (lambda _ | |
491 | (substitute* "src/tools/cargo/tests/build.rs" | |
492 | (("/usr/bin/env") (which "env")) | |
493 | ;; Guix llvm is compiled without asmjs-unknown-emscripten. | |
494 | (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs")) | |
495 | (substitute* "src/tools/cargo/tests/death.rs" | |
496 | ;; This is stuck when built in container. | |
497 | (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone")) | |
498 | ;; Prints test output in the wrong order when built on | |
499 | ;; i686-linux. | |
500 | (substitute* "src/tools/cargo/tests/test.rs" | |
501 | (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env")) | |
01cef16f MB |
502 | |
503 | ;; These tests pull in a dependency on "git", which changes | |
504 | ;; too frequently take part in the Rust toolchain. | |
505 | (substitute* "src/tools/cargo/tests/new.rs" | |
506 | (("fn author_prefers_cargo") "#[ignore]\nfn author_prefers_cargo") | |
507 | (("fn finds_author_git") "#[ignore]\nfn finds_author_git") | |
508 | (("fn finds_local_author_git") "#[ignore]\nfn finds_local_author_git")) | |
1bfaae25 DM |
509 | #t)) |
510 | (add-after 'patch-cargo-tests 'ignore-glibc-2.27-incompatible-test | |
511 | ;; https://github.com/rust-lang/rust/issues/47863 | |
512 | (lambda _ | |
513 | (substitute* "src/test/run-pass/out-of-stack.rs" | |
514 | (("// ignore-android") "// ignore-test\n// ignore-android")) | |
515 | #t)) | |
614cfd5c DM |
516 | (replace 'configure |
517 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
518 | (let* ((out (assoc-ref outputs "out")) | |
519 | (doc (assoc-ref outputs "doc")) | |
520 | (gcc (assoc-ref inputs "gcc")) | |
521 | (gdb (assoc-ref inputs "gdb")) | |
522 | (binutils (assoc-ref inputs "binutils")) | |
523 | (python (assoc-ref inputs "python-2")) | |
524 | (rustc (assoc-ref inputs "rustc-bootstrap")) | |
525 | (cargo (assoc-ref inputs "cargo-bootstrap")) | |
526 | (llvm (assoc-ref inputs "llvm")) | |
527 | (jemalloc (assoc-ref inputs "jemalloc"))) | |
528 | (call-with-output-file "config.toml" | |
529 | (lambda (port) | |
530 | (display (string-append " | |
531 | [llvm] | |
532 | [build] | |
533 | cargo = \"" cargo "/bin/cargo" "\" | |
534 | rustc = \"" rustc "/bin/rustc" "\" | |
535 | docs = true | |
536 | python = \"" python "/bin/python2" "\" | |
537 | gdb = \"" gdb "/bin/gdb" "\" | |
538 | vendor = true | |
539 | submodules = false | |
540 | [install] | |
541 | prefix = \"" out "\" | |
542 | docdir = \"" doc "/share/doc/rust" "\" | |
543 | sysconfdir = \"etc\" | |
614cfd5c DM |
544 | [rust] |
545 | default-linker = \"" gcc "/bin/gcc" "\" | |
614cfd5c DM |
546 | channel = \"stable\" |
547 | rpath = true | |
548 | " ;; There are 2 failed codegen tests: | |
549 | ;; codegen/mainsubprogram.rs and codegen/mainsubprogramstart.rs | |
550 | ;; These tests require a patched LLVM | |
551 | "codegen-tests = false | |
552 | [target." ,(nix-system->gnu-triplet-for-rust) "] | |
553 | llvm-config = \"" llvm "/bin/llvm-config" "\" | |
554 | cc = \"" gcc "/bin/gcc" "\" | |
555 | cxx = \"" gcc "/bin/g++" "\" | |
91294b53 | 556 | ar = \"" binutils "/bin/ar" "\" |
614cfd5c DM |
557 | jemalloc = \"" jemalloc "/lib/libjemalloc_pic.a" "\" |
558 | [dist] | |
559 | ") port))) | |
560 | #t))) | |
561 | (add-after 'configure 'provide-cc | |
562 | (lambda* (#:key inputs #:allow-other-keys) | |
563 | (symlink (string-append (assoc-ref inputs "gcc") "/bin/gcc") | |
564 | "/tmp/cc") | |
565 | (setenv "PATH" (string-append "/tmp:" (getenv "PATH"))) | |
566 | #t)) | |
567 | (add-after 'provide-cc 'configure-archiver | |
568 | (lambda* (#:key inputs #:allow-other-keys) | |
569 | (substitute* "src/build_helper/lib.rs" | |
570 | ;; Make sure "ar" is always used as the archiver. | |
571 | (("\"musl\"") "\"\"") | |
572 | ;; Then substitute "ar" by our name. | |
573 | (("\"ar\"") (string-append "\"" | |
574 | (assoc-ref inputs "binutils") | |
575 | "/bin/ar\""))) | |
576 | #t)) | |
577 | (delete 'patch-cargo-tomls) | |
578 | (add-before 'build 'reset-timestamps-after-changes | |
579 | (lambda* _ | |
614cfd5c DM |
580 | (for-each |
581 | (lambda (filename) | |
e0b07ccc DM |
582 | ;; Rust 1.20.0 treats timestamp 0 as "file doesn't exist". |
583 | ;; Therefore, use timestamp 1. | |
584 | (utime filename 1 1 1 1)) | |
614cfd5c DM |
585 | (find-files "." #:directories? #t)) |
586 | #t)) | |
587 | (replace 'build | |
588 | (lambda* _ | |
589 | (invoke "./x.py" "build") | |
590 | (invoke "./x.py" "build" "src/tools/cargo"))) | |
591 | (replace 'check | |
592 | (lambda* _ | |
593 | ;; Disable parallel execution to prevent EAGAIN errors when | |
594 | ;; running tests. | |
595 | (invoke "./x.py" "-j1" "test" "-vv") | |
596 | (invoke "./x.py" "-j1" "test" "src/tools/cargo") | |
597 | #t)) | |
598 | (replace 'install | |
599 | (lambda* (#:key outputs #:allow-other-keys) | |
600 | (invoke "./x.py" "install") | |
601 | (substitute* "config.toml" | |
602 | ;; replace prefix to specific output | |
603 | (("prefix = \"[^\"]*\"") | |
604 | (string-append "prefix = \"" (assoc-ref outputs "cargo") "\""))) | |
605 | (invoke "./x.py" "install" "cargo"))) | |
bea01c0d IP |
606 | (add-after 'install 'delete-install-logs |
607 | (lambda* (#:key outputs #:allow-other-keys) | |
608 | (define (delete-manifest-file out-path file) | |
609 | (delete-file (string-append out-path "/lib/rustlib/" file))) | |
610 | ||
611 | (let ((out (assoc-ref outputs "out")) | |
612 | (cargo-out (assoc-ref outputs "cargo"))) | |
613 | (for-each | |
614 | (lambda (file) (delete-manifest-file out file)) | |
615 | '("install.log" | |
616 | "manifest-rust-docs" | |
617 | "manifest-rust-std-x86_64-unknown-linux-gnu" | |
618 | "manifest-rustc")) | |
619 | (for-each | |
620 | (lambda (file) (delete-manifest-file cargo-out file)) | |
621 | '("install.log" | |
622 | "manifest-cargo")) | |
623 | #t))) | |
614cfd5c DM |
624 | (add-after 'install 'wrap-rustc |
625 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
626 | (let ((out (assoc-ref outputs "out")) | |
627 | (libc (assoc-ref inputs "libc")) | |
628 | (ld-wrapper (assoc-ref inputs "ld-wrapper"))) | |
629 | ;; Let gcc find ld and libc startup files. | |
630 | (wrap-program (string-append out "/bin/rustc") | |
631 | `("PATH" ":" prefix (,(string-append ld-wrapper "/bin"))) | |
632 | `("LIBRARY_PATH" ":" suffix (,(string-append libc "/lib")))) | |
633 | #t)))))))))) | |
634 | ||
05ebff92 | 635 | (define-public rust-1.21 |
4ed20d3c | 636 | (let ((base-rust (rust-bootstrapped-package rust-1.20 "1.21.0" |
7bf169f7 DM |
637 | "1yj8lnxybjrybp00fqhxw8fpr641dh8wcn9mk44xjnsb4i1c21qp"))) |
638 | (package | |
639 | (inherit base-rust) | |
640 | (arguments | |
641 | (substitute-keyword-arguments (package-arguments base-rust) | |
642 | ((#:phases phases) | |
643 | `(modify-phases ,phases | |
644 | (add-after 'configure 'remove-ar | |
645 | (lambda* (#:key inputs #:allow-other-keys) | |
646 | ;; Remove because toml complains about "unknown field". | |
647 | (substitute* "config.toml" | |
648 | (("^ar =.*") "\n")) | |
649 | #t))))))))) | |
05ebff92 | 650 | |
1ab3e1dd | 651 | (define-public rust-1.22 |
4ed20d3c | 652 | (let ((base-rust (rust-bootstrapped-package rust-1.21 "1.22.1" |
8cddb0d6 DM |
653 | "1lrzzp0nh7s61wgfs2h6ilaqi6iq89f1pd1yaf65l87bssyl4ylb"))) |
654 | (package | |
655 | (inherit base-rust) | |
656 | (arguments | |
657 | (substitute-keyword-arguments (package-arguments base-rust) | |
658 | ((#:phases phases) | |
659 | `(modify-phases ,phases | |
660 | (add-after 'unpack 'remove-flaky-test | |
661 | (lambda _ | |
662 | ;; See <https://github.com/rust-lang/rust/issues/43402>. | |
663 | (when (file-exists? "src/test/run-make/issue-26092") | |
664 | (delete-file-recursively "src/test/run-make/issue-26092")) | |
665 | #t))))))))) | |
1ab3e1dd | 666 | |
8fdde581 | 667 | (define-public rust-1.23 |
4ed20d3c | 668 | (let ((base-rust (rust-bootstrapped-package rust-1.22 "1.23.0" |
44d530ef DM |
669 | "14fb8vhjzsxlbi6yrn1r6fl5dlbdd1m92dn5zj5gmzfwf4w9ar3l"))) |
670 | (package | |
671 | (inherit base-rust) | |
672 | (arguments | |
673 | (substitute-keyword-arguments (package-arguments base-rust) | |
674 | ((#:phases phases) | |
675 | `(modify-phases ,phases | |
676 | (delete 'configure-archiver) | |
677 | (delete 'remove-ar) | |
678 | (add-after 'unpack 'dont-build-native | |
679 | (lambda _ | |
680 | ;; XXX: Revisit this when we use gcc 6. | |
681 | (substitute* "src/binaryen/CMakeLists.txt" | |
682 | (("ADD_COMPILE_FLAG\\(\\\"-march=native\\\"\\)") "")) | |
683 | #t))))))))) | |
b5a09649 | 684 | |
fe61c88a | 685 | (define-public rust-1.24 |
ca523cc5 | 686 | (let ((base-rust |
4ed20d3c | 687 | (rust-bootstrapped-package rust-1.23 "1.24.1" |
339c1365 | 688 | "1vv10x2h9kq7fxh2v01damdq8pvlp5acyh1kzcda9sfjx12kv99y"))) |
f342bb58 NM |
689 | (package |
690 | (inherit base-rust) | |
f342bb58 NM |
691 | (arguments |
692 | (substitute-keyword-arguments (package-arguments base-rust) | |
ca523cc5 DM |
693 | ((#:phases phases) |
694 | `(modify-phases ,phases | |
b47b2d32 NM |
695 | (delete 'use-readelf-for-tests) |
696 | (replace 'patch-aarch64-test | |
697 | (lambda* _ | |
698 | (substitute* "src/librustc_metadata/dynamic_lib.rs" | |
699 | ;; This test is known to fail on aarch64 and powerpc64le: | |
700 | ;; https://github.com/rust-lang/rust/issues/45410 | |
701 | (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) | |
e0b07ccc | 702 | #t))))))))) |
fe61c88a | 703 | |
e027a494 NM |
704 | ;;; Rust 1.25 release support work with llvm 6--but build with llvm 6 is |
705 | ;;; not determenistic due to <https://github.com/rust-lang/rust/issues/50556>. | |
706 | ;;; Keep using llvm 3.9.1 until builds become determenistic | |
b47b2d32 NM |
707 | (define-public rust-1.25 |
708 | (let ((base-rust | |
4ed20d3c IP |
709 | (rust-bootstrapped-package rust-1.24 "1.25.0" |
710 | "0baxjr99311lvwdq0s38bipbnj72pn6fgbk6lcq7j555xq53mxpf"))) | |
fe61c88a NM |
711 | (package |
712 | (inherit base-rust) | |
4ed20d3c IP |
713 | (source |
714 | (origin | |
715 | (inherit (package-source base-rust)) | |
716 | (snippet '(begin | |
717 | (delete-file-recursively "src/jemalloc") | |
718 | (delete-file-recursively "src/llvm") | |
719 | (delete-file-recursively "src/llvm-emscripten") | |
720 | #t)) | |
e28a824f JK |
721 | (patches (search-patches |
722 | "rust-1.25-accept-more-detailed-gdb-lines.patch")))) | |
fe61c88a NM |
723 | (arguments |
724 | (substitute-keyword-arguments (package-arguments base-rust) | |
725 | ((#:phases phases) | |
726 | `(modify-phases ,phases | |
727 | (add-after 'patch-cargo-tests 'patch-cargo-index-update | |
080e11b4 | 728 | (lambda _ |
fe61c88a NM |
729 | (substitute* "src/tools/cargo/tests/generate-lockfile.rs" |
730 | ;; This test wants to update the crate index. | |
080e11b4 EF |
731 | (("fn no_index_update") "#[ignore]\nfn no_index_update")) |
732 | #t)) | |
080e11b4 EF |
733 | (replace 'patch-aarch64-test |
734 | (lambda _ | |
735 | (substitute* "src/librustc_metadata/dynamic_lib.rs" | |
736 | ;; This test is known to fail on aarch64 and powerpc64le: | |
737 | ;; https://github.com/rust-lang/rust/issues/45410 | |
738 | (("fn test_loading_cosine") "#[ignore]\nfn test_loading_cosine")) | |
739 | ;; This test fails on aarch64 with llvm@6.0: | |
740 | ;; https://github.com/rust-lang/rust/issues/49807 | |
741 | ;; other possible solution: | |
742 | ;; https://github.com/rust-lang/rust/pull/47688 | |
743 | (delete-file "src/test/debuginfo/by-value-self-argument-in-trait-impl.rs") | |
744 | #t)) | |
b47b2d32 NM |
745 | (delete 'ignore-glibc-2.27-incompatible-test)))))))) |
746 | ||
f510a2b9 | 747 | (define-public rust-1.26 |
b47b2d32 | 748 | (let ((base-rust |
4ed20d3c IP |
749 | (rust-bootstrapped-package rust-1.25 "1.26.2" |
750 | "0047ais0fvmqvngqkdsxgrzhb0kljg8wy85b01kbbjc88hqcz7pv"))) | |
b47b2d32 NM |
751 | (package |
752 | (inherit base-rust) | |
4ed20d3c IP |
753 | (source |
754 | (origin | |
755 | (inherit (package-source base-rust)) | |
e28a824f JK |
756 | (patches (search-patches |
757 | "rust-coresimd-doctest.patch" | |
758 | "rust-1.25-accept-more-detailed-gdb-lines.patch")))) | |
b47b2d32 NM |
759 | (arguments |
760 | (substitute-keyword-arguments (package-arguments base-rust) | |
761 | ((#:phases phases) | |
762 | `(modify-phases ,phases | |
763 | ;; binaryen was replaced with LLD project from LLVM | |
764 | (delete 'dont-build-native) | |
55548cdc DM |
765 | (replace 'check |
766 | (lambda* _ | |
767 | ;; Enable parallel execution. | |
768 | (let ((parallel-job-spec | |
769 | (string-append "-j" (number->string | |
770 | (min 4 | |
771 | (parallel-job-count)))))) | |
772 | (invoke "./x.py" parallel-job-spec "test" "-vv") | |
773 | (invoke "./x.py" parallel-job-spec "test" | |
774 | "src/tools/cargo")))) | |
b47b2d32 NM |
775 | (replace 'remove-unsupported-tests |
776 | (lambda* _ | |
777 | ;; Our ld-wrapper cannot process non-UTF8 bytes in LIBRARY_PATH. | |
778 | ;; <https://lists.gnu.org/archive/html/guix-devel/2017-06/msg00193.html> | |
779 | (delete-file-recursively "src/test/run-make-fulldeps/linker-output-non-utf8") | |
780 | #t)) | |
781 | (replace 'patch-cargo-tests | |
782 | (lambda* _ | |
783 | (substitute* "src/tools/cargo/tests/testsuite/build.rs" | |
784 | (("/usr/bin/env") (which "env")) | |
785 | ;; Guix llvm is compiled without asmjs-unknown-emscripten. | |
786 | (("fn wasm32_final_outputs") "#[ignore]\nfn wasm32_final_outputs")) | |
787 | (substitute* "src/tools/cargo/tests/testsuite/death.rs" | |
788 | ;; This is stuck when built in container. | |
789 | (("fn ctrl_c_kills_everyone") "#[ignore]\nfn ctrl_c_kills_everyone")) | |
790 | ;; Prints test output in the wrong order when built on | |
791 | ;; i686-linux. | |
792 | (substitute* "src/tools/cargo/tests/testsuite/test.rs" | |
793 | (("fn cargo_test_env") "#[ignore]\nfn cargo_test_env")) | |
01cef16f MB |
794 | |
795 | ;; Avoid dependency on "git". | |
796 | (substitute* "src/tools/cargo/tests/testsuite/new.rs" | |
797 | (("fn author_prefers_cargo") "#[ignore]\nfn author_prefers_cargo") | |
798 | (("fn finds_author_git") "#[ignore]\nfn finds_author_git") | |
799 | (("fn finds_local_author_git") "#[ignore]\nfn finds_local_author_git")) | |
b47b2d32 | 800 | #t)) |
7befec25 | 801 | ;; TODO(rebuild-rust): Remove this phase in rust-1.28 when rebuilding. |
b47b2d32 NM |
802 | (add-after 'patch-cargo-tests 'disable-cargo-test-for-nightly-channel |
803 | (lambda* _ | |
804 | ;; This test failed to work on "nightly" channel builds | |
805 | ;; https://github.com/rust-lang/cargo/issues/5648 | |
806 | (substitute* "src/tools/cargo/tests/testsuite/resolve.rs" | |
807 | (("fn test_resolving_minimum_version_with_transitive_deps") | |
808 | "#[ignore]\nfn test_resolving_minimum_version_with_transitive_deps")) | |
809 | #t)) | |
810 | (replace 'patch-cargo-index-update | |
811 | (lambda* _ | |
812 | (substitute* "src/tools/cargo/tests/testsuite/generate_lockfile.rs" | |
813 | ;; This test wants to update the crate index. | |
814 | (("fn no_index_update") "#[ignore]\nfn no_index_update")) | |
815 | #t))))))))) | |
f510a2b9 | 816 | |
2e2b8635 | 817 | (define-public rust-1.27 |
f510a2b9 | 818 | (let ((base-rust |
4ed20d3c IP |
819 | (rust-bootstrapped-package rust-1.26 "1.27.2" |
820 | "0pg1s37bhx9zqbynxyydq5j6q7kij9vxkcv8maz0m25prm88r0cs"))) | |
f510a2b9 NM |
821 | (package |
822 | (inherit base-rust) | |
4ed20d3c IP |
823 | (source |
824 | (origin | |
825 | (inherit (package-source base-rust)) | |
e28a824f JK |
826 | (patches (search-patches "rust-coresimd-doctest.patch" |
827 | "rust-bootstrap-stage0-test.patch" | |
828 | "rust-1.25-accept-more-detailed-gdb-lines.patch" | |
829 | "rust-reproducible-builds.patch")))) | |
47dda6e0 | 830 | (native-inputs |
133be097 MB |
831 | ;; FIXME: Rust 1.27 and some later versions require GDB 8.2 specifically. |
832 | ;; See <https://bugs.gnu.org/37810>. | |
47dda6e0 MB |
833 | (alist-replace "gdb" (list gdb-8.2) |
834 | (package-native-inputs base-rust))) | |
f510a2b9 NM |
835 | (arguments |
836 | (substitute-keyword-arguments (package-arguments base-rust) | |
837 | ((#:phases phases) | |
838 | `(modify-phases ,phases | |
839 | (add-before 'install 'mkdir-prefix-paths | |
840 | (lambda* (#:key outputs #:allow-other-keys) | |
841 | ;; As result of https://github.com/rust-lang/rust/issues/36989 | |
842 | ;; `prefix' directory should exist before `install' call | |
843 | (mkdir-p (assoc-ref outputs "out")) | |
844 | (mkdir-p (assoc-ref outputs "cargo")) | |
e027a494 NM |
845 | #t)) |
846 | (add-after 'patch-cargo-tests 'disable-thinlto-test | |
847 | (lambda* _ | |
848 | ;; thinlto required llvm 6.0 for work | |
849 | (substitute* "src/tools/cargo/tests/testsuite/path.rs" | |
850 | (("fn thin_lto_works") "#[ignore]\nfn thin_lto_works")) | |
f510a2b9 | 851 | #t))))))))) |
2e2b8635 | 852 | |
0e9811f4 | 853 | (define-public rust-1.28 |
2e2b8635 | 854 | (let ((base-rust |
4ed20d3c IP |
855 | (rust-bootstrapped-package rust-1.27 "1.28.0" |
856 | "11k4rn77bca2rikykkk9fmprrgjswd4x4kaq7fia08vgkir82nhx"))) | |
2e2b8635 NM |
857 | (package |
858 | (inherit base-rust) | |
4ed20d3c IP |
859 | (source |
860 | (origin | |
861 | (inherit (package-source base-rust)) | |
e28a824f JK |
862 | (patches (search-patches "rust-coresimd-doctest.patch" |
863 | "rust-bootstrap-stage0-test.patch" | |
864 | "rust-1.25-accept-more-detailed-gdb-lines.patch" | |
865 | "rust-reproducible-builds.patch")))) | |
2e2b8635 NM |
866 | (inputs |
867 | ;; Use LLVM 6.0 | |
de6ad8c2 | 868 | (alist-replace "llvm" (list llvm-6) |
2e2b8635 NM |
869 | (package-inputs base-rust))) |
870 | (arguments | |
871 | (substitute-keyword-arguments (package-arguments base-rust) | |
872 | ((#:phases phases) | |
873 | `(modify-phases ,phases | |
874 | (add-after 'configure 'enable-codegen-tests | |
875 | ;; Codegen tests should pass with llvm 6, so enable them. | |
876 | (lambda* _ | |
877 | (substitute* "config.toml" | |
878 | (("codegen-tests = false") "")) | |
879 | #t)) | |
880 | (add-after 'patch-tests 'disable-amd64-avx-test | |
881 | ;; That test would fail on x86_64 machines without avx. | |
882 | (lambda* _ | |
883 | (substitute* "src/test/run-pass/issue-44056.rs" | |
884 | (("only-x86_64") "ignore-test")) | |
885 | #t)) | |
886 | ;; The thinlto test should pass with llvm 6. | |
887 | (delete 'disable-thinlto-test)))))))) | |
0e9811f4 | 888 | |
1a3db0b2 | 889 | (define-public rust-1.29 |
0e9811f4 | 890 | (let ((base-rust |
4ed20d3c IP |
891 | (rust-bootstrapped-package rust-1.28 "1.29.2" |
892 | "1jb787080z754caa2w3w1amsygs4qlzj9rs1vy64firfmabfg22h"))) | |
0e9811f4 | 893 | (package |
4ed20d3c IP |
894 | (inherit base-rust) |
895 | (source | |
896 | (origin | |
897 | (inherit (package-source base-rust)) | |
e28a824f JK |
898 | (patches (search-patches "rust-1.25-accept-more-detailed-gdb-lines.patch" |
899 | "rust-reproducible-builds.patch"))))))) | |
1a3db0b2 IP |
900 | |
901 | (define-public rust-1.30 | |
902 | (let ((base-rust | |
4ed20d3c IP |
903 | (rust-bootstrapped-package rust-1.29 "1.30.1" |
904 | "0aavdc1lqv0cjzbqwl5n59yd0bqdlhn0zas61ljf38yrvc18k8rn"))) | |
1a3db0b2 IP |
905 | (package |
906 | (inherit base-rust) | |
4ed20d3c IP |
907 | (source |
908 | (origin | |
909 | (inherit (package-source base-rust)) | |
910 | (snippet '(begin | |
911 | (delete-file-recursively "src/jemalloc") | |
912 | (delete-file-recursively "src/llvm") | |
913 | (delete-file-recursively "src/llvm-emscripten") | |
914 | (delete-file-recursively "src/tools/clang") | |
915 | (delete-file-recursively "src/tools/lldb") | |
f309420b | 916 | #t)))) |
1a3db0b2 IP |
917 | (arguments |
918 | (substitute-keyword-arguments (package-arguments base-rust) | |
919 | ((#:phases phases) | |
920 | `(modify-phases ,phases | |
921 | (add-after 'patch-cargo-tests 'patch-cargo-env-shebang | |
922 | (lambda* (#:key inputs #:allow-other-keys) | |
923 | (let ((coreutils (assoc-ref inputs "coreutils"))) | |
924 | (substitute* "src/tools/cargo/tests/testsuite/fix.rs" | |
925 | ;; Cargo has a test which explicitly sets a | |
926 | ;; RUSTC_WRAPPER environment variable which points | |
927 | ;; to /usr/bin/env. Since it's not a shebang, it | |
928 | ;; needs to be manually patched | |
929 | (("\"/usr/bin/env\"") | |
930 | (string-append "\"" coreutils "/bin/env\""))) | |
931 | #t))) | |
932 | (add-after 'patch-cargo-env-shebang 'ignore-cargo-package-tests | |
933 | (lambda* _ | |
934 | (substitute* "src/tools/cargo/tests/testsuite/package.rs" | |
935 | ;; These tests largely check that cargo outputs warning/error | |
936 | ;; messages as expected. It seems that cargo outputs an | |
937 | ;; absolute path to something in the store instead of the | |
938 | ;; expected relative path (e.g. `[..]`) so we'll ignore | |
939 | ;; these for now | |
940 | (("fn include") "#[ignore]\nfn include") | |
941 | (("fn exclude") "#[ignore]\nfn exclude")) | |
942 | #t)) | |
586d30ca DM |
943 | ;; The test has been moved elsewhere. |
944 | (replace 'disable-amd64-avx-test | |
945 | (lambda _ | |
946 | (substitute* "src/test/ui/run-pass/issues/issue-44056.rs" | |
444bc2dd | 947 | (("only-x86_64") "ignore-test")) |
586d30ca | 948 | #t))))))))) |
1a3db0b2 | 949 | |
444bc2dd JK |
950 | (define (patch-command-exec-tests-phase test-path) |
951 | "The command-exec.rs test moves around between releases. We need to apply | |
952 | a Guix-specific patch to it for each release. This function generates the phase | |
953 | that applies said patch, parametrized by the test-path. This is done this way | |
954 | because the phase is more complex than the equivalents for other tests that | |
955 | move around." | |
956 | `(lambda* (#:key inputs #:allow-other-keys) | |
957 | (let ((coreutils (assoc-ref inputs "coreutils"))) | |
958 | (substitute* ,test-path | |
959 | ;; This test suite includes some tests that the stdlib's | |
960 | ;; `Command` execution properly handles situations where | |
961 | ;; the environment or PATH variable are empty, but this | |
962 | ;; fails since we don't have `echo` available in the usual | |
963 | ;; Linux directories. | |
964 | ;; NB: the leading space is so we don't fail a tidy check | |
965 | ;; for trailing whitespace, and the newlines are to ensure | |
966 | ;; we don't exceed the 100 chars tidy check as well | |
967 | ((" Command::new\\(\"echo\"\\)") | |
968 | (string-append "\nCommand::new(\"" coreutils "/bin/echo\")\n"))) | |
969 | #t))) | |
970 | ||
d7d3bdca | 971 | (define-public rust-1.31 |
1a3db0b2 | 972 | (let ((base-rust |
4ed20d3c IP |
973 | (rust-bootstrapped-package rust-1.30 "1.31.1" |
974 | "0sk84ff0cklybcp0jbbxcw7lk7mrm6kb6km5nzd6m64dy0igrlli"))) | |
1a3db0b2 IP |
975 | (package |
976 | (inherit base-rust) | |
977 | (arguments | |
978 | (substitute-keyword-arguments (package-arguments base-rust) | |
979 | ((#:phases phases) | |
980 | `(modify-phases ,phases | |
981 | (add-after 'patch-tests 'patch-command-exec-tests | |
444bc2dd JK |
982 | ,(patch-command-exec-tests-phase |
983 | "src/test/run-pass/command-exec.rs")) | |
984 | ;; The test has been moved elsewhere. | |
985 | (replace 'disable-amd64-avx-test | |
986 | (lambda _ | |
987 | (substitute* "src/test/ui/issues/issue-44056.rs" | |
988 | (("only-x86_64") "ignore-test")) | |
989 | #t)) | |
1a3db0b2 IP |
990 | (add-after 'patch-tests 'patch-process-docs-rev-cmd |
991 | (lambda* _ | |
992 | ;; Disable some doc tests which depend on the "rev" command | |
993 | ;; https://github.com/rust-lang/rust/pull/58746 | |
994 | (substitute* "src/libstd/process.rs" | |
995 | (("```rust") "```rust,no_run")) | |
996 | #t))))))))) | |
d7d3bdca | 997 | |
6d511a53 | 998 | (define-public rust-1.32 |
d7d3bdca IP |
999 | (let ((base-rust |
1000 | (rust-bootstrapped-package rust-1.31 "1.32.0" | |
4ed20d3c | 1001 | "0ji2l9xv53y27xy72qagggvq47gayr5lcv2jwvmfirx029vlqnac"))) |
d7d3bdca IP |
1002 | (package |
1003 | (inherit base-rust) | |
4ed20d3c IP |
1004 | (source |
1005 | (origin | |
1006 | (inherit (package-source base-rust)) | |
1007 | (snippet '(begin (delete-file-recursively "src/llvm") | |
1008 | (delete-file-recursively "src/llvm-emscripten") | |
1009 | (delete-file-recursively "src/tools/clang") | |
1010 | (delete-file-recursively "src/tools/lldb") | |
1011 | (delete-file-recursively "vendor/jemalloc-sys/jemalloc") | |
1012 | #t)) | |
e28a824f | 1013 | (patches (search-patches "rust-reproducible-builds.patch")) |
4ed20d3c IP |
1014 | ;; the vendor directory has moved to the root of |
1015 | ;; the tarball, so we have to strip an extra prefix | |
1016 | (patch-flags '("-p2")))) | |
d7d3bdca IP |
1017 | (inputs |
1018 | ;; Downgrade to LLVM 6, all LTO tests appear to fail with LLVM 7.0.1 | |
1019 | (alist-replace "llvm" (list llvm-6) | |
1020 | (package-inputs base-rust))) | |
1021 | (arguments | |
1022 | (substitute-keyword-arguments (package-arguments base-rust) | |
1023 | ((#:phases phases) | |
1024 | `(modify-phases ,phases | |
1025 | ;; Cargo.lock and the vendor/ directory have been moved to the | |
1026 | ;; root of the rust tarball | |
1027 | (replace 'patch-cargo-checksums | |
1028 | (lambda* _ | |
4585859f | 1029 | (use-modules (guix build cargo-utils)) |
d7d3bdca IP |
1030 | (substitute* "Cargo.lock" |
1031 | (("(\"checksum .* = )\".*\"" all name) | |
1032 | (string-append name "\"" ,%cargo-reference-hash "\""))) | |
e07b0488 | 1033 | (generate-all-checksums "vendor") |
d7d3bdca IP |
1034 | #t)) |
1035 | (add-after 'enable-codegen-tests 'override-jemalloc | |
1036 | (lambda* (#:key inputs #:allow-other-keys) | |
1037 | ;; The compiler is no longer directly built against jemalloc, | |
1038 | ;; but rather via the jemalloc-sys crate (which vendors the | |
1039 | ;; jemalloc source). To use jemalloc we must enable linking to | |
1040 | ;; it (otherwise it would use the system allocator), and set | |
1041 | ;; an environment variable pointing to the compiled jemalloc. | |
1042 | (substitute* "config.toml" | |
1043 | (("^jemalloc =.*$") "") | |
1044 | (("[[]rust[]]") "\n[rust]\njemalloc=true\n")) | |
1045 | (setenv "JEMALLOC_OVERRIDE" (string-append (assoc-ref inputs "jemalloc") | |
1046 | "/lib/libjemalloc_pic.a")) | |
1047 | #t)) | |
1048 | ;; Remove no longer relevant steps | |
1049 | (delete 'remove-flaky-test) | |
1050 | (delete 'patch-aarch64-test)))))))) | |
6d511a53 IP |
1051 | |
1052 | (define-public rust-1.33 | |
1053 | (let ((base-rust | |
1054 | (rust-bootstrapped-package rust-1.32 "1.33.0" | |
4ed20d3c | 1055 | "152x91mg7bz4ygligwjb05fgm1blwy2i70s2j03zc9jiwvbsh0as"))) |
6d511a53 IP |
1056 | (package |
1057 | (inherit base-rust) | |
4ed20d3c IP |
1058 | (source |
1059 | (origin | |
1060 | (inherit (package-source base-rust)) | |
1061 | (patches '()) | |
1062 | (patch-flags '("-p1")))) | |
6d511a53 IP |
1063 | (inputs |
1064 | ;; Upgrade to jemalloc@5.1.0 | |
1065 | (alist-replace "jemalloc" (list jemalloc) | |
1066 | (package-inputs base-rust))) | |
1067 | (arguments | |
1068 | (substitute-keyword-arguments (package-arguments base-rust) | |
1069 | ((#:phases phases) | |
1070 | `(modify-phases ,phases | |
1071 | (delete 'ignore-cargo-package-tests) | |
1072 | (add-after 'configure 'configure-test-threads | |
1073 | ;; Several rustc and cargo tests will fail if run on one core | |
1074 | ;; https://github.com/rust-lang/rust/issues/59122 | |
1075 | ;; https://github.com/rust-lang/cargo/issues/6746 | |
1076 | ;; https://github.com/rust-lang/rust/issues/58907 | |
1077 | (lambda* (#:key inputs #:allow-other-keys) | |
1078 | (setenv "RUST_TEST_THREADS" "2") | |
1079 | #t))))))))) | |
1080 | ||
0ab5e91e | 1081 | (define-public rust-1.34 |
a5c72da4 | 1082 | (let ((base-rust |
3d8033af IP |
1083 | (rust-bootstrapped-package rust-1.33 "1.34.1" |
1084 | "19s09k7y5j6g3y4d2rk6kg9pvq6ml94c49w6b72dmq8p9lk8bixh"))) | |
a5c72da4 IP |
1085 | (package |
1086 | (inherit base-rust) | |
1087 | (source | |
1088 | (origin | |
1089 | (inherit (package-source base-rust)) | |
1090 | (snippet '(begin | |
1091 | (delete-file-recursively "src/llvm-emscripten") | |
1092 | (delete-file-recursively "src/llvm-project") | |
1093 | (delete-file-recursively "vendor/jemalloc-sys/jemalloc") | |
1094 | #t))))))) | |
0ab5e91e | 1095 | |
f67f93b6 | 1096 | (define-public rust-1.35 |
0ab5e91e IP |
1097 | (let ((base-rust |
1098 | (rust-bootstrapped-package rust-1.34 "1.35.0" | |
1099 | "0bbizy6b7002v1rdhrxrf5gijclbyizdhkglhp81ib3bf5x66kas"))) | |
1100 | (package | |
1101 | (inherit base-rust) | |
f5de2b9a IP |
1102 | (inputs |
1103 | (alist-replace "llvm" (list llvm-8) | |
1104 | (package-inputs base-rust))) | |
0ab5e91e IP |
1105 | (arguments |
1106 | (substitute-keyword-arguments (package-arguments base-rust) | |
1107 | ((#:phases phases) | |
1108 | `(modify-phases ,phases | |
1109 | ;; The tidy test includes a pass which ensures large binaries | |
1110 | ;; don't accidentally get checked into the rust git repo. | |
1111 | ;; Unfortunately the test assumes that git is always available, | |
1112 | ;; so we'll comment out the invocation of this pass. | |
1113 | (add-after 'configure 'disable-tidy-bins-check | |
1114 | (lambda* _ | |
1115 | (substitute* "src/tools/tidy/src/main.rs" | |
1116 | (("bins::check") "//bins::check")) | |
1117 | #t))))))))) | |
f67f93b6 | 1118 | |
02c61278 | 1119 | (define-public rust-1.36 |
f67f93b6 IP |
1120 | (let ((base-rust |
1121 | (rust-bootstrapped-package rust-1.35 "1.36.0" | |
ca31f76b | 1122 | "06xv2p6zq03lidr0yaf029ii8wnjjqa894nkmrm6s0rx47by9i04"))) |
f67f93b6 IP |
1123 | (package |
1124 | (inherit base-rust) | |
1125 | (arguments | |
1126 | (substitute-keyword-arguments (package-arguments base-rust) | |
1127 | ((#:phases phases) | |
1128 | `(modify-phases ,phases | |
1129 | (delete 'patch-process-docs-rev-cmd)))))))) | |
02c61278 | 1130 | |
444bc2dd | 1131 | (define-public rust-1.37 |
02c61278 IP |
1132 | (let ((base-rust |
1133 | (rust-bootstrapped-package rust-1.36 "1.37.0" | |
1134 | "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj"))) | |
1135 | (package | |
1136 | (inherit base-rust) | |
1137 | (arguments | |
1138 | (substitute-keyword-arguments (package-arguments base-rust) | |
1139 | ((#:phases phases) | |
1140 | `(modify-phases ,phases | |
1141 | (add-before 'configure 'configure-cargo-home | |
1142 | (lambda _ | |
1143 | (let ((cargo-home (string-append (getcwd) "/.cargo"))) | |
1144 | (mkdir-p cargo-home) | |
1145 | (setenv "CARGO_HOME" cargo-home) | |
1146 | #t)))))))))) | |
444bc2dd | 1147 | |
7befec25 | 1148 | ;; TODO(rebuild-rust): Switch to LLVM 9 in 1.38 instead of 1.40. |
444bc2dd JK |
1149 | (define-public rust-1.38 |
1150 | (let ((base-rust | |
1151 | (rust-bootstrapped-package rust-1.37 "1.38.0" | |
1152 | "101dlpsfkq67p0hbwx4acqq6n90dj4bbprndizpgh1kigk566hk4"))) | |
1153 | (package | |
1154 | (inherit base-rust) | |
7befec25 JK |
1155 | #;(inputs |
1156 | (alist-replace "llvm" (list llvm-9) | |
1157 | (package-inputs base-rust))) | |
444bc2dd JK |
1158 | (arguments |
1159 | (substitute-keyword-arguments (package-arguments base-rust) | |
1160 | ((#:phases phases) | |
1161 | `(modify-phases ,phases | |
1162 | (replace 'patch-command-exec-tests | |
1163 | ,(patch-command-exec-tests-phase | |
1164 | "src/test/ui/command-exec.rs")) | |
1165 | (add-after 'patch-tests 'patch-command-uid-gid-test | |
1166 | (lambda _ | |
1167 | (substitute* "src/test/ui/command-uid-gid.rs" | |
1168 | (("/bin/sh") (which "sh")) | |
1169 | (("ignore-sgx") "ignore-sgx\n// ignore-tidy-linelength")) | |
1170 | #t))))))))) | |
1171 | ||
9483782a JK |
1172 | (define-public rust-1.39 |
1173 | (let ((base-rust | |
1174 | (rust-bootstrapped-package rust-1.38 "1.39.0" | |
1175 | "0mwkc1bnil2cfyf6nglpvbn2y0zfbv44zfhsd5qg4c9rm6vgd8dl"))) | |
1176 | (package | |
1177 | (inherit base-rust) | |
1178 | (arguments | |
1179 | (substitute-keyword-arguments (package-arguments base-rust) | |
1180 | ((#:phases phases) | |
1181 | `(modify-phases ,phases | |
1182 | (replace 'patch-cargo-checksums | |
1183 | ;; The Cargo.lock format changed. | |
1184 | (lambda* _ | |
1185 | (use-modules (guix build cargo-utils)) | |
1186 | (substitute* "Cargo.lock" | |
1187 | (("(checksum = )\".*\"" all name) | |
1188 | (string-append name "\"" ,%cargo-reference-hash "\""))) | |
1189 | (generate-all-checksums "vendor") | |
1190 | #t))))))))) | |
1191 | ||
7befec25 JK |
1192 | (define-public rust-1.40 |
1193 | (let ((base-rust | |
1194 | (rust-bootstrapped-package rust-1.39 "1.40.0" | |
1195 | "1ba9llwhqm49w7sz3z0gqscj039m53ky9wxzhaj11z6yg1ah15yx"))) | |
1196 | (package | |
1197 | (inherit base-rust) | |
1198 | (inputs | |
1199 | (alist-replace "llvm" (list llvm-9) | |
1200 | (package-inputs base-rust))) | |
1201 | (source | |
1202 | (origin | |
1203 | (inherit (package-source base-rust)) | |
1204 | ;; llvm-emscripten is no longer bundled, as that codegen backend | |
1205 | ;; got removed. | |
1206 | (snippet '(begin | |
1207 | (delete-file-recursively "src/llvm-project") | |
1208 | (delete-file-recursively "vendor/jemalloc-sys/jemalloc") | |
1209 | #t)))) | |
1210 | (arguments | |
1211 | ;; Rust 1.40 does not ship rustc-internal libraries by default | |
1212 | ;; (see rustc-dev-split). This means that librustc_driver.so is no | |
1213 | ;; longer available in lib/rustlib/$target/lib, which is the directory | |
1214 | ;; included in the runpath of librustc_codegen_llvm-llvm.so. | |
1215 | ;; This is detected by our validate-runpath phase as an error, but it | |
1216 | ;; is harmless as the codegen backend is loaded by librustc_driver.so | |
1217 | ;; itself, which must at that point have been already loaded. | |
1218 | ;; As such, we skip validating the runpath for Rust 1.40. | |
1219 | ;; Rust 1.41 stopped putting the codegen backend in a separate library, | |
1220 | ;; which makes this workaround only necessary for this release. | |
1221 | (cons* #:validate-runpath? #f | |
1222 | (substitute-keyword-arguments (package-arguments base-rust) | |
1223 | ((#:phases phases) | |
1224 | `(modify-phases ,phases | |
1225 | ;; We often need to patch tests with various Guix-specific paths. | |
1226 | ;; This often increases the line length and makes tidy, rustc's | |
1227 | ;; style checker, complain. We could insert additional newlines | |
1228 | ;; or add an "// ignore-tidy-linelength" comment, but as an | |
1229 | ;; ignore comment must be used, both approaches are fragile due | |
1230 | ;; to upstream formatting changes. As such, disable running the | |
1231 | ;; linter during tests, since it's intended for rustc developers | |
1232 | ;; anyway. | |
1233 | ;; | |
1234 | ;; TODO(rebuild-rust): This phase could be added earlier to | |
1235 | ;; simplify a significant amount of code, but it would require | |
1236 | ;; rebuilding the entire rusty universe. | |
1237 | (add-after 'patch-tests 'neuter-tidy | |
1238 | (lambda _ | |
1239 | (substitute* "src/bootstrap/builder.rs" | |
1240 | (("^.*::Tidy,") "")) | |
1241 | #t)) | |
1242 | ;; TODO(rebuild-rust): Adapt the find-files approach for | |
1243 | ;; earlier testsuite patches. | |
1244 | (replace 'patch-command-uid-gid-test | |
1245 | (lambda _ | |
1246 | (match (find-files "src/test" "command-uid-gid\\.rs") | |
1247 | ((file) | |
1248 | (substitute* file | |
1249 | (("/bin/sh") (which "sh"))))) | |
1250 | #t)) | |
1251 | (replace 'patch-command-exec-tests | |
1252 | ,(patch-command-exec-tests-phase | |
1253 | '(match (find-files "src/test" "command-exec\\.rs") | |
1254 | ((file) file)))) | |
1255 | ;; TODO(rebuild-rust): The test in question got fixed long ago. | |
1256 | (delete 'disable-cargo-test-for-nightly-channel) | |
1257 | ;; The test got removed in commit 000fe63b6fc57b09828930cacbab20c2ee6e6d15 | |
1258 | ;; "Remove painful test that is not pulling its weight" | |
1259 | (delete 'remove-unsupported-tests))))))))) | |
1260 | ||
1261 | (define-public rust-1.41 | |
1262 | (let ((base-rust | |
1263 | (rust-bootstrapped-package rust-1.40 "1.41.1" | |
1264 | "0ws5x0fxv57fyllsa6025h3q6j9v3m8nb3syl4x0hgkddq0kvj9q"))) | |
1265 | (package | |
1266 | (inherit base-rust) | |
1267 | (arguments | |
1268 | (substitute-keyword-arguments (package-arguments base-rust) | |
1269 | ((#:validate-runpath? _) #t)))))) | |
1270 | ||
1271 | (define-public rust-1.42 | |
1272 | (rust-bootstrapped-package rust-1.41 "1.42.0" | |
1273 | "0x9lxs82may6c0iln0b908cxyn1cv7h03n5cmbx3j1bas4qzks6j")) | |
1274 | ||
1275 | (define-public rust-1.43 | |
1276 | (rust-bootstrapped-package rust-1.42 "1.43.0" | |
1277 | "18akhk0wz1my6y9vhardriy2ysc482z0fnjdcgs9gy59kmnarxkm")) | |
1278 | ||
1279 | (define-public rust-1.44 | |
1280 | (rust-bootstrapped-package rust-1.43 "1.44.1" | |
1281 | "0ww4z2v3gxgn3zddqzwqya1gln04p91ykbrflnpdbmcd575n8bky")) | |
1282 | ||
17666c09 JK |
1283 | (define-public rust-1.45 |
1284 | (let ((base-rust | |
4ad8f5ff JK |
1285 | (rust-bootstrapped-package rust-1.44 "1.45.2" |
1286 | "0273a1g3f59plyi1n0azf21qjzwml1yqdnj5z472crz37qggr8xp"))) | |
17666c09 JK |
1287 | (package |
1288 | (inherit base-rust) | |
1289 | (source | |
1290 | (origin | |
1291 | (inherit (package-source base-rust)) | |
1292 | (patches (search-patches "rust-1.45-linker-locale.patch")))) | |
1293 | (inputs | |
1294 | (alist-replace "llvm" (list llvm-10) | |
1295 | (package-inputs base-rust))) | |
1296 | (arguments | |
1297 | (substitute-keyword-arguments (package-arguments base-rust) | |
1298 | ((#:phases phases) | |
1299 | `(modify-phases ,phases | |
1300 | ;; These tests make sure that the parser behaves properly when | |
1301 | ;; a source file starts with a shebang. Unfortunately, | |
1302 | ;; the patch-shebangs phase changes the meaning of these edge-cases. | |
1303 | ;; We skip the test since it's drastically unlikely Guix's packaging | |
1304 | ;; will introduce a bug here. | |
1305 | (add-after 'patch-tests 'skip-shebang-tests | |
1306 | (lambda _ | |
1307 | (with-directory-excursion "src/test/ui/parser/shebang" | |
1308 | (delete-file "shebang-doc-comment.rs") | |
1309 | (delete-file "sneaky-attrib.rs") | |
1310 | #t))) | |
1311 | ;; This test case synchronizes itself by starting a localhost TCP | |
1312 | ;; server. This doesn't work as networking is not available. | |
1313 | (add-after 'patch-tests 'skip-networking-test | |
1314 | (lambda _ | |
1315 | (substitute* "src/tools/cargo/tests/testsuite/freshness.rs" | |
1316 | (("fn linking_interrupted" all) | |
1317 | (string-append "#[ignore] " all))) | |
1318 | #t))))))))) | |
7befec25 JK |
1319 | |
1320 | ;; TODO(staging): Bump this variable to the latest packaged rust. | |
ba65d474 | 1321 | (define-public rust rust-1.39) |