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