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