PKGBUILDs/community/consul/PKGBUILD
2019-08-24 20:18:36 +00:00

93 lines
3.8 KiB
Bash

# Maintainer: Thore Bödecker <foxxx0@archlinux.org>
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - patch to fix ARM build
# - remove export GOARCH='amd64'
pkgname=consul
pkgver=1.5.3
pkgrel=2
pkgdesc="A tool for service discovery, monitoring and configuration."
arch=('x86_64')
_gocli_commit='3d22a244be8aa6fb16ac24af0e195c08b7d973aa' # HEAD
url="https://www.consul.io"
license=('MPL2')
depends=('glibc')
makedepends=('git' 'go-pie' 'procps-ng' 'zip')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/hashicorp/consul/archive/v${pkgver}.tar.gz"
"gocli::git+https://github.com/mitchellh/cli#commit=${_gocli_commit}"
'consul.service'
'consul.default'
'consul.sysusers'
'example.json'
'fix-build-version-info.patch'
'consul-ldflags.patch'
'unparallelize-or-disable-flaky-tests.patch'
'0001-fix-ARM-build.patch'
)
install=consul.install
backup=('etc/default/consul')
sha512sums=('9a1ec590132069deb0d74809bcc7da7df4d40b17e6e2ff95cf90a2dbd5487bd2309164f09ca9c4802f77a56b453479605841531083bf272dbcb9a53b91e9bc8c'
'SKIP'
'c70b9d1556f6c7ecb2e915ab685f289cef0e31198bd2e50c74a0483bbfb387beec67334f539a90adbf68b61b07946e98b300ab8a8e26e53b35f4ab4894adeb04'
'ec5a800529a297c709fa383c094ecf106351cf0f8ac7b613b972d415d77fe001088902d7ab805e63e78a8e6360323fec1b795db5a4446df1e21b9b4ed31e7079'
'ef872aedb2bc022a29292b7972a792b22e684c1ccb904a2b2cfec6d8966c28fb19be1452ce060821c419f1b646b236ba2e783175595e4bb6926d164c27a15c87'
'c4292b8f56ee955ed7385a49843fd90d6434029891b3e1e724cb2fc841514c06e2554a26d3937c114371b18c2168c4e64319eb2cbd726ee8b35870df19089348'
'8442826050639bf4a8799d5bdeb9778b5dbf45c7c557292209691a08d207ece6106e7f6711ccb1e252b7d1dbbff14f0deb72b4f07e664a304b91092d0afa447b'
'0d779e78bb5f5edafddcc3de1a754a6c39e3ce6dd7aa1387f491803f977b4a7d5e9a1eaa17d212be89109b191c91c2cdf4dd9728cffb3b724b28d20248ce8e12'
'b59b2733d598ae6648c198f26f23961d4c1ea8c693a1a5b1c16a0951400c3bb9a9d2d5efe4f0a5cca9ae3b1f225a8eb4133c9011c4125589e936c7dcdc4b2495'
'3f6c2d7e13bb13ee1614463f81a33eedbce8237b2e5189c78e3e12b00c38497a1f17eae8298d3276c4df8bf5e1f950ac62718f6a4ec5c07a94de2210efbc26bc')
prepare() {
export GOPATH="${srcdir}"
export PATH="$PATH:$GOPATH/bin"
mkdir -p "src/github.com/mitchellh"
mkdir -p "src/github.com/hashicorp"
mv "${pkgname}-${pkgver}" "${srcdir}/src/github.com/hashicorp/${pkgname}"
mv "gocli" "${srcdir}/src/github.com/mitchellh/cli"
cd "${srcdir}/src/github.com/hashicorp/${pkgname}"
local filename
for filename in "${source[@]}"; do
if [[ "$filename" =~ \.patch$ ]]; then
msg2 "Applying patch ${filename##*/}"
patch -p1 -N -l -i "$srcdir/${filename##*/}"
fi
done
}
build() {
cd "${srcdir}/src/github.com/hashicorp/${pkgname}"
export GOOS='linux'
make linux
}
check() {
cd "${srcdir}/src/github.com/hashicorp/${pkgname}"
# weird race conditions when being run overparallelized
export GOMAXPROCS="2"
export GOOS='linux'
export GOTEST_FLAGS="-p 2 -parallel 2"
export TRAVIS='true'
make -j1 test
}
package() {
cd "${srcdir}/src/github.com/hashicorp/${pkgname}"
install -D -d -m750 -o 208 -g 208 "${pkgdir}/var/lib/consul"
install -D -d -m750 -o 0 -g 208 "${pkgdir}/etc/consul.d"
install -D -m644 "${srcdir}/consul.default" "${pkgdir}/etc/default/consul"
install -D -m644 -o 0 -g 0 "${srcdir}/example.json" "${pkgdir}/usr/share/doc/consul/config.example.json"
install -Dm755 "bin/consul" "${pkgdir}/usr/bin/consul"
install -Dm644 "${srcdir}/consul.service" "${pkgdir}/usr/lib/systemd/system/consul.service"
install -Dm644 "${srcdir}/consul.sysusers" "${pkgdir}/usr/lib/sysusers.d/consul.conf"
}
# vim:set ts=2 sw=2 et: