Gentoo Archives: gentoo-commits

From: Mark Wright <gienah@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: dev-util/bazel/
Date: Wed, 02 May 2018 23:20:41
Message-Id: 1525303032.ba41c92f47c5fe8551f1761d4ae1c48829cc46fd.gienah@gentoo
1 commit: ba41c92f47c5fe8551f1761d4ae1c48829cc46fd
2 Author: Mark Wright <gienah <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 2 23:17:12 2018 +0000
4 Commit: Mark Wright <gienah <AT> gentoo <DOT> org>
5 CommitDate: Wed May 2 23:17:12 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/sci.git/commit/?id=ba41c92f
7
8 dev-util/bazel: Set our flags for #861 prefix
9
10 Package-Manager: Portage-2.3.33, Repoman-2.3.9
11
12 dev-util/bazel/bazel-0.13.0.ebuild | 104 +++++++++++++++++++++++++++++++++++++
13 dev-util/bazel/metadata.xml | 20 +++++++
14 2 files changed, 124 insertions(+)
15
16 diff --git a/dev-util/bazel/bazel-0.13.0.ebuild b/dev-util/bazel/bazel-0.13.0.ebuild
17 new file mode 100644
18 index 000000000..797c062b0
19 --- /dev/null
20 +++ b/dev-util/bazel/bazel-0.13.0.ebuild
21 @@ -0,0 +1,104 @@
22 +# Copyright 1999-2018 Gentoo Foundation
23 +# Distributed under the terms of the GNU General Public License v2
24 +
25 +EAPI=6
26 +
27 +inherit bash-completion-r1 java-pkg-2
28 +
29 +DESCRIPTION="Fast and correct automated build system"
30 +HOMEPAGE="http://bazel.io/"
31 +SRC_URI="https://github.com/bazelbuild/bazel/releases/download/${PV}/${P}-dist.zip"
32 +
33 +LICENSE="Apache-2.0"
34 +SLOT="0"
35 +KEYWORDS="~amd64"
36 +IUSE="examples tools zsh-completion"
37 +# strip corrupts the bazel binary
38 +RESTRICT="strip"
39 +RDEPEND="virtual/jdk:1.8"
40 +DEPEND="${RDEPEND}
41 + app-arch/unzip
42 + app-arch/zip"
43 +
44 +S="${WORKDIR}"
45 +
46 +pkg_setup() {
47 + echo ${PATH} | grep -q ccache && \
48 + ewarn "${PN} usually fails to compile with ccache, you have been warned"
49 + java-pkg-2_pkg_setup
50 +}
51 +
52 +bazel-get-flags() {
53 + local fs=""
54 + for i in ${CFLAGS}; do
55 + [[ -n "${fs}" ]] && fs+=" "
56 + fs+="--copt=${i}"
57 + done
58 + for i in ${CXXFLAGS}; do
59 + [[ -n "${fs}" ]] && fs+=" "
60 + fs+="--cxxopt=${i}"
61 + done
62 + for i in ${CPPFLAGS}; do
63 + [[ -n "${fs}" ]] && fs+=" "
64 + fs+="--copt=${i}"
65 + fs+="--cxxopt=${i}"
66 + done
67 + for i in ${LDFLAGS}; do
68 + [[ -n "${fs}" ]] && fs+=" "
69 + fs+="--linkopt=${i}"
70 + done
71 + echo "${fs}"
72 +}
73 +
74 +src_compile() {
75 + # F: fopen_wr
76 + # S: deny
77 + # P: /proc/self/setgroups
78 + # A: /proc/self/setgroups
79 + # R: /proc/24939/setgroups
80 + # C: /usr/lib/systemd/systemd
81 + addpredict /proc
82 + VERBOSE=yes ./compile.sh || die
83 + # Use standalone strategy to deactivate the bazel sandbox, since it
84 + # conflicts with FEATURES=sandbox.
85 + echo "build --verbose_failures --spawn_strategy=standalone --genrule_strategy=standalone" \
86 + > "${T}/bazelrc" || die
87 + einfo "output/bazel --bazelrc=\"${T}/bazelrc\" build \\"
88 + einfo " $(bazel-get-flags) \\"
89 + einfo " scripts:bazel-complete.bash"
90 + output/bazel --bazelrc="${T}/bazelrc" build $(bazel-get-flags) \
91 + scripts:bazel-complete.bash || die
92 + mv bazel-bin/scripts/bazel-complete.bash output/ || die
93 +}
94 +
95 +src_test() {
96 + output/bazel test \
97 + --verbose_failures \
98 + --spawn_strategy=standalone \
99 + --genrule_strategy=standalone \
100 + --verbose_test_summary \
101 + examples/cpp:hello-success_test || die
102 +}
103 +
104 +src_install() {
105 + output/bazel shutdown
106 + dobin output/bazel
107 + newbashcomp output/bazel-complete.bash ${PN}
108 + bashcomp_alias ${PN} ibazel
109 + if use zsh-completion ; then
110 + insinto /usr/share/zsh/site-functions
111 + doins scripts/zsh_completion/_bazel
112 + fi
113 + if use examples; then
114 + docinto examples
115 + dodoc -r examples/*
116 + docompress -x /usr/share/doc/${PF}/examples
117 + fi
118 + # could really build tools but I don't know which ones
119 + # are actually used
120 + if use tools; then
121 + docinto tools
122 + dodoc -r tools/*
123 + docompress -x /usr/share/doc/${PF}/tools
124 + fi
125 +}
126
127 diff --git a/dev-util/bazel/metadata.xml b/dev-util/bazel/metadata.xml
128 new file mode 100644
129 index 000000000..e7d5f3b34
130 --- /dev/null
131 +++ b/dev-util/bazel/metadata.xml
132 @@ -0,0 +1,20 @@
133 +<?xml version="1.0" encoding="UTF-8"?>
134 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
135 +<pkgmetadata>
136 + <maintainer type="person">
137 + <email>zmedico@g.o</email>
138 + </maintainer>
139 + <upstream>
140 + <remote-id type="github">bazelbuild/bazel</remote-id>
141 + </upstream>
142 + <longdescription>
143 + Bazel is Google's own build tool. Bazel has built-in support for
144 + building both client and server software, including client
145 + applications for both Android and iOS platforms. It also provides
146 + an extensible framework that you can use to develop your own build
147 + rules.
148 + </longdescription>
149 + <use>
150 + <flag name="tools">Install extra bazel tools to build from sources</flag>
151 + </use>
152 +</pkgmetadata>