dev-util/bazel: version bump
[gentoo.git] / dev-util / bazel / bazel-0.4.0.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 inherit bash-completion-r1 java-pkg-2
8
9 DESCRIPTION="Fast and correct automated build system"
10 HOMEPAGE="http://bazel.io/"
11 SRC_URI="https://github.com/bazelbuild/bazel/archive/${PV}.tar.gz -> ${P}.tar.gz"
12
13 LICENSE="Apache-2.0"
14 SLOT="0"
15 KEYWORDS="~amd64"
16 IUSE="examples tools zsh-completion"
17 # strip corrupts the bazel binary
18 RESTRICT="strip"
19 DEPEND="virtual/jdk:1.8"
20 RDEPEND="${DEPEND}"
21
22 pkg_setup() {
23         echo ${PATH} | grep -q ccache && \
24                 ewarn "${PN} usually fails to compile with ccache, you have been warned"
25         java-pkg-2_pkg_setup
26 }
27
28 src_compile() {
29         VERBOSE=yes ./compile.sh || die
30         # Use standalone strategy to deactivate the bazel sandbox, since it
31         # conflicts with FEATURES=sandbox.
32         echo "build --verbose_failures --spawn_strategy=standalone --genrule_strategy=standalone" \
33                 > "${T}/bazelrc" || die
34         output/bazel --bazelrc="${T}/bazelrc" build //scripts:bazel-complete.bash || die
35 }
36
37 src_test() {
38         output/bazel test \
39                 --verbose_failures \
40                 --spawn_strategy=standalone \
41                 --genrule_strategy=standalone \
42                 --verbose_test_summary \
43                 examples/cpp:hello-success_test || die
44 }
45
46 src_install() {
47         dobin output/bazel
48         newbashcomp bazel-bin/scripts/bazel-complete.bash ${PN}
49         if use zsh-completion ; then
50                 insinto /usr/share/zsh/site-functions
51                 doins scripts/zsh_completion/_bazel
52         fi
53         if use examples; then
54                 docinto examples
55                 doins -r examples/*
56                 docompress -x /usr/share/doc/${PF}/examples
57         fi
58         # could really build tools but I don't know which ones
59         # are actually used
60         if use tools; then
61                 docinto tools
62                 doins -r tools/*
63                 docompress -x /usr/share/doc/${PF}/tools
64         fi
65 }