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