gnu: rustc: Simplify configure phase.
[jackhill/guix/guix.git] / gnu / packages / rust.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 David Craven <david@craven.ch>
3 ;;; Copyright © 2016 Eric Le Bihan <eric.le.bihan.dev@free.fr>
4 ;;; Copyright © 2016 ng0 <ng0@libertad.pw>
5 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages rust)
23 #:use-module (gnu packages base)
24 #:use-module (gnu packages bootstrap)
25 #:use-module (gnu packages cmake)
26 #:use-module (gnu packages compression)
27 #:use-module (gnu packages curl)
28 #:use-module (gnu packages elf)
29 #:use-module (gnu packages gcc)
30 #:use-module (gnu packages jemalloc)
31 #:use-module (gnu packages llvm)
32 #:use-module (gnu packages pkg-config)
33 #:use-module (gnu packages python)
34 #:use-module (gnu packages ssh)
35 #:use-module (gnu packages tls)
36 #:use-module (gnu packages version-control)
37 #:use-module (guix build-system cargo)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system trivial)
40 #:use-module (guix download)
41 #:use-module ((guix licenses) #:prefix license:)
42 #:use-module (guix packages)
43 #:use-module (ice-9 match)
44 #:use-module (srfi srfi-26))
45
46 ;; Should be one less than the current released version.
47 (define %rust-bootstrap-binaries-version "1.14.0")
48
49 (define %rust-bootstrap-binaries
50 (origin
51 (method url-fetch)
52 (uri (string-append
53 "https://static.rust-lang.org/dist/"
54 "rust-" %rust-bootstrap-binaries-version
55 "-i686-unknown-linux-gnu.tar.gz"))
56 (sha256
57 (base32
58 "0h384prpabcl08mxs1bilyb0dbk0knpdylcnz4b84ij4idr7ap4d"))))
59
60 (define (increment-rust-version rust-version major patch)
61 (match (string-split rust-version #\.)
62 (("1" minor _)
63 (string-append (number->string major) "."
64 (number->string (+ (string->number minor) 1)) "."
65 (number->string patch)))))
66
67 (define* (cargo-version rustc-version #:optional (patch 0))
68 ;; Computes the cargo version that matches the rustc version.
69 ;; https://github.com/rust-lang/cargo#Releases
70 (increment-rust-version rustc-version 0 patch))
71
72 (define* (rustc-version bootstrap-version #:optional (patch 0))
73 ;; Computes the rustc version that can be compiled from a given
74 ;; other rustc version. The patch argument is for selecting
75 ;; a stability or security fix. 1.11.0 -> 1.12.1 -> 1.13.0
76 (increment-rust-version bootstrap-version 1 patch))
77
78 (define rustc-bootstrap
79 (package
80 (name "rustc-bootstrap")
81 (version %rust-bootstrap-binaries-version)
82 (source %rust-bootstrap-binaries)
83 (build-system gnu-build-system)
84 (native-inputs
85 `(("patchelf" ,patchelf)))
86 (inputs
87 `(("gcc:lib" ,(canonical-package gcc) "lib")
88 ("zlib" ,zlib)))
89 (arguments
90 `(#:tests? #f
91 #:strip-binaries? #f
92 #:system "i686-linux"
93 #:phases
94 (modify-phases %standard-phases
95 (delete 'configure)
96 (delete 'build)
97 (replace 'install
98 (lambda* (#:key inputs outputs #:allow-other-keys)
99 (let* ((out (assoc-ref outputs "out"))
100 (gcc:lib (assoc-ref inputs "gcc:lib"))
101 (libc (assoc-ref inputs "libc"))
102 (zlib (assoc-ref inputs "zlib"))
103 (ld-so (string-append libc
104 ,(glibc-dynamic-linker "i686-linux")))
105 (rpath (string-append out "/lib:" zlib "/lib:"
106 libc "/lib:" gcc:lib "/lib"))
107 (rustc (string-append out "/bin/rustc"))
108 (rustdoc (string-append out "/bin/rustdoc")))
109 (system* "bash" "install.sh"
110 (string-append "--prefix=" out)
111 (string-append "--components=rustc,"
112 "rust-std-i686-unknown-linux-gnu"))
113 (for-each (lambda (file)
114 (system* "patchelf" "--set-rpath" rpath file))
115 (cons* rustc rustdoc (find-files out "\\.so$")))
116 (for-each (lambda (file)
117 (system* "patchelf" "--set-interpreter" ld-so file))
118 (list rustc rustdoc))))))))
119 (supported-systems '("i686-linux" "x86_64-linux"))
120 (home-page "https://www.rust-lang.org")
121 (synopsis "Prebuilt rust compiler")
122 (description "This package provides a pre-built @command{rustc} compiler,
123 which can in turn be used to build the final Rust compiler.")
124 (license license:asl2.0)))
125
126 (define cargo-bootstrap
127 (package
128 (name "cargo-bootstrap")
129 (version (cargo-version %rust-bootstrap-binaries-version))
130 (source %rust-bootstrap-binaries)
131 (build-system gnu-build-system)
132 (native-inputs
133 `(("patchelf" ,patchelf)))
134 (inputs
135 `(("gcc:lib" ,(canonical-package gcc) "lib")))
136 (arguments
137 `(#:tests? #f
138 #:strip-binaries? #f
139 #:system "i686-linux"
140 #:phases
141 (modify-phases %standard-phases
142 (delete 'configure)
143 (delete 'build)
144 (replace 'install
145 (lambda* (#:key inputs outputs #:allow-other-keys)
146 (let* ((out (assoc-ref outputs "out"))
147 (gcc:lib (assoc-ref inputs "gcc:lib"))
148 (libc (assoc-ref inputs "libc"))
149 (ld-so (string-append libc
150 ,(glibc-dynamic-linker "i686-linux")))
151 (rpath (string-append out "/lib:" libc "/lib:"
152 gcc:lib "/lib"))
153 (cargo (string-append out "/bin/cargo")))
154 (system* "bash" "install.sh"
155 (string-append "--prefix=" out)
156 "--components=cargo")
157 (system* "patchelf"
158 "--set-interpreter" ld-so
159 "--set-rpath" rpath
160 cargo)))))))
161 (supported-systems '("i686-linux" "x86_64-linux"))
162 (home-page "https://www.rust-lang.org")
163 (synopsis "Prebuilt cargo package manager")
164 (description "This package provides a pre-built @command{cargo} package
165 manager, which is required to build itself.")
166 (license license:asl2.0)))
167
168 (define rust-bootstrap
169 (package
170 (name "rust-bootstrap")
171 (version %rust-bootstrap-binaries-version)
172 (source #f)
173 (build-system trivial-build-system)
174 (propagated-inputs
175 `(("rustc-bootstrap" ,rustc-bootstrap)
176 ("cargo-bootstrap" ,cargo-bootstrap)
177 ("gcc" ,(canonical-package gcc))))
178 (arguments
179 `(#:modules ((guix build utils))
180 #:builder
181 (begin
182 (use-modules (guix build utils))
183 (let ((out (assoc-ref %outputs "out"))
184 (gcc (assoc-ref %build-inputs "gcc")))
185 (mkdir-p (string-append out "/bin"))
186 ;; Rust requires a C toolchain for linking. The prebuilt
187 ;; binaries expect a compiler called cc. Thus symlink gcc
188 ;; to cc.
189 (symlink (string-append gcc "/bin/gcc")
190 (string-append out "/bin/cc"))))))
191 (home-page "https://www.rust-lang.org")
192 (synopsis "Rust bootstrapping meta package")
193 (description "Meta package for a rust environment. Provides pre-compiled
194 rustc-bootstrap and cargo-bootstrap packages.")
195 (license license:asl2.0)))
196
197 (define-public rustc
198 (package
199 (name "rustc")
200 (version (rustc-version %rust-bootstrap-binaries-version))
201 (source (origin
202 (method url-fetch)
203 (uri (string-append
204 "https://static.rust-lang.org/dist/"
205 "rustc-" version "-src.tar.gz"))
206 (sha256
207 (base32
208 "0wvn8m1nfg664b95qrdpfh72q1a6ir09rqkrnlzbkay2r7xf8mgn"))))
209 (build-system gnu-build-system)
210 (native-inputs
211 `(("cmake" ,cmake)
212 ("git" ,git)
213 ("python-2" ,python-2)
214 ("rust-bootstrap" ,rust-bootstrap)
215 ("which" ,which)))
216 (inputs
217 `(("jemalloc" ,jemalloc)
218 ("llvm" ,llvm)))
219 (arguments
220 ;; FIXME: Test failure with llvm 3.8; Update llvm.
221 ;; https://github.com/rust-lang/rust/issues/36835
222 `(#:tests? #f
223 #:phases
224 (modify-phases %standard-phases
225 (add-after 'unpack 'patch-configure
226 (lambda _
227 (substitute* "configure"
228 (("/usr/bin/env") (which "env")) ; Detect target CPU correctly.
229 (("probe_need CFG_CURL curl") "")) ; Avoid curl as a build dependency.
230 #t))
231 (add-after 'unpack 'set-env
232 (lambda _
233 (setenv "SHELL" (which "sh"))
234 (setenv "CONFIG_SHELL" (which "sh"))
235 #t))
236 (add-after 'unpack 'patch-tests
237 (lambda* (#:key inputs #:allow-other-keys)
238 (let ((bash (assoc-ref inputs "bash")))
239 (substitute* "src/tools/tidy/src/main.rs"
240 (("^.*cargo.*::check.*$") ""))
241 (substitute* "src/libstd/process.rs"
242 (("\"/bin/sh\"") (string-append "\"" bash "/bin/sh\"")))
243 #t)))
244 (replace 'configure
245 (lambda* (#:key inputs outputs #:allow-other-keys)
246 (let* ((out (assoc-ref outputs "out"))
247 (gcc (assoc-ref inputs "gcc"))
248 (binutils (assoc-ref inputs "binutils"))
249 (python (assoc-ref inputs "python-2"))
250 (rustc (assoc-ref inputs "rustc-bootstrap"))
251 (llvm (assoc-ref inputs "llvm"))
252 (jemalloc (assoc-ref inputs "jemalloc"))
253 (flags (list
254 (string-append "--prefix=" out)
255 (string-append "--datadir=" out "/share")
256 (string-append "--infodir=" out "/share/info")
257 (string-append "--default-linker=" gcc "/bin/gcc")
258 (string-append "--default-ar=" binutils "/bin/ar")
259 (string-append "--python=" python "/bin/python2")
260 (string-append "--local-rust-root=" rustc)
261 (string-append "--llvm-root=" llvm)
262 (string-append "--jemalloc-root=" jemalloc "/lib")
263 "--release-channel=stable"
264 "--enable-rpath"
265 "--enable-local-rust"
266 "--disable-rustbuild" ; use Makefiles
267 "--disable-manage-submodules")))
268 ;; Rust uses a custom configure script (no autoconf).
269 (zero? (apply system* "./configure" flags)))))
270 (add-after 'install 'wrap-rustc
271 (lambda* (#:key inputs outputs #:allow-other-keys)
272 (let ((out (assoc-ref outputs "out"))
273 (libc (assoc-ref inputs "libc"))
274 (ld-wrapper (assoc-ref inputs "ld-wrapper")))
275 ;; Let gcc find ld and libc startup files.
276 (wrap-program (string-append out "/bin/rustc")
277 `("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
278 `("LIBRARY_PATH" ":" suffix (,(string-append libc "/lib"))))
279 #t))))))
280 ;; rustc invokes gcc, so we need to set its search paths accordingly.
281 (native-search-paths (package-native-search-paths gcc))
282 (synopsis "Compiler for the Rust progamming language")
283 (description "Rust is a systems programming language that provides memory
284 safety and thread safety guarantees.")
285 (home-page "https://www.rust-lang.org")
286 ;; Dual licensed.
287 (license (list license:asl2.0 license:expat))))
288
289 (define-public cargo
290 (package
291 (name "cargo")
292 (version (cargo-version (rustc-version %rust-bootstrap-binaries-version)))
293 (source (origin
294 (method url-fetch)
295 (uri (string-append "https://github.com/rust-lang/cargo/archive/"
296 version ".tar.gz"))
297 (file-name (string-append name "-" version ".tar.gz"))
298 (sha256
299 (base32
300 "194i06y9nql0p93gahh0vm4qwv6c1kpd9rprpf22w5gav9lpcyjz"))))
301 (build-system cargo-build-system)
302 (propagated-inputs
303 `(("cmake" ,cmake)
304 ("pkg-config" ,pkg-config)))
305 (inputs
306 `(("curl" ,curl)
307 ("libgit2" ,libgit2)
308 ("libssh2" ,libssh2)
309 ("openssl" ,openssl)
310 ("python-2" ,python-2)
311 ("zlib" ,zlib)))
312 (native-inputs
313 `(("rust-openssl"
314 ,(origin
315 (method url-fetch)
316 (uri (crate-uri "openssl" "0.9.1"))
317 (sha256
318 (base32
319 "1m2mhiar87qnw4gxci286q9g85ljafbc41salbj2hmcgh8aagchy"))))
320 ("rust-strsim"
321 ,(origin
322 (method url-fetch)
323 (uri (crate-uri "strsim" "0.5.1"))
324 (sha256
325 (base32
326 "0bj4fsm1l2yqbfpspyvjf9m3m50pskapcddzm0ji9c74jbgnkh2h"))))
327 ("rust-libc"
328 ,(origin
329 (method url-fetch)
330 (uri (crate-uri "libc" "0.2.18"))
331 (sha256
332 (base32
333 "0w5cghr0wx3hi2sclk8r9iyzlbxsakil87ada40q2ykyhky24655"))))
334 ("rust-bitflags"
335 ,(origin
336 (method url-fetch)
337 (uri (crate-uri "bitflags" "0.7.0"))
338 (sha256
339 (base32
340 "0v8hh6wdkpk9my8z8442g4hqrqf05h0qj53dsay6mv18lqvqklda"))))
341 ("rust-unicode-normalization"
342 ,(origin
343 (method url-fetch)
344 (uri (crate-uri "unicode-normalization" "0.1.2"))
345 (sha256
346 (base32
347 "0whi4xxqcjfsz6ywyrfd5lhgk1a44c86qwgvfqcmzidshcpklr16"))))
348 ("rust-rand"
349 ,(origin
350 (method url-fetch)
351 (uri (crate-uri "rand" "0.3.14"))
352 (sha256
353 (base32
354 "1984zvj8572ig28fz6idc4r96fx39h4lzmr07yf7kb7gdn6di497"))))
355 ("rust-gcc"
356 ,(origin
357 (method url-fetch)
358 (uri (crate-uri "gcc" "0.3.39"))
359 (sha256
360 (base32
361 "1q0idjvmhp6shkb9hqabh51rgfr8dqpi1xfmyzq7q8vgzybll7kp"))))
362 ("rust-tempdir"
363 ,(origin
364 (method url-fetch)
365 (uri (crate-uri "tempdir" "0.3.5"))
366 (sha256
367 (base32
368 "1mij45kgzflkja0h8q9avrik76h5a0b60m9hfd6k9yqxbiplm5w7"))))
369 ("rust-memchr"
370 ,(origin
371 (method url-fetch)
372 (uri (crate-uri "memchr" "0.1.11"))
373 (sha256
374 (base32
375 "084d85hjfa3xf5kwdms2mhbkh78m1gl2254cp5swcxj3a7xjkdnq"))))
376 ("rust-rustc-serialize"
377 ,(origin
378 (method url-fetch)
379 (uri (crate-uri "rustc-serialize" "0.3.21"))
380 (sha256
381 (base32
382 "064qmyr2508qf78dwcpiv25rfjp9h9vd0wrj4mmwgppjg4fgrydz"))))
383 ("rust-cmake"
384 ,(origin
385 (method url-fetch)
386 (uri (crate-uri "cmake" "0.1.19"))
387 (sha256
388 (base32
389 "0am8c8ns1h6b1a5x9z2r1m3rszvya5nccl2pzszzjv5aiiaydgcf"))))
390 ("rust-matches"
391 ,(origin
392 (method url-fetch)
393 (uri (crate-uri "matches" "0.1.4"))
394 (sha256
395 (base32
396 "1c8190j84hbicy8jwscw5icfam12j6lcxi02lvmadq9260p65mzg"))))
397 ("rust-winapi"
398 ,(origin
399 (method url-fetch)
400 (uri (crate-uri "winapi" "0.2.8"))
401 (sha256
402 (base32
403 "0yh816lh6lf56dpsgxy189c2ai1z3j8mw9si6izqb6wsjkbcjz8n"))))
404 ("rust-pkg-config"
405 ,(origin
406 (method url-fetch)
407 (uri (crate-uri "pkg-config" "0.3.8"))
408 (sha256
409 (base32
410 "1ypj4nj2z9z27qg06v3g40jyhw685i3l2wi098d21bvyri781vlc"))))
411 ("rust-libssh2-sys"
412 ,(origin
413 (method url-fetch)
414 (uri (crate-uri "libssh2-sys" "0.2.4"))
415 (sha256
416 (base32
417 "1pmmh0hcx14856wg9bp740yf618qfl2765vhf67sfs5lmf39227d"))))
418 ("rust-libz-sys"
419 ,(origin
420 (method url-fetch)
421 (uri (crate-uri "libz-sys" "1.0.10"))
422 (sha256
423 (base32
424 "1rl85x045sk5d345hgcahx99plpbdg2a3bx5vjfxig30qah74p4h"))))
425 ("rust-curl-sys"
426 ,(origin
427 (method url-fetch)
428 (uri (crate-uri "curl-sys" "0.3.6"))
429 (sha256
430 (base32
431 "0fi8kjz3f8m8vfazycs3ddm0h6j3x78hw78gwbvybx71129192i1"))))
432 ("rust-openssl-sys"
433 ,(origin
434 (method url-fetch)
435 (uri (crate-uri "openssl-sys" "0.9.1"))
436 (sha256
437 (base32
438 "1sdhgalfm2zdqf144xhdnxdha7ifjgsfbmlrqbx0j9f3mh4gpscm"))))
439 ("rust-fs2"
440 ,(origin
441 (method url-fetch)
442 (uri (crate-uri "fs2" "0.3.0"))
443 (sha256
444 (base32
445 "0lg57mgcm1r0m8jm4nqpcrl6lmxg8lj854k2h0r7qp46pphh2034"))))
446 ("rust-log"
447 ,(origin
448 (method url-fetch)
449 (uri (crate-uri "log" "0.3.6"))
450 (sha256
451 (base32
452 "0m40hgs3cg57dd5kk1mabfk6gk8z6l1cihar8akx4kmzz1xlk0xb"))))
453 ("rust-filetime"
454 ,(origin
455 (method url-fetch)
456 (uri (crate-uri "filetime" "0.1.10"))
457 (sha256
458 (base32
459 "08p9scgv30i1141cnp5xi4pqlnkfci455nrpca55df1r867anqsk"))))
460 ("rust-tar"
461 ,(origin
462 (method url-fetch)
463 (uri (crate-uri "tar" "0.4.9"))
464 (sha256
465 (base32
466 "1vi3nl8s3jjf5l20ni47gmh1p4bdjfh7q50fbg7izzqrf7i4i40c"))))
467 ("rust-glob"
468 ,(origin
469 (method url-fetch)
470 (uri (crate-uri "glob" "0.2.11"))
471 (sha256
472 (base32
473 "1ysvi72slkw784fcsymgj4308c3y03gwjjzqxp80xdjnkbh8vqcb"))))
474 ("rust-cfg-if"
475 ,(origin
476 (method url-fetch)
477 (uri (crate-uri "cfg-if" "0.1.0"))
478 (sha256
479 (base32
480 "137qikjcal4h75frzcn6mknygqk8vy5bva7w851aydb5gc6pc7ny"))))
481 ("rust-winapi-build"
482 ,(origin
483 (method url-fetch)
484 (uri (crate-uri "winapi-build" "0.1.1"))
485 (sha256
486 (base32
487 "1g4rqsgjky0a7530qajn2bbfcrl2v0zb39idgdws9b1l7gp5wc9d"))))
488 ("rust-advapi32-sys"
489 ,(origin
490 (method url-fetch)
491 (uri (crate-uri "advapi32-sys" "0.2.0"))
492 (sha256
493 (base32
494 "16largvlrd1800vvdchml0ngnszjlnpqm01rcz5hm7di1h48hrg0"))))
495 ("rust-gdi32-sys"
496 ,(origin
497 (method url-fetch)
498 (uri (crate-uri "gdi32-sys" "0.2.0"))
499 (sha256
500 (base32
501 "0605d4ngjsspghwjv4jicajich1gnl0aik9f880ajjzjixd524h9"))))
502 ("rust-ws2_32-sys"
503 ,(origin
504 (method url-fetch)
505 (uri (crate-uri "ws2_32-sys" "0.2.1"))
506 (sha256
507 (base32
508 "0ppscg5qfqaw0gzwv2a4nhn5bn01ff9iwn6ysqnzm4n8s3myz76m"))))
509 ("rust-user32-sys"
510 ,(origin
511 (method url-fetch)
512 (uri (crate-uri "user32-sys" "0.2.0"))
513 (sha256
514 (base32
515 "0ivxc7hmsxax9crdhxdd1nqwik4s9lhb2x59lc8b88bv20fp3x2f"))))
516 ("rust-unicode-bidi"
517 ,(origin
518 (method url-fetch)
519 (uri (crate-uri "unicode-bidi" "0.2.3"))
520 (sha256
521 (base32
522 "0gqbyf6slkgzr14nf6v8dw8a19l5snh6bpms8bpfvzpxdawwxxy1"))))
523 ("rust-net2"
524 ,(origin
525 (method url-fetch)
526 (uri (crate-uri "net2" "0.2.26"))
527 (sha256
528 (base32
529 "1qp3q6xynb481rsp3ig1nmqb6qlxfba3shfrmqij88cppsv9rpsy"))))
530 ("rust-utf8-ranges"
531 ,(origin
532 (method url-fetch)
533 (uri (crate-uri "utf8-ranges" "0.1.3"))
534 (sha256
535 (base32
536 "03xf604b2v51ag3jgzw92l97xnb10kw9zv948bhc7ja1ik017jm1"))))
537 ("rust-crossbeam"
538 ,(origin
539 (method url-fetch)
540 (uri (crate-uri "crossbeam" "0.2.10"))
541 (sha256
542 (base32
543 "15wga0kvk3iqf3l077957j931brf1pl3p74xibd698jccqas4phc"))))
544 ("rust-toml"
545 ,(origin
546 (method url-fetch)
547 (uri (crate-uri "toml" "0.2.1"))
548 (sha256
549 (base32
550 "1d1cz43bxrx4fd6j2p6myckf81f72bp47akg36y3flxjkhj60svk"))))
551 ("rust-aho-corasick"
552 ,(origin
553 (method url-fetch)
554 (uri (crate-uri "aho-corasick" "0.5.3"))
555 (sha256
556 (base32
557 "0rnvdmlajikq0i4zdy1p3pv699q6apvsxfc7av7byhppllp2r5ya"))))
558 ("rust-psapi-sys"
559 ,(origin
560 (method url-fetch)
561 (uri (crate-uri "psapi-sys" "0.1.0"))
562 (sha256
563 (base32
564 "0y14g8qshsfnmb7nk2gs1rpbrs1wrggajmzp4yby4q6k0wd5vkdb"))))
565 ("rust-idna"
566 ,(origin
567 (method url-fetch)
568 (uri (crate-uri "idna" "0.1.0"))
569 (sha256
570 (base32
571 "049c2rmlydrrrgrxdaq2v21adx9vkfh6k9x4xj56ckyf01p26lqh"))))
572 ("rust-url"
573 ,(origin
574 (method url-fetch)
575 (uri (crate-uri "url" "1.2.3"))
576 (sha256
577 (base32
578 "1myr1i8djbl2bhvvrm6n3h7bj7sl6kh5dmaaz2f7c6x8hyyzgk28"))))
579 ("rust-regex-syntax"
580 ,(origin
581 (method url-fetch)
582 (uri (crate-uri "regex-syntax" "0.3.9"))
583 (sha256
584 (base32
585 "0ms9hgdhhsxw9w920i7gipydvagf100bb56jbs192rz86ln01v7r"))))
586 ("rust-kernel32-sys"
587 ,(origin
588 (method url-fetch)
589 (uri (crate-uri "kernel32-sys" "0.2.2"))
590 (sha256
591 (base32
592 "1389av0601a9yz8dvx5zha9vmkd6ik7ax0idpb032d28555n41vm"))))
593 ("rust-term"
594 ,(origin
595 (method url-fetch)
596 (uri (crate-uri "term" "0.4.4"))
597 (sha256
598 (base32
599 "0jpr7jb1xidadh0arklwr99r8w1k1dfc4an3ginpsq5nnfigivrx"))))
600 ("rust-thread-id"
601 ,(origin
602 (method url-fetch)
603 (uri (crate-uri "thread-id" "2.0.0"))
604 (sha256
605 (base32
606 "00zzs2bx1xw8aqm5plqqgr7bc2zz6zkqrdxq8vpiqb8hc2srslx9"))))
607 ("rust-thread_local"
608 ,(origin
609 (method url-fetch)
610 (uri (crate-uri "thread_local" "0.2.7"))
611 (sha256
612 (base32
613 "1mgxikqvhpsic6xk7pan95lvgsky1sdxzw2w5m2l35pgrazxnxl5"))))
614 ("rust-miow"
615 ,(origin
616 (method url-fetch)
617 (uri (crate-uri "miow" "0.1.3"))
618 (sha256
619 (base32
620 "16jvfjsp6fr4mbd2sw5hcdmi4dsa0m0aa45gjz78mb1h4mwcdgym"))))
621 ("rust-regex"
622 ,(origin
623 (method url-fetch)
624 (uri (crate-uri "regex" "0.1.80"))
625 (sha256
626 (base32
627 "0bs036h3vzc6pj5jj4vc909s9rppq7b808ic99qn0y6gm3karm2g"))))
628 ("rust-num_cpus"
629 ,(origin
630 (method url-fetch)
631 (uri (crate-uri "num_cpus" "1.1.0"))
632 (sha256
633 (base32
634 "1bfwcn3yhwa31rinjw9yr7b6gvn6c06hnwnjz06pvm938w4fd448"))))
635 ("rust-libgit2-sys"
636 ,(origin
637 (method url-fetch)
638 (uri (crate-uri "libgit2-sys" "0.6.5"))
639 (sha256
640 (base32
641 "0yl80n12ih4jh1halpbj3zqlqvw5zxdr6m6xdcvdz67svjy50bjh"))))
642 ("rust-env_logger"
643 ,(origin
644 (method url-fetch)
645 (uri (crate-uri "env_logger" "0.3.5"))
646 (sha256
647 (base32
648 "0bvcjgkw4s3k1rd7glpflgc8s9a393zjd6jfdgvs8gjvwj0dgaqm"))))
649 ("rust-openssl-probe"
650 ,(origin
651 (method url-fetch)
652 (uri (crate-uri "openssl-probe" "0.1.0"))
653 (sha256
654 (base32
655 "0689h6rhzy6dypqr90lsxnf108nsnh952wsx7ggs70s48b44jvbm"))))
656 ("rust-lazy_static"
657 ,(origin
658 (method url-fetch)
659 (uri (crate-uri "lazy_static" "0.2.2"))
660 (sha256
661 (base32
662 "16z1h7w702sxnscak38jykxlhxq0b5ip4mndlb46pkaqwzi0xgka"))))
663 ("rust-semver-parser"
664 ,(origin
665 (method url-fetch)
666 (uri (crate-uri "semver-parser" "0.6.1"))
667 (sha256
668 (base32
669 "1s8s7a7yg8xhgci17y0xhyyncg229byivhpr0wbs3ljdlyjl73p8"))))
670 ("rust-semver"
671 ,(origin
672 (method url-fetch)
673 (uri (crate-uri "semver" "0.5.1"))
674 (sha256
675 (base32
676 "1xbiv8l72rmngb3lgbmk3vd4lalcbzxcnrn085c2b75irl7gcbxf"))))
677 ("rust-docopt"
678 ,(origin
679 (method url-fetch)
680 (uri (crate-uri "docopt" "0.6.86"))
681 (sha256
682 (base32
683 "1nf4f4zf5yk0d0l4kl7hkii4na22fhn0l2hgfb46yzv08l2g6zja"))))
684 ("rust-miniz-sys"
685 ,(origin
686 (method url-fetch)
687 (uri (crate-uri "miniz-sys" "0.1.7"))
688 (sha256
689 (base32
690 "0m7dlggsxash0k5jkx576p556g9r8vnhyl9244gjxhq1g8rls7wx"))))
691 ("rust-curl"
692 ,(origin
693 (method url-fetch)
694 (uri (crate-uri "curl" "0.4.1"))
695 (sha256
696 (base32
697 "1b0y27b6vpqffgzm2kxc1s2i6bgdzxk3wn65g2asbcdxrvys3mcg"))))
698 ("rust-flate2"
699 ,(origin
700 (method url-fetch)
701 (uri (crate-uri "flate2" "0.2.14"))
702 (sha256
703 (base32
704 "1fx3zsls5bb1zfx87s5sxkgk853z4nhjsbvq5s6if13kjlg4isry"))))
705 ("rust-git2"
706 ,(origin
707 (method url-fetch)
708 (uri (crate-uri "git2" "0.6.3"))
709 (sha256
710 (base32
711 "06b1bw3pwszs8617xn8js6h0j983qjgfwsychw33lshccj3cld05"))))
712 ("rust-crates-io"
713 ,(origin
714 (method url-fetch)
715 (uri (crate-uri "crates-io" "0.4.0"))
716 (sha256
717 (base32
718 "0kk6abp1qbpv44hkq1yjp7xgpzjzafs83i1l26ycr0aph1gbwig9"))))
719 ("rust-git2-curl"
720 ,(origin
721 (method url-fetch)
722 (uri (crate-uri "git2-curl" "0.7.0"))
723 (sha256
724 (base32
725 "13mzqp4rd81zp78261rlq23iw9aaysdr56484y1yy2xzhk3nnrv8"))))
726 ("rust-bufstream"
727 ,(origin
728 (method url-fetch)
729 (uri (crate-uri "bufstream" "0.1.2"))
730 (sha256
731 (base32
732 "0x6h27md1fwabbhbycfldj0wklrpjr520z9p0cpzm60fzzidnj3v"))))
733 ("rust-hamcrest"
734 ,(origin
735 (method url-fetch)
736 (uri (crate-uri "hamcrest" "0.1.1"))
737 (sha256
738 (base32
739 "1m49rf7bnkx0qxja56slrjh44zi4z5bjz5x4pblqjw265828y25z"))))
740 ("rust-num"
741 ,(origin
742 (method url-fetch)
743 (uri (crate-uri "num" "0.1.36"))
744 (sha256
745 (base32
746 "081i1r3mdz6jasqd7qwraqqfqa3sdpvdvxl1xq0s7ip714xw1rxx"))))
747 ("rust-num-traits"
748 ,(origin
749 (method url-fetch)
750 (uri (crate-uri "num-traits" "0.1.36"))
751 (sha256
752 (base32
753 "07688sp4z40p14lh5ywvrpm4zq8kcxzhjks8sg33jsr5da2l4sm1"))))
754 ("rust-num-integer"
755 ,(origin
756 (method url-fetch)
757 (uri (crate-uri "num-integer" "0.1.32"))
758 (sha256
759 (base32
760 "14pvaaawl0pgdcgh4dfdd67lz58yxlfl95bry86h28pjnfzxj97v"))))
761 ("rust-num-bigint"
762 ,(origin
763 (method url-fetch)
764 (uri (crate-uri "num-bigint" "0.1.35"))
765 (sha256
766 (base32
767 "0jayfkdm33p4zvcahlv46zdfhlzg053mpw32abf2lz0z8xw47cc8"))))
768 ("rust-num-rational"
769 ,(origin
770 (method url-fetch)
771 (uri (crate-uri "num-rational" "0.1.35"))
772 (sha256
773 (base32
774 "1bwaygv64qg7i78yqg0v4d0amfhamj598rpy4yxjz9rlhcxn1zsl"))))
775 ("rust-num-iter"
776 ,(origin
777 (method url-fetch)
778 (uri (crate-uri "num-iter" "0.1.32"))
779 (sha256
780 (base32
781 "0p74nj5c1mc33h9lx4wpmlmggmn5lnkhxv1225g0aix8d6ciqyi8"))))
782 ("rust-num-complex"
783 ,(origin
784 (method url-fetch)
785 (uri (crate-uri "num-complex" "0.1.35"))
786 (sha256
787 (base32
788 "0bzrjfppnnzf9vmkpklhp2dw9sb1lqzydb8r6k83z76i9l2qxizh"))))))
789 (arguments
790 `(#:cargo ,cargo-bootstrap
791 #:tests? #f ; FIXME
792 #:phases
793 (modify-phases %standard-phases
794 ;; Avoid cargo complaining about missmatched checksums.
795 (delete 'patch-source-shebangs)
796 (delete 'patch-generated-file-shebangs)
797 (delete 'patch-usr-bin-file)
798 (add-after 'unpack 'unpack-submodule-sources
799 (lambda* (#:key inputs #:allow-other-keys)
800 (let ((unpack (lambda (source target)
801 (mkdir-p target)
802 (with-directory-excursion target
803 (zero? (system* "tar" "xf"
804 source
805 "--strip-components=1"))))))
806 (mkdir "vendor")
807 (for-each (lambda (p)
808 (let ((name (car p)))
809 (if (string-prefix? "rust-" name)
810 (let ((rsrc (string-append "vendor/"
811 (string-drop name
812 (string-length "rust-")))))
813 (unpack (assoc-ref inputs name) rsrc)
814 (system* "touch" (string-append rsrc "/.cargo-ok"))
815 (generate-checksums rsrc (assoc-ref inputs name)))))) inputs))))
816 ;; Set CARGO_HOME to use the vendored dependencies.
817 (add-after 'unpack 'set-cargo-home
818 (lambda* (#:key inputs #:allow-other-keys)
819 (let* ((gcc (assoc-ref inputs "gcc"))
820 (cc (string-append gcc "/bin/gcc")))
821 (mkdir "cargohome")
822 (setenv "CARGO_HOME" (string-append (getcwd) "/cargohome"))
823 (call-with-output-file "cargohome/config"
824 (lambda (p)
825 (format p "
826 [source.crates-io]
827 registry = 'https://github.com/rust-lang/crates.io-index'
828 replace-with = 'vendored-sources'
829
830 [source.vendored-sources]
831 directory = 'vendor'
832 ")))
833 (setenv "CMAKE_C_COMPILER" cc)
834 (setenv "CC" cc))
835 #t)))))
836 (home-page "https://github.com/rust-lang/cargo")
837 (synopsis "Build tool and package manager for Rust")
838 (description "Cargo is a tool that allows Rust projects to declare their
839 dependencies and ensures a reproducible build.")
840 ;; Cargo is dual licensed Apache and MIT. Also contains
841 ;; code from openssl which is GPL2 with linking exception.
842 (license (list license:asl2.0 license:expat license:gpl2))))