gnu: guile@2.2: Increase max-silent-time to 10 hours.
[jackhill/guix/guix.git] / gnu / packages / rust.scm
CommitLineData
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>
b9542563 4;;; Copyright © 2016 ng0 <ng0@libertad.pw>
fa73a7c1 5;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
423f9e44
DC
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)
ecee2147 25 #:use-module (gnu packages cmake)
423f9e44 26 #:use-module (gnu packages compression)
b5a09649 27 #:use-module (gnu packages curl)
423f9e44
DC
28 #:use-module (gnu packages elf)
29 #:use-module (gnu packages gcc)
ecee2147
DC
30 #:use-module (gnu packages jemalloc)
31 #:use-module (gnu packages llvm)
b5a09649 32 #:use-module (gnu packages pkg-config)
ecee2147 33 #:use-module (gnu packages python)
b5a09649
DC
34 #:use-module (gnu packages ssh)
35 #:use-module (gnu packages tls)
ecee2147 36 #:use-module (gnu packages version-control)
b5a09649 37 #:use-module (guix build-system cargo)
423f9e44
DC
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.
9ea0cdaf 47(define %rust-bootstrap-binaries-version "1.15.0")
423f9e44
DC
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
9ea0cdaf 58 "0wmkfx8pxmkkw021mrq9s3xhra8f0daqdl6j56pxyn4w39i0rzrw"))))
423f9e44
DC
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,
123which can in turn be used to build the final Rust compiler.")
124 (license license:asl2.0)))
125
3b7ccbe9 126(define cargo-bootstrap
423f9e44
DC
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
165manager, 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
194rustc-bootstrap and cargo-bootstrap packages.")
195 (license license:asl2.0)))
ecee2147
DC
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
9ea0cdaf 208 "1d78jq7mc34n265by68amr9r4nzbiqrilfbwh7gx56ydn4gb6rpr"))))
ecee2147
DC
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 _
ecee2147 227 (substitute* "configure"
42c127e8 228 (("/usr/bin/env") (which "env")) ; Detect target CPU correctly.
9ea0cdaf
DM
229 (("probe_need CFG_CURL curl") "") ; Avoid curl build dependency.
230 ;; Newer LLVM has a NVPTX (NVIDIA) backend which the Rust
231 ;; Makefiles don't know about, causing a linker failure
232 ;; if we don't intervene.
233 ;; Therefore, we add NVPTX here.
234 ;; See <https://github.com/rust-lang/rust/issues/40698>.
235 ;; For the next release, we will have to use rustbuild.
236 ;; Right now, rustbuild doesn't work yet.
237 (("-DLLVM_TARGETS_TO_BUILD='")
238 "-DLLVM_TARGETS_TO_BUILD='NVPTX;")) ; Make LLVM >= 3.8.1 work.
239 (substitute* "src/tools/compiletest/src/util.rs"
240 (("(\"amd64\", \"x86_64\"),") "(\"amd64\", \"x86_64\"),
241(\"nvptx\", \"nvptx\"),")) ; Make LLVM >= 3.8.1 work.
242 (substitute* "mk/main.mk"
243 (("LLVM_OPTIONAL_COMPONENTS=")
244 "LLVM_OPTIONAL_COMPONENTS=nvptx ")) ; Make LLVM >= 3.8.1 work.
326249ba 245 #t))
ecee2147
DC
246 (add-after 'unpack 'set-env
247 (lambda _
248 (setenv "SHELL" (which "sh"))
326249ba
DM
249 (setenv "CONFIG_SHELL" (which "sh"))
250 #t))
84aac61c
DM
251 (add-after 'unpack 'patch-tests
252 (lambda* (#:key inputs #:allow-other-keys)
9b7a9580
DM
253 (let ((bash (assoc-ref inputs "bash")))
254 (substitute* "src/tools/tidy/src/main.rs"
255 (("^.*cargo.*::check.*$") ""))
256 (substitute* "src/libstd/process.rs"
257 (("\"/bin/sh\"") (string-append "\"" bash "/bin/sh\"")))
258 #t)))
ecee2147
DC
259 (replace 'configure
260 (lambda* (#:key inputs outputs #:allow-other-keys)
261 (let* ((out (assoc-ref outputs "out"))
262 (gcc (assoc-ref inputs "gcc"))
5d18d776 263 (binutils (assoc-ref inputs "binutils"))
ecee2147
DC
264 (python (assoc-ref inputs "python-2"))
265 (rustc (assoc-ref inputs "rustc-bootstrap"))
266 (llvm (assoc-ref inputs "llvm"))
267 (jemalloc (assoc-ref inputs "jemalloc"))
268 (flags (list
269 (string-append "--prefix=" out)
270 (string-append "--datadir=" out "/share")
271 (string-append "--infodir=" out "/share/info")
272 (string-append "--default-linker=" gcc "/bin/gcc")
5d18d776 273 (string-append "--default-ar=" binutils "/bin/ar")
ecee2147
DC
274 (string-append "--python=" python "/bin/python2")
275 (string-append "--local-rust-root=" rustc)
276 (string-append "--llvm-root=" llvm)
277 (string-append "--jemalloc-root=" jemalloc "/lib")
278 "--release-channel=stable"
279 "--enable-rpath"
280 "--enable-local-rust"
9ea0cdaf 281 "--disable-rustbuild" ; rustbuild doesn't work yet.
ecee2147
DC
282 "--disable-manage-submodules")))
283 ;; Rust uses a custom configure script (no autoconf).
5d18d776
DC
284 (zero? (apply system* "./configure" flags)))))
285 (add-after 'install 'wrap-rustc
286 (lambda* (#:key inputs outputs #:allow-other-keys)
287 (let ((out (assoc-ref outputs "out"))
288 (libc (assoc-ref inputs "libc"))
289 (ld-wrapper (assoc-ref inputs "ld-wrapper")))
290 ;; Let gcc find ld and libc startup files.
291 (wrap-program (string-append out "/bin/rustc")
292 `("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
326249ba
DM
293 `("LIBRARY_PATH" ":" suffix (,(string-append libc "/lib"))))
294 #t))))))
fa73a7c1
BW
295 ;; rustc invokes gcc, so we need to set its search paths accordingly.
296 (native-search-paths (package-native-search-paths gcc))
ecee2147
DC
297 (synopsis "Compiler for the Rust progamming language")
298 (description "Rust is a systems programming language that provides memory
299safety and thread safety guarantees.")
300 (home-page "https://www.rust-lang.org")
301 ;; Dual licensed.
302 (license (list license:asl2.0 license:expat))))
b5a09649 303
f0eb0a4b
DM
304;; This tries very hard not to get into a cyclic dependency like this:
305;; cargo <- cargo-build-system <- cargo.
b5a09649
DC
306(define-public cargo
307 (package
308 (name "cargo")
309 (version (cargo-version (rustc-version %rust-bootstrap-binaries-version)))
310 (source (origin
311 (method url-fetch)
893bc3f4
DM
312 (uri (string-append "https://github.com/rust-lang/cargo/archive/"
313 version ".tar.gz"))
b5a09649
DC
314 (file-name (string-append name "-" version ".tar.gz"))
315 (sha256
316 (base32
9ea0cdaf 317 "1y0zy8gk1ly0wh57y78fisk7cdd92qk0x7z664f6l7lzl2krqs7w"))))
b5a09649
DC
318 (build-system cargo-build-system)
319 (propagated-inputs
320 `(("cmake" ,cmake)
321 ("pkg-config" ,pkg-config)))
322 (inputs
323 `(("curl" ,curl)
324 ("libgit2" ,libgit2)
325 ("libssh2" ,libssh2)
326 ("openssl" ,openssl)
327 ("python-2" ,python-2)
328 ("zlib" ,zlib)))
893bc3f4
DM
329 (native-inputs
330 `(("rust-openssl"
331 ,(origin
332 (method url-fetch)
9ea0cdaf 333 (uri (crate-uri "openssl" "0.9.6"))
893bc3f4
DM
334 (sha256
335 (base32
9ea0cdaf 336 "0g28g692gby6izp9qmnwnyxyhf9b0870yhd500p18j9l69lxl00c"))))
893bc3f4
DM
337 ("rust-strsim"
338 ,(origin
339 (method url-fetch)
340 (uri (crate-uri "strsim" "0.5.1"))
341 (sha256
342 (base32
343 "0bj4fsm1l2yqbfpspyvjf9m3m50pskapcddzm0ji9c74jbgnkh2h"))))
344 ("rust-libc"
345 ,(origin
346 (method url-fetch)
347 (uri (crate-uri "libc" "0.2.18"))
348 (sha256
349 (base32
350 "0w5cghr0wx3hi2sclk8r9iyzlbxsakil87ada40q2ykyhky24655"))))
351 ("rust-bitflags"
352 ,(origin
353 (method url-fetch)
354 (uri (crate-uri "bitflags" "0.7.0"))
355 (sha256
356 (base32
357 "0v8hh6wdkpk9my8z8442g4hqrqf05h0qj53dsay6mv18lqvqklda"))))
358 ("rust-unicode-normalization"
359 ,(origin
360 (method url-fetch)
361 (uri (crate-uri "unicode-normalization" "0.1.2"))
362 (sha256
363 (base32
364 "0whi4xxqcjfsz6ywyrfd5lhgk1a44c86qwgvfqcmzidshcpklr16"))))
365 ("rust-rand"
366 ,(origin
367 (method url-fetch)
368 (uri (crate-uri "rand" "0.3.14"))
369 (sha256
370 (base32
371 "1984zvj8572ig28fz6idc4r96fx39h4lzmr07yf7kb7gdn6di497"))))
372 ("rust-gcc"
373 ,(origin
374 (method url-fetch)
375 (uri (crate-uri "gcc" "0.3.39"))
376 (sha256
377 (base32
378 "1q0idjvmhp6shkb9hqabh51rgfr8dqpi1xfmyzq7q8vgzybll7kp"))))
379 ("rust-tempdir"
380 ,(origin
381 (method url-fetch)
382 (uri (crate-uri "tempdir" "0.3.5"))
383 (sha256
384 (base32
385 "1mij45kgzflkja0h8q9avrik76h5a0b60m9hfd6k9yqxbiplm5w7"))))
386 ("rust-memchr"
387 ,(origin
388 (method url-fetch)
389 (uri (crate-uri "memchr" "0.1.11"))
390 (sha256
391 (base32
392 "084d85hjfa3xf5kwdms2mhbkh78m1gl2254cp5swcxj3a7xjkdnq"))))
393 ("rust-rustc-serialize"
394 ,(origin
395 (method url-fetch)
396 (uri (crate-uri "rustc-serialize" "0.3.21"))
397 (sha256
398 (base32
399 "064qmyr2508qf78dwcpiv25rfjp9h9vd0wrj4mmwgppjg4fgrydz"))))
400 ("rust-cmake"
401 ,(origin
402 (method url-fetch)
403 (uri (crate-uri "cmake" "0.1.19"))
404 (sha256
405 (base32
406 "0am8c8ns1h6b1a5x9z2r1m3rszvya5nccl2pzszzjv5aiiaydgcf"))))
407 ("rust-matches"
408 ,(origin
409 (method url-fetch)
410 (uri (crate-uri "matches" "0.1.4"))
411 (sha256
412 (base32
413 "1c8190j84hbicy8jwscw5icfam12j6lcxi02lvmadq9260p65mzg"))))
414 ("rust-winapi"
415 ,(origin
416 (method url-fetch)
417 (uri (crate-uri "winapi" "0.2.8"))
418 (sha256
419 (base32
420 "0yh816lh6lf56dpsgxy189c2ai1z3j8mw9si6izqb6wsjkbcjz8n"))))
421 ("rust-pkg-config"
422 ,(origin
423 (method url-fetch)
424 (uri (crate-uri "pkg-config" "0.3.8"))
425 (sha256
426 (base32
427 "1ypj4nj2z9z27qg06v3g40jyhw685i3l2wi098d21bvyri781vlc"))))
428 ("rust-libssh2-sys"
429 ,(origin
430 (method url-fetch)
9ea0cdaf 431 (uri (crate-uri "libssh2-sys" "0.2.5"))
893bc3f4
DM
432 (sha256
433 (base32
9ea0cdaf 434 "0d2r36hrh9vc1821r0v4kywv30svpf37d31calwql69fbij3bqci"))))
893bc3f4
DM
435 ("rust-libz-sys"
436 ,(origin
437 (method url-fetch)
9ea0cdaf 438 (uri (crate-uri "libz-sys" "1.0.13"))
893bc3f4
DM
439 (sha256
440 (base32
9ea0cdaf 441 "034pgvxzgsv37iafgs0lmvd1ifm0bg0zm1xcsn9x71nn8lm93vp5"))))
893bc3f4
DM
442 ("rust-curl-sys"
443 ,(origin
444 (method url-fetch)
445 (uri (crate-uri "curl-sys" "0.3.6"))
446 (sha256
447 (base32
448 "0fi8kjz3f8m8vfazycs3ddm0h6j3x78hw78gwbvybx71129192i1"))))
9ea0cdaf
DM
449 ("rust-error-chain"
450 ,(origin
451 (method url-fetch)
452 (uri (crate-uri "error-chain" "0.7.2"))
453 (sha256
454 (base32
455 "03qjh6l2a9fkiyg0428p7q3dcpi47cbmrqf9zmlymkg43v3v731i"))))
456 ("rust-metadeps"
457 ,(origin
458 (method url-fetch)
459 (uri (crate-uri "metadeps" "1.1.1"))
460 (sha256
461 (base32
462 "0l818461bslb7nrs7r1amkqv45n53fcp5sabyqipwx0xxbkzz7w2"))))
893bc3f4
DM
463 ("rust-openssl-sys"
464 ,(origin
465 (method url-fetch)
9ea0cdaf 466 (uri (crate-uri "openssl-sys" "0.9.6"))
893bc3f4
DM
467 (sha256
468 (base32
9ea0cdaf 469 "1hzpyf9z8xg1yn5r9g17bl5j20nifd6s2zp10xh90v7m0sd2yj5i"))))
893bc3f4
DM
470 ("rust-fs2"
471 ,(origin
472 (method url-fetch)
473 (uri (crate-uri "fs2" "0.3.0"))
474 (sha256
475 (base32
476 "0lg57mgcm1r0m8jm4nqpcrl6lmxg8lj854k2h0r7qp46pphh2034"))))
477 ("rust-log"
478 ,(origin
479 (method url-fetch)
480 (uri (crate-uri "log" "0.3.6"))
481 (sha256
482 (base32
483 "0m40hgs3cg57dd5kk1mabfk6gk8z6l1cihar8akx4kmzz1xlk0xb"))))
484 ("rust-filetime"
485 ,(origin
486 (method url-fetch)
487 (uri (crate-uri "filetime" "0.1.10"))
488 (sha256
489 (base32
490 "08p9scgv30i1141cnp5xi4pqlnkfci455nrpca55df1r867anqsk"))))
491 ("rust-tar"
492 ,(origin
493 (method url-fetch)
494 (uri (crate-uri "tar" "0.4.9"))
495 (sha256
496 (base32
497 "1vi3nl8s3jjf5l20ni47gmh1p4bdjfh7q50fbg7izzqrf7i4i40c"))))
498 ("rust-glob"
499 ,(origin
500 (method url-fetch)
501 (uri (crate-uri "glob" "0.2.11"))
502 (sha256
503 (base32
504 "1ysvi72slkw784fcsymgj4308c3y03gwjjzqxp80xdjnkbh8vqcb"))))
505 ("rust-cfg-if"
506 ,(origin
507 (method url-fetch)
508 (uri (crate-uri "cfg-if" "0.1.0"))
509 (sha256
510 (base32
511 "137qikjcal4h75frzcn6mknygqk8vy5bva7w851aydb5gc6pc7ny"))))
512 ("rust-winapi-build"
513 ,(origin
514 (method url-fetch)
515 (uri (crate-uri "winapi-build" "0.1.1"))
516 (sha256
517 (base32
518 "1g4rqsgjky0a7530qajn2bbfcrl2v0zb39idgdws9b1l7gp5wc9d"))))
519 ("rust-advapi32-sys"
520 ,(origin
521 (method url-fetch)
522 (uri (crate-uri "advapi32-sys" "0.2.0"))
523 (sha256
524 (base32
525 "16largvlrd1800vvdchml0ngnszjlnpqm01rcz5hm7di1h48hrg0"))))
526 ("rust-gdi32-sys"
527 ,(origin
528 (method url-fetch)
529 (uri (crate-uri "gdi32-sys" "0.2.0"))
530 (sha256
531 (base32
532 "0605d4ngjsspghwjv4jicajich1gnl0aik9f880ajjzjixd524h9"))))
533 ("rust-ws2_32-sys"
534 ,(origin
535 (method url-fetch)
536 (uri (crate-uri "ws2_32-sys" "0.2.1"))
537 (sha256
538 (base32
539 "0ppscg5qfqaw0gzwv2a4nhn5bn01ff9iwn6ysqnzm4n8s3myz76m"))))
540 ("rust-user32-sys"
541 ,(origin
542 (method url-fetch)
543 (uri (crate-uri "user32-sys" "0.2.0"))
544 (sha256
545 (base32
546 "0ivxc7hmsxax9crdhxdd1nqwik4s9lhb2x59lc8b88bv20fp3x2f"))))
547 ("rust-unicode-bidi"
548 ,(origin
549 (method url-fetch)
550 (uri (crate-uri "unicode-bidi" "0.2.3"))
551 (sha256
552 (base32
553 "0gqbyf6slkgzr14nf6v8dw8a19l5snh6bpms8bpfvzpxdawwxxy1"))))
554 ("rust-net2"
555 ,(origin
556 (method url-fetch)
557 (uri (crate-uri "net2" "0.2.26"))
558 (sha256
559 (base32
560 "1qp3q6xynb481rsp3ig1nmqb6qlxfba3shfrmqij88cppsv9rpsy"))))
561 ("rust-utf8-ranges"
562 ,(origin
563 (method url-fetch)
564 (uri (crate-uri "utf8-ranges" "0.1.3"))
565 (sha256
566 (base32
567 "03xf604b2v51ag3jgzw92l97xnb10kw9zv948bhc7ja1ik017jm1"))))
568 ("rust-crossbeam"
569 ,(origin
570 (method url-fetch)
571 (uri (crate-uri "crossbeam" "0.2.10"))
572 (sha256
573 (base32
574 "15wga0kvk3iqf3l077957j931brf1pl3p74xibd698jccqas4phc"))))
575 ("rust-toml"
576 ,(origin
577 (method url-fetch)
578 (uri (crate-uri "toml" "0.2.1"))
579 (sha256
580 (base32
581 "1d1cz43bxrx4fd6j2p6myckf81f72bp47akg36y3flxjkhj60svk"))))
582 ("rust-aho-corasick"
583 ,(origin
584 (method url-fetch)
585 (uri (crate-uri "aho-corasick" "0.5.3"))
586 (sha256
587 (base32
588 "0rnvdmlajikq0i4zdy1p3pv699q6apvsxfc7av7byhppllp2r5ya"))))
589 ("rust-psapi-sys"
590 ,(origin
591 (method url-fetch)
592 (uri (crate-uri "psapi-sys" "0.1.0"))
593 (sha256
594 (base32
595 "0y14g8qshsfnmb7nk2gs1rpbrs1wrggajmzp4yby4q6k0wd5vkdb"))))
596 ("rust-idna"
597 ,(origin
598 (method url-fetch)
599 (uri (crate-uri "idna" "0.1.0"))
600 (sha256
601 (base32
602 "049c2rmlydrrrgrxdaq2v21adx9vkfh6k9x4xj56ckyf01p26lqh"))))
603 ("rust-url"
604 ,(origin
605 (method url-fetch)
606 (uri (crate-uri "url" "1.2.3"))
607 (sha256
608 (base32
609 "1myr1i8djbl2bhvvrm6n3h7bj7sl6kh5dmaaz2f7c6x8hyyzgk28"))))
610 ("rust-regex-syntax"
611 ,(origin
612 (method url-fetch)
613 (uri (crate-uri "regex-syntax" "0.3.9"))
614 (sha256
615 (base32
616 "0ms9hgdhhsxw9w920i7gipydvagf100bb56jbs192rz86ln01v7r"))))
617 ("rust-kernel32-sys"
618 ,(origin
619 (method url-fetch)
620 (uri (crate-uri "kernel32-sys" "0.2.2"))
621 (sha256
622 (base32
623 "1389av0601a9yz8dvx5zha9vmkd6ik7ax0idpb032d28555n41vm"))))
624 ("rust-term"
625 ,(origin
626 (method url-fetch)
627 (uri (crate-uri "term" "0.4.4"))
628 (sha256
629 (base32
630 "0jpr7jb1xidadh0arklwr99r8w1k1dfc4an3ginpsq5nnfigivrx"))))
631 ("rust-thread-id"
632 ,(origin
633 (method url-fetch)
634 (uri (crate-uri "thread-id" "2.0.0"))
635 (sha256
636 (base32
637 "00zzs2bx1xw8aqm5plqqgr7bc2zz6zkqrdxq8vpiqb8hc2srslx9"))))
638 ("rust-thread_local"
639 ,(origin
640 (method url-fetch)
641 (uri (crate-uri "thread_local" "0.2.7"))
642 (sha256
643 (base32
644 "1mgxikqvhpsic6xk7pan95lvgsky1sdxzw2w5m2l35pgrazxnxl5"))))
645 ("rust-miow"
646 ,(origin
647 (method url-fetch)
648 (uri (crate-uri "miow" "0.1.3"))
649 (sha256
650 (base32
651 "16jvfjsp6fr4mbd2sw5hcdmi4dsa0m0aa45gjz78mb1h4mwcdgym"))))
652 ("rust-regex"
653 ,(origin
654 (method url-fetch)
655 (uri (crate-uri "regex" "0.1.80"))
656 (sha256
657 (base32
658 "0bs036h3vzc6pj5jj4vc909s9rppq7b808ic99qn0y6gm3karm2g"))))
659 ("rust-num_cpus"
660 ,(origin
661 (method url-fetch)
662 (uri (crate-uri "num_cpus" "1.1.0"))
663 (sha256
664 (base32
665 "1bfwcn3yhwa31rinjw9yr7b6gvn6c06hnwnjz06pvm938w4fd448"))))
666 ("rust-libgit2-sys"
667 ,(origin
668 (method url-fetch)
9ea0cdaf 669 (uri (crate-uri "libgit2-sys" "0.6.6"))
893bc3f4
DM
670 (sha256
671 (base32
9ea0cdaf 672 "074h9q4p60xh6canb0sj4vrc801wqv6p53l9lp0q724bkwzf7967"))))
893bc3f4
DM
673 ("rust-env_logger"
674 ,(origin
675 (method url-fetch)
676 (uri (crate-uri "env_logger" "0.3.5"))
677 (sha256
678 (base32
679 "0bvcjgkw4s3k1rd7glpflgc8s9a393zjd6jfdgvs8gjvwj0dgaqm"))))
680 ("rust-openssl-probe"
681 ,(origin
682 (method url-fetch)
683 (uri (crate-uri "openssl-probe" "0.1.0"))
684 (sha256
685 (base32
686 "0689h6rhzy6dypqr90lsxnf108nsnh952wsx7ggs70s48b44jvbm"))))
687 ("rust-lazy_static"
688 ,(origin
689 (method url-fetch)
690 (uri (crate-uri "lazy_static" "0.2.2"))
691 (sha256
692 (base32
693 "16z1h7w702sxnscak38jykxlhxq0b5ip4mndlb46pkaqwzi0xgka"))))
694 ("rust-semver-parser"
695 ,(origin
696 (method url-fetch)
697 (uri (crate-uri "semver-parser" "0.6.1"))
698 (sha256
699 (base32
700 "1s8s7a7yg8xhgci17y0xhyyncg229byivhpr0wbs3ljdlyjl73p8"))))
701 ("rust-semver"
702 ,(origin
703 (method url-fetch)
704 (uri (crate-uri "semver" "0.5.1"))
705 (sha256
706 (base32
707 "1xbiv8l72rmngb3lgbmk3vd4lalcbzxcnrn085c2b75irl7gcbxf"))))
708 ("rust-docopt"
709 ,(origin
710 (method url-fetch)
711 (uri (crate-uri "docopt" "0.6.86"))
712 (sha256
713 (base32
714 "1nf4f4zf5yk0d0l4kl7hkii4na22fhn0l2hgfb46yzv08l2g6zja"))))
715 ("rust-miniz-sys"
716 ,(origin
717 (method url-fetch)
718 (uri (crate-uri "miniz-sys" "0.1.7"))
719 (sha256
720 (base32
721 "0m7dlggsxash0k5jkx576p556g9r8vnhyl9244gjxhq1g8rls7wx"))))
722 ("rust-curl"
723 ,(origin
724 (method url-fetch)
725 (uri (crate-uri "curl" "0.4.1"))
726 (sha256
727 (base32
728 "1b0y27b6vpqffgzm2kxc1s2i6bgdzxk3wn65g2asbcdxrvys3mcg"))))
729 ("rust-flate2"
730 ,(origin
731 (method url-fetch)
732 (uri (crate-uri "flate2" "0.2.14"))
733 (sha256
734 (base32
735 "1fx3zsls5bb1zfx87s5sxkgk853z4nhjsbvq5s6if13kjlg4isry"))))
736 ("rust-git2"
737 ,(origin
738 (method url-fetch)
739 (uri (crate-uri "git2" "0.6.3"))
740 (sha256
741 (base32
742 "06b1bw3pwszs8617xn8js6h0j983qjgfwsychw33lshccj3cld05"))))
743 ("rust-crates-io"
744 ,(origin
745 (method url-fetch)
746 (uri (crate-uri "crates-io" "0.4.0"))
747 (sha256
748 (base32
749 "0kk6abp1qbpv44hkq1yjp7xgpzjzafs83i1l26ycr0aph1gbwig9"))))
750 ("rust-git2-curl"
751 ,(origin
752 (method url-fetch)
753 (uri (crate-uri "git2-curl" "0.7.0"))
754 (sha256
755 (base32
756 "13mzqp4rd81zp78261rlq23iw9aaysdr56484y1yy2xzhk3nnrv8"))))
757 ("rust-bufstream"
758 ,(origin
759 (method url-fetch)
760 (uri (crate-uri "bufstream" "0.1.2"))
761 (sha256
762 (base32
763 "0x6h27md1fwabbhbycfldj0wklrpjr520z9p0cpzm60fzzidnj3v"))))
764 ("rust-hamcrest"
765 ,(origin
766 (method url-fetch)
767 (uri (crate-uri "hamcrest" "0.1.1"))
768 (sha256
769 (base32
770 "1m49rf7bnkx0qxja56slrjh44zi4z5bjz5x4pblqjw265828y25z"))))
771 ("rust-num"
772 ,(origin
773 (method url-fetch)
774 (uri (crate-uri "num" "0.1.36"))
775 (sha256
776 (base32
777 "081i1r3mdz6jasqd7qwraqqfqa3sdpvdvxl1xq0s7ip714xw1rxx"))))
778 ("rust-num-traits"
779 ,(origin
780 (method url-fetch)
781 (uri (crate-uri "num-traits" "0.1.36"))
782 (sha256
783 (base32
784 "07688sp4z40p14lh5ywvrpm4zq8kcxzhjks8sg33jsr5da2l4sm1"))))
785 ("rust-num-integer"
786 ,(origin
787 (method url-fetch)
788 (uri (crate-uri "num-integer" "0.1.32"))
789 (sha256
790 (base32
791 "14pvaaawl0pgdcgh4dfdd67lz58yxlfl95bry86h28pjnfzxj97v"))))
792 ("rust-num-bigint"
793 ,(origin
794 (method url-fetch)
795 (uri (crate-uri "num-bigint" "0.1.35"))
796 (sha256
797 (base32
798 "0jayfkdm33p4zvcahlv46zdfhlzg053mpw32abf2lz0z8xw47cc8"))))
799 ("rust-num-rational"
800 ,(origin
801 (method url-fetch)
802 (uri (crate-uri "num-rational" "0.1.35"))
803 (sha256
804 (base32
805 "1bwaygv64qg7i78yqg0v4d0amfhamj598rpy4yxjz9rlhcxn1zsl"))))
806 ("rust-num-iter"
807 ,(origin
808 (method url-fetch)
809 (uri (crate-uri "num-iter" "0.1.32"))
810 (sha256
811 (base32
812 "0p74nj5c1mc33h9lx4wpmlmggmn5lnkhxv1225g0aix8d6ciqyi8"))))
813 ("rust-num-complex"
814 ,(origin
815 (method url-fetch)
816 (uri (crate-uri "num-complex" "0.1.35"))
817 (sha256
818 (base32
9ea0cdaf
DM
819 "0bzrjfppnnzf9vmkpklhp2dw9sb1lqzydb8r6k83z76i9l2qxizh"))))
820 ("rust-shell-escape"
821 ,(origin
822 (method url-fetch)
823 (uri (crate-uri "shell-escape" "0.1.3"))
824 (sha256
825 (base32
826 "1y2fp2brv639icv4a0fdqs1zhlrxq8qbz27ygfa86ifmh5jcjp6x"))))))
b5a09649
DC
827 (arguments
828 `(#:cargo ,cargo-bootstrap
829 #:tests? #f ; FIXME
f0eb0a4b
DM
830 #:modules
831 ((ice-9 match)
832 (srfi srfi-1) ; 'every
833 (guix build utils)
834 (guix build cargo-build-system))
b5a09649
DC
835 #:phases
836 (modify-phases %standard-phases
837 ;; Avoid cargo complaining about missmatched checksums.
838 (delete 'patch-source-shebangs)
839 (delete 'patch-generated-file-shebangs)
840 (delete 'patch-usr-bin-file)
893bc3f4
DM
841 (add-after 'unpack 'unpack-submodule-sources
842 (lambda* (#:key inputs #:allow-other-keys)
f0eb0a4b
DM
843 (define (unpack source target)
844 (mkdir-p target)
845 (with-directory-excursion target
846 (zero? (system* "tar" "xf"
847 source
848 "--strip-components=1"))))
849 (define (touch file-name)
850 (call-with-output-file file-name (const #t)))
851 (define (install-rust-library entry)
852 (match entry
853 ((name . src)
854 (if (string-prefix? "rust-" name)
855 (let* ((rust-length (string-length "rust-"))
856 (rust-name (string-drop name
857 rust-length))
858 (rsrc (string-append "vendor/"
859 rust-name))
860 (unpack-status (unpack src rsrc)))
861 (touch (string-append rsrc "/.cargo-ok"))
862 (generate-checksums rsrc src)
863 unpack-status)))
864 (_ #t)))
893bc3f4 865 (mkdir "vendor")
f0eb0a4b
DM
866 (every install-rust-library inputs)))
867 (add-after 'unpack 'set-environment-up
b5a09649
DC
868 (lambda* (#:key inputs #:allow-other-keys)
869 (let* ((gcc (assoc-ref inputs "gcc"))
870 (cc (string-append gcc "/bin/gcc")))
f0eb0a4b
DM
871 (mkdir ".cargo")
872 (call-with-output-file ".cargo/config"
893bc3f4
DM
873 (lambda (p)
874 (format p "
875[source.crates-io]
876registry = 'https://github.com/rust-lang/crates.io-index'
877replace-with = 'vendored-sources'
878
879[source.vendored-sources]
880directory = 'vendor'
881")))
b5a09649
DC
882 (setenv "CMAKE_C_COMPILER" cc)
883 (setenv "CC" cc))
f0eb0a4b
DM
884 #t))
885 (delete 'configure))))
b5a09649
DC
886 (home-page "https://github.com/rust-lang/cargo")
887 (synopsis "Build tool and package manager for Rust")
888 (description "Cargo is a tool that allows Rust projects to declare their
889dependencies and ensures a reproducible build.")
890 ;; Cargo is dual licensed Apache and MIT. Also contains
891 ;; code from openssl which is GPL2 with linking exception.
892 (license (list license:asl2.0 license:expat license:gpl2))))