app-admin: Remove *-fbsd KEYWORDS
[gentoo.git] / app-admin / consul / consul-1.6.0.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 inherit golang-vcs-snapshot systemd user
7 GIT_COMMIT="944cc71"
8 KEYWORDS="~amd64"
9 EGO_PN="github.com/hashicorp/consul"
10 DESCRIPTION="A tool for service discovery, monitoring and configuration"
11 HOMEPAGE="https://www.consul.io"
12 SRC_URI="https://github.com/hashicorp/consul/archive/v${PV}.tar.gz -> ${P}.tar.gz"
13
14 SLOT="0"
15 LICENSE="MPL-2.0 Apache-2.0 BSD BSD-2 CC0-1.0 ISC MIT"
16 IUSE=""
17
18 RESTRICT="test"
19
20 DEPEND="dev-go/gox
21         >=dev-lang/go-1.11:=
22         >=dev-go/go-tools-0_pre20160121"
23 RDEPEND=""
24
25 pkg_setup() {
26         enewgroup consul
27         enewuser consul -1 -1 /var/lib/${PN} consul
28 }
29
30 src_prepare() {
31         default
32
33         # avoid network-sandbox violations since go-1.13
34         rm src/${EGO_PN}/go.mod || die
35         grep -rlZ '_ "github.com/envoyproxy/protoc-gen-validate/validate"' . | \
36                 xargs -0 sed -i '/_ "github.com\/envoyproxy\/protoc-gen-validate\/validate"/d' || die
37
38         sed -e 's:go get -u -v $(GOTOOLS)::' \
39                 -e 's:vendorfmt dev-build:dev-build:' \
40                 -i "src/${EGO_PN}/GNUmakefile" || die
41 }
42
43 src_compile() {
44         # The dev target sets causes build.sh to set appropriate XC_OS
45         # and XC_ARCH, and skips generation of an unused zip file,
46         # avoiding a dependency on app-arch/zip.
47         GOPATH="${S}" \
48         GOBIN="${S}/bin" \
49         GIT_DESCRIBE="v${PV}" \
50         GIT_DIRTY="" \
51         GIT_COMMIT="${GIT_COMMIT}" \
52         emake -C "src/${EGO_PN}" dev-build
53 }
54
55 src_install() {
56         local x
57
58         dobin bin/consul
59
60         keepdir /etc/consul.d
61         insinto /etc/consul.d
62         doins "${FILESDIR}/"*.json.example
63
64         for x in /var/{lib,log}/${PN}; do
65                 keepdir "${x}"
66                 fowners consul:consul "${x}"
67         done
68
69         newinitd "${FILESDIR}/consul.initd" "${PN}"
70         newconfd "${FILESDIR}/consul.confd" "${PN}"
71         insinto /etc/logrotate.d
72         newins "${FILESDIR}/${PN}.logrotated" "${PN}"
73         systemd_dounit "${FILESDIR}/consul.service"
74 }