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