1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2016 David Craven <david@craven.ch>
3 ;;; Copyright © 2016 Eric Le Bihan <eric.le.bihan.dev@free.fr>
4 ;;; Copyright © 2016 ng0 <ng0@libertad.pw>
5 ;;; Copyright © 2017 Ben Woodcroft <donttrustben@gmail.com>
7 ;;; This file is part of GNU Guix.
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.
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.
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/>.
22 (define-module (gnu packages rust)
23 #:use-module (gnu packages base)
24 #:use-module (gnu packages bootstrap)
25 #:use-module (gnu packages cmake)
26 #:use-module (gnu packages compression)
27 #:use-module (gnu packages curl)
28 #:use-module (gnu packages elf)
29 #:use-module (gnu packages gcc)
30 #:use-module (gnu packages jemalloc)
31 #:use-module (gnu packages llvm)
32 #:use-module (gnu packages pkg-config)
33 #:use-module (gnu packages python)
34 #:use-module (gnu packages ssh)
35 #:use-module (gnu packages tls)
36 #:use-module (gnu packages version-control)
37 #:use-module (guix build-system cargo)
38 #:use-module (guix build-system gnu)
39 #:use-module (guix build-system trivial)
40 #:use-module (guix download)
41 #:use-module ((guix licenses) #:prefix license:)
42 #:use-module (guix packages)
43 #:use-module (ice-9 match)
44 #:use-module (srfi srfi-26))
46 ;; Should be one less than the current released version.
47 (define %rust-bootstrap-binaries-version "1.14.0")
49 (define %rust-bootstrap-binaries
53 "https://static.rust-lang.org/dist/"
54 "rust-" %rust-bootstrap-binaries-version
55 "-i686-unknown-linux-gnu.tar.gz"))
58 "0h384prpabcl08mxs1bilyb0dbk0knpdylcnz4b84ij4idr7ap4d"))))
60 (define (increment-rust-version rust-version major patch)
61 (match (string-split rust-version #\.)
63 (string-append (number->string major) "."
64 (number->string (+ (string->number minor) 1)) "."
65 (number->string patch)))))
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))
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))
78 (define rustc-bootstrap
80 (name "rustc-bootstrap")
81 (version %rust-bootstrap-binaries-version)
82 (source %rust-bootstrap-binaries)
83 (build-system gnu-build-system)
85 `(("patchelf" ,patchelf)))
87 `(("gcc:lib" ,(canonical-package gcc) "lib")
94 (modify-phases %standard-phases
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)))
126 (define cargo-bootstrap
128 (name "cargo-bootstrap")
129 (version (cargo-version %rust-bootstrap-binaries-version))
130 (source %rust-bootstrap-binaries)
131 (build-system gnu-build-system)
133 `(("patchelf" ,patchelf)))
135 `(("gcc:lib" ,(canonical-package gcc) "lib")))
139 #:system "i686-linux"
141 (modify-phases %standard-phases
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:"
153 (cargo (string-append out "/bin/cargo")))
154 (system* "bash" "install.sh"
155 (string-append "--prefix=" out)
156 "--components=cargo")
158 "--set-interpreter" ld-so
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)))
168 (define rust-bootstrap
170 (name "rust-bootstrap")
171 (version %rust-bootstrap-binaries-version)
173 (build-system trivial-build-system)
175 `(("rustc-bootstrap" ,rustc-bootstrap)
176 ("cargo-bootstrap" ,cargo-bootstrap)
177 ("gcc" ,(canonical-package gcc))))
179 `(#:modules ((guix build utils))
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
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)))
200 (version (rustc-version %rust-bootstrap-binaries-version))
204 "https://static.rust-lang.org/dist/"
205 "rustc-" version "-src.tar.gz"))
208 "0wvn8m1nfg664b95qrdpfh72q1a6ir09rqkrnlzbkay2r7xf8mgn"))))
209 (build-system gnu-build-system)
213 ("python-2" ,python-2)
214 ("rust-bootstrap" ,rust-bootstrap)
217 `(("jemalloc" ,jemalloc)
220 ;; FIXME: Test failure with llvm 3.8; Update llvm.
221 ;; https://github.com/rust-lang/rust/issues/36835
224 (modify-phases %standard-phases
225 (add-after 'unpack 'patch-configure
227 (substitute* "configure"
228 (("/usr/bin/env") (which "env")) ; Detect target CPU correctly.
229 (("probe_need CFG_CURL curl") "")) ; Avoid curl as a build dependency.
231 (add-after 'unpack 'set-env
233 (setenv "SHELL" (which "sh"))
234 (setenv "CONFIG_SHELL" (which "sh"))
236 (add-after 'unpack 'patch-tests
237 (lambda* (#:key inputs #:allow-other-keys)
238 (let ((bash (assoc-ref inputs "bash")))
239 (substitute* "src/tools/tidy/src/main.rs"
240 (("^.*cargo.*::check.*$") ""))
241 (substitute* "src/libstd/process.rs"
242 (("\"/bin/sh\"") (string-append "\"" bash "/bin/sh\"")))
245 (lambda* (#:key inputs outputs #:allow-other-keys)
246 (let* ((out (assoc-ref outputs "out"))
247 (gcc (assoc-ref inputs "gcc"))
248 (binutils (assoc-ref inputs "binutils"))
249 (python (assoc-ref inputs "python-2"))
250 (rustc (assoc-ref inputs "rustc-bootstrap"))
251 (llvm (assoc-ref inputs "llvm"))
252 (jemalloc (assoc-ref inputs "jemalloc"))
254 (string-append "--prefix=" out)
255 (string-append "--datadir=" out "/share")
256 (string-append "--infodir=" out "/share/info")
257 (string-append "--default-linker=" gcc "/bin/gcc")
258 (string-append "--default-ar=" binutils "/bin/ar")
259 (string-append "--python=" python "/bin/python2")
260 (string-append "--local-rust-root=" rustc)
261 (string-append "--llvm-root=" llvm)
262 (string-append "--jemalloc-root=" jemalloc "/lib")
263 "--release-channel=stable"
265 "--enable-local-rust"
266 "--disable-rustbuild" ; use Makefiles
267 "--disable-manage-submodules")))
268 ;; Rust uses a custom configure script (no autoconf).
269 (zero? (apply system* "./configure" flags)))))
270 (add-after 'install 'wrap-rustc
271 (lambda* (#:key inputs outputs #:allow-other-keys)
272 (let ((out (assoc-ref outputs "out"))
273 (libc (assoc-ref inputs "libc"))
274 (ld-wrapper (assoc-ref inputs "ld-wrapper")))
275 ;; Let gcc find ld and libc startup files.
276 (wrap-program (string-append out "/bin/rustc")
277 `("PATH" ":" prefix (,(string-append ld-wrapper "/bin")))
278 `("LIBRARY_PATH" ":" suffix (,(string-append libc "/lib"))))
280 ;; rustc invokes gcc, so we need to set its search paths accordingly.
281 (native-search-paths (package-native-search-paths gcc))
282 (synopsis "Compiler for the Rust progamming language")
283 (description "Rust is a systems programming language that provides memory
284 safety and thread safety guarantees.")
285 (home-page "https://www.rust-lang.org")
287 (license (list license:asl2.0 license:expat))))
292 (version (cargo-version (rustc-version %rust-bootstrap-binaries-version)))
295 (uri (string-append "https://github.com/rust-lang/cargo/archive/"
297 (file-name (string-append name "-" version ".tar.gz"))
300 "194i06y9nql0p93gahh0vm4qwv6c1kpd9rprpf22w5gav9lpcyjz"))))
301 (build-system cargo-build-system)
304 ("pkg-config" ,pkg-config)))
310 ("python-2" ,python-2)
316 (uri (crate-uri "openssl" "0.9.1"))
319 "1m2mhiar87qnw4gxci286q9g85ljafbc41salbj2hmcgh8aagchy"))))
323 (uri (crate-uri "strsim" "0.5.1"))
326 "0bj4fsm1l2yqbfpspyvjf9m3m50pskapcddzm0ji9c74jbgnkh2h"))))
330 (uri (crate-uri "libc" "0.2.18"))
333 "0w5cghr0wx3hi2sclk8r9iyzlbxsakil87ada40q2ykyhky24655"))))
337 (uri (crate-uri "bitflags" "0.7.0"))
340 "0v8hh6wdkpk9my8z8442g4hqrqf05h0qj53dsay6mv18lqvqklda"))))
341 ("rust-unicode-normalization"
344 (uri (crate-uri "unicode-normalization" "0.1.2"))
347 "0whi4xxqcjfsz6ywyrfd5lhgk1a44c86qwgvfqcmzidshcpklr16"))))
351 (uri (crate-uri "rand" "0.3.14"))
354 "1984zvj8572ig28fz6idc4r96fx39h4lzmr07yf7kb7gdn6di497"))))
358 (uri (crate-uri "gcc" "0.3.39"))
361 "1q0idjvmhp6shkb9hqabh51rgfr8dqpi1xfmyzq7q8vgzybll7kp"))))
365 (uri (crate-uri "tempdir" "0.3.5"))
368 "1mij45kgzflkja0h8q9avrik76h5a0b60m9hfd6k9yqxbiplm5w7"))))
372 (uri (crate-uri "memchr" "0.1.11"))
375 "084d85hjfa3xf5kwdms2mhbkh78m1gl2254cp5swcxj3a7xjkdnq"))))
376 ("rust-rustc-serialize"
379 (uri (crate-uri "rustc-serialize" "0.3.21"))
382 "064qmyr2508qf78dwcpiv25rfjp9h9vd0wrj4mmwgppjg4fgrydz"))))
386 (uri (crate-uri "cmake" "0.1.19"))
389 "0am8c8ns1h6b1a5x9z2r1m3rszvya5nccl2pzszzjv5aiiaydgcf"))))
393 (uri (crate-uri "matches" "0.1.4"))
396 "1c8190j84hbicy8jwscw5icfam12j6lcxi02lvmadq9260p65mzg"))))
400 (uri (crate-uri "winapi" "0.2.8"))
403 "0yh816lh6lf56dpsgxy189c2ai1z3j8mw9si6izqb6wsjkbcjz8n"))))
407 (uri (crate-uri "pkg-config" "0.3.8"))
410 "1ypj4nj2z9z27qg06v3g40jyhw685i3l2wi098d21bvyri781vlc"))))
414 (uri (crate-uri "libssh2-sys" "0.2.4"))
417 "1pmmh0hcx14856wg9bp740yf618qfl2765vhf67sfs5lmf39227d"))))
421 (uri (crate-uri "libz-sys" "1.0.10"))
424 "1rl85x045sk5d345hgcahx99plpbdg2a3bx5vjfxig30qah74p4h"))))
428 (uri (crate-uri "curl-sys" "0.3.6"))
431 "0fi8kjz3f8m8vfazycs3ddm0h6j3x78hw78gwbvybx71129192i1"))))
435 (uri (crate-uri "openssl-sys" "0.9.1"))
438 "1sdhgalfm2zdqf144xhdnxdha7ifjgsfbmlrqbx0j9f3mh4gpscm"))))
442 (uri (crate-uri "fs2" "0.3.0"))
445 "0lg57mgcm1r0m8jm4nqpcrl6lmxg8lj854k2h0r7qp46pphh2034"))))
449 (uri (crate-uri "log" "0.3.6"))
452 "0m40hgs3cg57dd5kk1mabfk6gk8z6l1cihar8akx4kmzz1xlk0xb"))))
456 (uri (crate-uri "filetime" "0.1.10"))
459 "08p9scgv30i1141cnp5xi4pqlnkfci455nrpca55df1r867anqsk"))))
463 (uri (crate-uri "tar" "0.4.9"))
466 "1vi3nl8s3jjf5l20ni47gmh1p4bdjfh7q50fbg7izzqrf7i4i40c"))))
470 (uri (crate-uri "glob" "0.2.11"))
473 "1ysvi72slkw784fcsymgj4308c3y03gwjjzqxp80xdjnkbh8vqcb"))))
477 (uri (crate-uri "cfg-if" "0.1.0"))
480 "137qikjcal4h75frzcn6mknygqk8vy5bva7w851aydb5gc6pc7ny"))))
484 (uri (crate-uri "winapi-build" "0.1.1"))
487 "1g4rqsgjky0a7530qajn2bbfcrl2v0zb39idgdws9b1l7gp5wc9d"))))
491 (uri (crate-uri "advapi32-sys" "0.2.0"))
494 "16largvlrd1800vvdchml0ngnszjlnpqm01rcz5hm7di1h48hrg0"))))
498 (uri (crate-uri "gdi32-sys" "0.2.0"))
501 "0605d4ngjsspghwjv4jicajich1gnl0aik9f880ajjzjixd524h9"))))
505 (uri (crate-uri "ws2_32-sys" "0.2.1"))
508 "0ppscg5qfqaw0gzwv2a4nhn5bn01ff9iwn6ysqnzm4n8s3myz76m"))))
512 (uri (crate-uri "user32-sys" "0.2.0"))
515 "0ivxc7hmsxax9crdhxdd1nqwik4s9lhb2x59lc8b88bv20fp3x2f"))))
519 (uri (crate-uri "unicode-bidi" "0.2.3"))
522 "0gqbyf6slkgzr14nf6v8dw8a19l5snh6bpms8bpfvzpxdawwxxy1"))))
526 (uri (crate-uri "net2" "0.2.26"))
529 "1qp3q6xynb481rsp3ig1nmqb6qlxfba3shfrmqij88cppsv9rpsy"))))
533 (uri (crate-uri "utf8-ranges" "0.1.3"))
536 "03xf604b2v51ag3jgzw92l97xnb10kw9zv948bhc7ja1ik017jm1"))))
540 (uri (crate-uri "crossbeam" "0.2.10"))
543 "15wga0kvk3iqf3l077957j931brf1pl3p74xibd698jccqas4phc"))))
547 (uri (crate-uri "toml" "0.2.1"))
550 "1d1cz43bxrx4fd6j2p6myckf81f72bp47akg36y3flxjkhj60svk"))))
554 (uri (crate-uri "aho-corasick" "0.5.3"))
557 "0rnvdmlajikq0i4zdy1p3pv699q6apvsxfc7av7byhppllp2r5ya"))))
561 (uri (crate-uri "psapi-sys" "0.1.0"))
564 "0y14g8qshsfnmb7nk2gs1rpbrs1wrggajmzp4yby4q6k0wd5vkdb"))))
568 (uri (crate-uri "idna" "0.1.0"))
571 "049c2rmlydrrrgrxdaq2v21adx9vkfh6k9x4xj56ckyf01p26lqh"))))
575 (uri (crate-uri "url" "1.2.3"))
578 "1myr1i8djbl2bhvvrm6n3h7bj7sl6kh5dmaaz2f7c6x8hyyzgk28"))))
582 (uri (crate-uri "regex-syntax" "0.3.9"))
585 "0ms9hgdhhsxw9w920i7gipydvagf100bb56jbs192rz86ln01v7r"))))
589 (uri (crate-uri "kernel32-sys" "0.2.2"))
592 "1389av0601a9yz8dvx5zha9vmkd6ik7ax0idpb032d28555n41vm"))))
596 (uri (crate-uri "term" "0.4.4"))
599 "0jpr7jb1xidadh0arklwr99r8w1k1dfc4an3ginpsq5nnfigivrx"))))
603 (uri (crate-uri "thread-id" "2.0.0"))
606 "00zzs2bx1xw8aqm5plqqgr7bc2zz6zkqrdxq8vpiqb8hc2srslx9"))))
610 (uri (crate-uri "thread_local" "0.2.7"))
613 "1mgxikqvhpsic6xk7pan95lvgsky1sdxzw2w5m2l35pgrazxnxl5"))))
617 (uri (crate-uri "miow" "0.1.3"))
620 "16jvfjsp6fr4mbd2sw5hcdmi4dsa0m0aa45gjz78mb1h4mwcdgym"))))
624 (uri (crate-uri "regex" "0.1.80"))
627 "0bs036h3vzc6pj5jj4vc909s9rppq7b808ic99qn0y6gm3karm2g"))))
631 (uri (crate-uri "num_cpus" "1.1.0"))
634 "1bfwcn3yhwa31rinjw9yr7b6gvn6c06hnwnjz06pvm938w4fd448"))))
638 (uri (crate-uri "libgit2-sys" "0.6.5"))
641 "0yl80n12ih4jh1halpbj3zqlqvw5zxdr6m6xdcvdz67svjy50bjh"))))
645 (uri (crate-uri "env_logger" "0.3.5"))
648 "0bvcjgkw4s3k1rd7glpflgc8s9a393zjd6jfdgvs8gjvwj0dgaqm"))))
649 ("rust-openssl-probe"
652 (uri (crate-uri "openssl-probe" "0.1.0"))
655 "0689h6rhzy6dypqr90lsxnf108nsnh952wsx7ggs70s48b44jvbm"))))
659 (uri (crate-uri "lazy_static" "0.2.2"))
662 "16z1h7w702sxnscak38jykxlhxq0b5ip4mndlb46pkaqwzi0xgka"))))
663 ("rust-semver-parser"
666 (uri (crate-uri "semver-parser" "0.6.1"))
669 "1s8s7a7yg8xhgci17y0xhyyncg229byivhpr0wbs3ljdlyjl73p8"))))
673 (uri (crate-uri "semver" "0.5.1"))
676 "1xbiv8l72rmngb3lgbmk3vd4lalcbzxcnrn085c2b75irl7gcbxf"))))
680 (uri (crate-uri "docopt" "0.6.86"))
683 "1nf4f4zf5yk0d0l4kl7hkii4na22fhn0l2hgfb46yzv08l2g6zja"))))
687 (uri (crate-uri "miniz-sys" "0.1.7"))
690 "0m7dlggsxash0k5jkx576p556g9r8vnhyl9244gjxhq1g8rls7wx"))))
694 (uri (crate-uri "curl" "0.4.1"))
697 "1b0y27b6vpqffgzm2kxc1s2i6bgdzxk3wn65g2asbcdxrvys3mcg"))))
701 (uri (crate-uri "flate2" "0.2.14"))
704 "1fx3zsls5bb1zfx87s5sxkgk853z4nhjsbvq5s6if13kjlg4isry"))))
708 (uri (crate-uri "git2" "0.6.3"))
711 "06b1bw3pwszs8617xn8js6h0j983qjgfwsychw33lshccj3cld05"))))
715 (uri (crate-uri "crates-io" "0.4.0"))
718 "0kk6abp1qbpv44hkq1yjp7xgpzjzafs83i1l26ycr0aph1gbwig9"))))
722 (uri (crate-uri "git2-curl" "0.7.0"))
725 "13mzqp4rd81zp78261rlq23iw9aaysdr56484y1yy2xzhk3nnrv8"))))
729 (uri (crate-uri "bufstream" "0.1.2"))
732 "0x6h27md1fwabbhbycfldj0wklrpjr520z9p0cpzm60fzzidnj3v"))))
736 (uri (crate-uri "hamcrest" "0.1.1"))
739 "1m49rf7bnkx0qxja56slrjh44zi4z5bjz5x4pblqjw265828y25z"))))
743 (uri (crate-uri "num" "0.1.36"))
746 "081i1r3mdz6jasqd7qwraqqfqa3sdpvdvxl1xq0s7ip714xw1rxx"))))
750 (uri (crate-uri "num-traits" "0.1.36"))
753 "07688sp4z40p14lh5ywvrpm4zq8kcxzhjks8sg33jsr5da2l4sm1"))))
757 (uri (crate-uri "num-integer" "0.1.32"))
760 "14pvaaawl0pgdcgh4dfdd67lz58yxlfl95bry86h28pjnfzxj97v"))))
764 (uri (crate-uri "num-bigint" "0.1.35"))
767 "0jayfkdm33p4zvcahlv46zdfhlzg053mpw32abf2lz0z8xw47cc8"))))
771 (uri (crate-uri "num-rational" "0.1.35"))
774 "1bwaygv64qg7i78yqg0v4d0amfhamj598rpy4yxjz9rlhcxn1zsl"))))
778 (uri (crate-uri "num-iter" "0.1.32"))
781 "0p74nj5c1mc33h9lx4wpmlmggmn5lnkhxv1225g0aix8d6ciqyi8"))))
785 (uri (crate-uri "num-complex" "0.1.35"))
788 "0bzrjfppnnzf9vmkpklhp2dw9sb1lqzydb8r6k83z76i9l2qxizh"))))))
790 `(#:cargo ,cargo-bootstrap
793 (modify-phases %standard-phases
794 ;; Avoid cargo complaining about missmatched checksums.
795 (delete 'patch-source-shebangs)
796 (delete 'patch-generated-file-shebangs)
797 (delete 'patch-usr-bin-file)
798 (add-after 'unpack 'unpack-submodule-sources
799 (lambda* (#:key inputs #:allow-other-keys)
800 (let ((unpack (lambda (source target)
802 (with-directory-excursion target
803 (zero? (system* "tar" "xf"
805 "--strip-components=1"))))))
807 (for-each (lambda (p)
808 (let ((name (car p)))
809 (if (string-prefix? "rust-" name)
810 (let ((rsrc (string-append "vendor/"
812 (string-length "rust-")))))
813 (unpack (assoc-ref inputs name) rsrc)
814 (system* "touch" (string-append rsrc "/.cargo-ok"))
815 (generate-checksums rsrc (assoc-ref inputs name)))))) inputs))))
816 ;; Set CARGO_HOME to use the vendored dependencies.
817 (add-after 'unpack 'set-cargo-home
818 (lambda* (#:key inputs #:allow-other-keys)
819 (let* ((gcc (assoc-ref inputs "gcc"))
820 (cc (string-append gcc "/bin/gcc")))
822 (setenv "CARGO_HOME" (string-append (getcwd) "/cargohome"))
823 (call-with-output-file "cargohome/config"
827 registry = 'https://github.com/rust-lang/crates.io-index'
828 replace-with = 'vendored-sources'
830 [source.vendored-sources]
833 (setenv "CMAKE_C_COMPILER" cc)
836 (home-page "https://github.com/rust-lang/cargo")
837 (synopsis "Build tool and package manager for Rust")
838 (description "Cargo is a tool that allows Rust projects to declare their
839 dependencies and ensures a reproducible build.")
840 ;; Cargo is dual licensed Apache and MIT. Also contains
841 ;; code from openssl which is GPL2 with linking exception.
842 (license (list license:asl2.0 license:expat license:gpl2))))