archrelease: copy trunk to community-any
[ArchLinux/community.git] / vault / trunk / PKGBUILD
blob2425d7415a7b4ad6b4ca9d761dfdaf580e92b5a1
1 # Maintainer : Christian Rebischke <Chris.Rebischke@archlinux.org>
2 # Contributor: Tim Meusel <tim@bastelfreak.de>
3 # Contributor: Sebastian Rakel <sebastian@devunit.eu>
4 # Contributor: Justin Kromlinger <hashworks@archlinux.org>
5 # Contributor: Andrew Tyler <assimilat@gmail.com>
7 pkgname=vault
8 pkgdesc='A tool for managing secrets'
9 pkgver=1.13.1
10 pkgrel=1
11 url="https://vaultproject.io/"
12 license=('MPL')
13 arch=('x86_64')
14 depends=('glibc')
15 makedepends=('go' 'git' 'yarn' 'bower' 'nodejs-lts-fermium' 'npm' 'zip' 'gox' 'go-tools')
16 install=vault.install
17 backup=('etc/vault.hcl')
18 _vault_commit='4472e4a3fbcc984b7e3dc48f5a8283f3efe6f282'
19 source=("git+https://github.com/hashicorp/vault#commit=${_vault_commit}"
20   'vault.service'
21   'vault.sysusers'
22   'vault.tmpfiles'
23   'vault.hcl')
24 sha512sums=('SKIP'
25             '6619cf57668e995cddb29fb6c388c18c21b251052a53832415e415bb4fe538361ef77b74536f5b082b9cda6cd71b598fc50d8b7f51092c4d60262052c5725af2'
26             '92616ccf83fa5ca9f8b0d022cf8ceb1f3549e12b66bf21d9f77f3eb26bd75ec1dc36c155948ec987c642067b85fbfc30a9217d6c503d952a402aa5ef63e50928'
27             '073f0f400cba78521cd2709ce86d88fbb14125117f9f3beca657f625d04eab8e00f7a01b5d9a1cfc03e9038844f5732bdbb1a85dd65a803d3f0b90f8bf87880e'
28             '46106cc76151eef2dd5e4b2caa6a96aae4d6ce1ecbf977dcc8667a3f6c829cbea95133622adafcb15cdfaa066ecc94c73c983e7613ee2f6573694981569729fe')
30 pkgver() {
31   cd vault
32   git describe --tags --match 'v*' | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
35 build() {
36   mkdir -p "${srcdir}/vault/http/web_ui"
37   cd "${srcdir}/vault/ui"
38   yarn install --ignore-optional
39   npm rebuild node-sass
40   yarn --verbose run build
42   cd "${srcdir}/vault"
43   export CGO_CPPFLAGS="${CPPFLAGS}"
44   export CGO_CFLAGS="${CFLAGS}"
45   export CGO_CXXFLAGS="${CXXFLAGS}"
46   export CGO_LDFLAGS="${LDFLAGS}"
47   export GOPATH="${srcdir}"
48   mkdir -p bin
49   go build \
50     -buildmode=pie \
51     -mod=readonly \
52     -modcacherw \
53     -ldflags "-linkmode=external -compressdwarf=false -X github.com/hashicorp/vault/sdk/version.Version=${pkgver} -X github.com/hashicorp/vault/sdk/version.GitCommit=${_vault_commit} -X github.com/hashicorp/vault/sdk/version.BuildDate=$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
54     -tags ui \
55     -o dist/ \
56     .
59 package() {
60   install -Dm644 "${srcdir}/vault.hcl" "${pkgdir}/etc/vault.hcl"
61   install -Dm644 "${srcdir}/vault.service" "${pkgdir}/usr/lib/systemd/system/vault.service"
62   install -Dm644 "${srcdir}/vault.sysusers" "${pkgdir}/usr/lib/sysusers.d/vault.conf"
63   install -Dm644 "${srcdir}/vault.tmpfiles" "${pkgdir}/usr/lib/tmpfiles.d/vault.conf"
64   cd "${srcdir}/vault"
65   install -Dm755 "dist/vault" "${pkgdir}/usr/bin/vault"
66   install -Dm644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
67   for file in README.md CHANGELOG.md CONTRIBUTING.md; do
68     install -Dm644 "${file}" "${pkgdir}/usr/share/doc/${pkgname}/${file}"
69   done