blob: 6578214f016ce2533e379cebbe30fe7310288d0b (
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
|
# Maintainer: Kyle Westhaus <kwesthaus+aur at gmail dot com>
# Maintainer: Kevin Orr <kevinorr54+aur at gmail dot com>
# Contributor: Kaley Main <kaleypoole17 at gmail dot com>
# Contributor: John Trengrove <john at retrofilter dot com>
pkgname=dgraph-git
pkgver=20.11.0.rc1.r320.g3642fed5d
pkgrel=1
pkgdesc='Fast, transactional, distributed graph database'
arch=('x86_64')
url='https://github.com/dgraph-io/dgraph'
license=('APACHE' 'custom:DCL')
makedepends=('go' 'git')
provides=('dgraph')
conflicts=('dgraph' 'dgraph-bin')
source=("$pkgname::git+$url#branch=master"
'dgraph.service'
'dgraph-zero.service')
sha256sums=('SKIP'
'4ef9bc0e7b2b6d1e6adaef343164f974685bbf2538c9c1ed26ea82d7dddb6974'
'402c5a022615f47d26db47f375f242638d04abbed3bfd22f86067f8f19031f83')
pkgver() {
cd "$srcdir/$pkgname"
# cuts off 'v' prefix and uses most recent un-annotated tag reachable from the
# last commit
# see https://wiki.archlinux.org/index.php/VCS_package_guidelines#Git
git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
build() {
# the upstream repo provides a Makefile, but this PKGBUILD ignores it so that
# further build options can be specified, as seen below
# see https://wiki.archlinux.org/index.php/Go_package_guidelines#Building and
# `go help build`
# enables PIE security mode, without having to target go-pie as a dependency
# strips build paths from binary for reproducible builds
# passes flags to go tool link
# see `go tool link --help`
# surrounding an option with single quotes ensures that it will be passed
# as a single argument regardless of any spaces
# '-X' options mark the binary so that it reports proper version information
# '-extldflags' passes options to the external linking tool to enable RELRO, without
# overwriting default linker flags
cd "$srcdir/$pkgname"/dgraph
go build -v \
-o dgraph \
-buildmode=pie \
-trimpath \
-ldflags "-X 'github.com/dgraph-io/dgraph/x.dgraphVersion=$(git rev-parse --short HEAD)' \
-X 'github.com/dgraph-io/dgraph/x.gitBranch=$(git rev-parse --abbrev-ref HEAD)' \
-X 'github.com/dgraph-io/dgraph/x.lastCommitSHA=$(git log -1 --format=%ci)' \
-X 'github.com/dgraph-io/dgraph/x.lastCommitTime=$(git describe --abbrev=0)' \
-extldflags '-Wl,-z,relro,-z,now'" \
.
strip -x dgraph
}
package() {
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname/" "$srcdir/$pkgname"/{LICENSE*,licenses/*}
install -Dm755 "$srcdir/$pkgname/dgraph/dgraph" "$pkgdir/usr/bin/dgraph"
install -Dm644 dgraph.service "$pkgdir/usr/lib/systemd/system/dgraph.service"
install -Dm644 dgraph-zero.service "$pkgdir/usr/lib/systemd/system/dgraph-zero.service"
}
# vim:set ts=2 sw=2 et:
|