blob: fd23988c898c006e53b7c4a193e3844d4c761c1f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
REAL_PN="buildtools"
inherit go-module
DESCRIPTION="Tools for working with Google's Bazel BUILD files."
HOMEPAGE="https://github.com/bazelbuild/buildtools/"
if [[ "${PV}" == *9999* ]] ; then
inherit git-r3
EGIT_REPO_URI="https://github.com/bazelbuild/${REAL_PN}.git"
else
SRC_URI="https://github.com/bazelbuild/${REAL_PN}/archive/refs/tags/v${PV}.tar.gz
-> ${P}.tar.gz"
S="${WORKDIR}/${REAL_PN}-${PV}"
KEYWORDS="~amd64 ~arm64 ~x86"
fi
SRC_URI+="
https://dev.gentoo.org/~xgqt/distfiles/deps/${PN}-8.0.0-deps.tar.xz
"
LICENSE="Apache-2.0"
SLOT="0"
DOCS=( README.md WARNINGS.md )
src_prepare() {
default
rm ./warn/docs/docs.go || die
}
src_compile() {
local go_ldopts="
-X main.buildScmRevision=v${PV}
-X main.buildVersion=${PV}
"
local -a go_buildopts=(
-ldflags "${go_ldopts}"
-o ./bin/
)
ego build "${go_buildopts[@]}" ./...
}
src_install() {
exeinto /usr/bin
doexe ./bin/{buildifier{,2},buildozer}
newexe ./bin/generatetables bazel-generatetables
newexe ./bin/unused_deps bazel-unused_deps
local app=""
for app in buildifier buildozer unused_deps ; do
newdoc "${S}/${app}/README.md" "${app}.md"
done
einstalldocs
}
pkg_postinst() {
einfo 'The "generatetables" binary is installed as "bazel-generatetables"'
einfo 'and the "unused_deps" binary is installed as "bazel-unused_deps"'.
}
|