dev-util/cargo: version bump to 0.16.0
[gentoo.git] / dev-util / cargo / cargo-0.13.0-r1.ebuild
1 # Copyright 1999-2016 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Id$
4
5 EAPI=6
6
7 CARGO_SNAPSHOT_DATE="2016-09-01"
8 CRATES="
9 advapi32-sys-0.2.0
10 aho-corasick-0.5.2
11 bitflags-0.1.1
12 bitflags-0.7.0
13 bufstream-0.1.2
14 cargo-0.13.0
15 cargotest-0.1.0
16 cfg-if-0.1.0
17 cmake-0.1.17
18 crates-io-0.4.0
19 crossbeam-0.2.9
20 curl-0.3.2
21 curl-sys-0.2.1
22 docopt-0.6.82
23 env_logger-0.3.4
24 filetime-0.1.10
25 flate2-0.2.14
26 fs2-0.2.5
27 gcc-0.3.32
28 gdi32-sys-0.2.0
29 git2-0.4.4
30 git2-curl-0.5.0
31 glob-0.2.11
32 hamcrest-0.1.0
33 idna-0.1.0
34 kernel32-sys-0.2.2
35 lazy_static-0.2.1
36 libc-0.2.15
37 libgit2-sys-0.4.5
38 libressl-pnacl-sys-2.1.6
39 libssh2-sys-0.1.38
40 libz-sys-1.0.5
41 log-0.3.6
42 matches-0.1.2
43 memchr-0.1.11
44 miniz-sys-0.1.7
45 miow-0.1.3
46 net2-0.2.26
47 nom-1.2.4
48 num-0.1.34
49 num-bigint-0.1.33
50 num-complex-0.1.33
51 num-integer-0.1.32
52 num-iter-0.1.32
53 num-rational-0.1.32
54 num-traits-0.1.34
55 num_cpus-1.0.0
56 openssl-0.7.14
57 openssl-sys-0.7.14
58 openssl-sys-extras-0.7.14
59 pkg-config-0.3.8
60 pnacl-build-helper-1.4.10
61 rand-0.3.14
62 regex-0.1.73
63 regex-syntax-0.3.4
64 rustc-serialize-0.3.19
65 semver-0.2.3
66 strsim-0.3.0
67 tar-0.4.8
68 tempdir-0.3.5
69 term-0.4.4
70 thread-id-2.0.0
71 thread_local-0.2.6
72 toml-0.2.0
73 unicode-bidi-0.2.3
74 unicode-normalization-0.1.2
75 url-1.2.0
76 user32-sys-0.2.0
77 utf8-ranges-0.1.3
78 winapi-0.2.8
79 winapi-build-0.1.1
80 ws2_32-sys-0.2.1
81 "
82
83 inherit cargo bash-completion-r1
84
85 DESCRIPTION="The Rust's package manager"
86 HOMEPAGE="http://crates.io"
87 SRC_URI="https://github.com/rust-lang/cargo/archive/${PV}.tar.gz -> ${P}.tar.gz
88         $(cargo_crate_uris ${CRATES})
89         x86?   (
90                 https://static.rust-lang.org/cargo-dist/${CARGO_SNAPSHOT_DATE}/cargo-nightly-i686-unknown-linux-gnu.tar.gz ->
91                 cargo-snapshot-x86-${CARGO_SNAPSHOT_DATE}.tar.gz
92         )
93         amd64? (
94                 https://static.rust-lang.org/cargo-dist/${CARGO_SNAPSHOT_DATE}/cargo-nightly-x86_64-unknown-linux-gnu.tar.gz ->
95                 cargo-snapshot-amd64-${CARGO_SNAPSHOT_DATE}.tar.gz
96         )"
97
98 RESTRICT="mirror"
99 LICENSE="|| ( MIT Apache-2.0 )"
100 SLOT="0"
101 KEYWORDS="~amd64 ~x86"
102
103 IUSE="doc libressl"
104
105 COMMON_DEPEND="sys-libs/zlib
106         !libressl? ( dev-libs/openssl:0= )
107         libressl? ( dev-libs/libressl:0= )
108         net-libs/libssh2
109         net-libs/http-parser"
110 RDEPEND="${COMMON_DEPEND}
111         !dev-util/cargo-bin
112         net-misc/curl[ssl]"
113 DEPEND="${COMMON_DEPEND}
114         >=dev-lang/rust-1.9.0:stable
115         dev-util/cmake
116         sys-apps/coreutils
117         sys-apps/diffutils
118         sys-apps/findutils
119         sys-apps/sed"
120
121 src_configure() {
122         # Cargo only supports these GNU triples:
123         # - Linux: <arch>-unknown-linux-gnu
124         # - MacOS: <arch>-apple-darwin
125         # - Windows: <arch>-pc-windows-gnu
126         # where <arch> could be 'x86_64' (amd64) or 'i686' (x86)
127         use amd64 && CTARGET="x86_64-unknown-linux-gnu"
128         use x86 && CTARGET="i686-unknown-linux-gnu"
129
130         # NOTE: 'disable-nightly' is used by crates (such as 'matches') to entirely
131         # skip their internal libraries that make use of unstable rustc features.
132         # Don't use 'enable-nightly' with a stable release of rustc as DEPEND,
133         # otherwise you could get compilation issues.
134         # see: github.com/gentoo/gentoo-rust/issues/13
135         local myeconfargs=(
136                 --host=${CTARGET}
137                 --build=${CTARGET}
138                 --target=${CTARGET}
139                 --enable-optimize
140                 --disable-nightly
141                 --disable-verify-install
142                 --disable-debug
143                 --disable-cross-tests
144         )
145         econf "${myeconfargs[@]}"
146 }
147
148 src_compile() {
149         # Building sources
150         export CARGO_HOME="${ECARGO_HOME}"
151         emake VERBOSE=1 PKG_CONFIG_PATH=""
152
153         # Building HTML documentation
154         use doc && emake doc
155 }
156
157 src_install() {
158         emake prepare-image-${CTARGET} IMGDIR_${CTARGET}="${ED}/usr"
159
160         # Install HTML documentation
161         use doc && HTML_DOCS=("target/doc")
162         einstalldocs
163
164         dobashcomp "${ED}"/usr/etc/bash_completion.d/cargo
165         rm -rf "${ED}"/usr/etc || die
166 }
167
168 src_test() {
169         # Running unit tests
170         # NOTE: by default 'make test' uses the copy of cargo (v0.0.1-pre-nighyly)
171         # from the installer snapshot instead of the version just built, so the
172         # ebuild needs to override the value of CFG_LOCAL_CARGO to avoid false
173         # positives from unit tests.
174         emake test \
175                 CFG_ENABLE_OPTIMIZE=1 \
176                 VERBOSE=1 \
177                 CFG_LOCAL_CARGO="${WORKDIR}"/${P}/target/${CTARGET}/release/cargo
178 }