1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit bash-completion-r1 java-pkg-2 multiprocessing
8 DESCRIPTION="Fast and correct automated build system"
9 HOMEPAGE="https://bazel.build/"
11 SRC_URI="https://github.com/bazelbuild/bazel/releases/download/${PV}/${P}-dist.zip"
17 # strip corrupts the bazel binary
19 RDEPEND="virtual/jdk:1.8"
25 QA_FLAGS_IGNORED="usr/bin/bazel"
29 for i in ${CFLAGS}; do
30 fs+=( "--copt=${i}" "--host_copt=${i}" )
32 for i in ${CXXFLAGS}; do
33 fs+=( "--cxxopt=${i}" "--host_cxxopt=${i}" )
35 for i in ${CPPFLAGS}; do
36 fs+=( "--copt=${i}" "--host_copt=${i}" )
37 fs+=( "--cxxopt=${i}" "--host_cxxopt=${i}" )
39 for i in ${LDFLAGS}; do
40 fs+=( "--linkopt=${i}" "--host_linkopt=${i}" )
46 echo ${PATH} | grep -q ccache && \
47 ewarn "${PN} usually fails to compile with ccache, you have been warned"
52 # Only unpack the main distfile
61 # P: /proc/self/setgroups
62 # A: /proc/self/setgroups
63 # R: /proc/24939/setgroups
64 # C: /usr/lib/systemd/systemd
67 # Use standalone strategy to deactivate the bazel sandbox, since it
68 # conflicts with FEATURES=sandbox.
69 cat > "${T}/bazelrc" <<-EOF || die
70 build --verbose_failures
71 build --spawn_strategy=standalone --genrule_strategy=standalone
73 build --distdir="${S}/derived/distdir/"
74 build --jobs=$(makeopts_jobs) $(bazel-get-flags)
76 test --verbose_failures --verbose_test_summary
77 test --spawn_strategy=standalone --genrule_strategy=standalone
82 export EXTRA_BAZEL_ARGS="--jobs=$(makeopts_jobs) --host_javabase=@local_jdk//:jdk"
83 VERBOSE=yes ./compile.sh || die
85 ./scripts/generate_bash_completion.sh \
86 --bazel=output/bazel \
87 --output=bazel-complete.bash \
88 --prepend=scripts/bazel-complete-header.bash \
89 --prepend=scripts/bazel-complete-template.bash
95 --spawn_strategy=standalone \
96 --genrule_strategy=standalone \
97 --verbose_test_summary \
98 examples/cpp:hello-success_test || die
104 newbashcomp bazel-complete.bash ${PN}
105 bashcomp_alias ${PN} ibazel
106 insinto /usr/share/zsh/site-functions
107 doins scripts/zsh_completion/_bazel
109 if use examples; then
112 docompress -x /usr/share/doc/${PF}/examples
114 # could really build tools but I don't know which ones
119 docompress -x /usr/share/doc/${PF}/tools