1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit golang-vcs-snapshot systemd user
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"
15 LICENSE="MPL-2.0 Apache-2.0 BSD BSD-2 CC0-1.0 ISC MIT"
22 >=dev-go/go-tools-0_pre20160121"
27 enewuser consul -1 -1 /var/lib/${PN} consul
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
38 sed -e 's:go get -u -v $(GOTOOLS)::' \
39 -e 's:vendorfmt dev-build:dev-build:' \
40 -i "src/${EGO_PN}/GNUmakefile" || die
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.
49 GIT_DESCRIBE="v${PV}" \
51 GIT_COMMIT="${GIT_COMMIT}" \
52 emake -C "src/${EGO_PN}" dev-build
62 doins "${FILESDIR}/"*.json.example
64 for x in /var/{lib,log}/${PN}; do
66 fowners consul:consul "${x}"
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"