blob: 1632aa943934396e74f04a77bf4ee3009f40f9f0 (
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# 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=1.1.0.r150.g1ee42ef40
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'
'94449db0bbd30aca993dbc6486fbec615e2cada7cd3d91e6b99d6a426a5d7ace'
'402c5a022615f47d26db47f375f242638d04abbed3bfd22f86067f8f19031f83')
prepare() {
export GOPATH="$srcdir"
export GOOS=linux
case "$CARCH" in
x86_64) export GOARCH=amd64 ;;
i686) export GOARCH=386 GO386=387 ;;
esac
# sets up a fresh temporary go path and symlinks the source repo to appear under
# the proper directory structure to avoid dependency manager weirdness
# see https://wiki.archlinux.org/index.php/Go_package_guidelines#Old_Go_projects_(for_Go_%3C1.11)
mkdir -p "$srcdir"/src/github.com/dgraph-io
ln -rTsf "$srcdir/$pkgname" "$srcdir"/src/github.com/dgraph-io/dgraph
go get -v -d github.com/dgraph-io/dgraph/dgraph
}
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"/src/github.com/dgraph-io/dgraph/dgraph
go build -v \
-o dgraph \
-buildmode=pie \
-gcflags "all=-trimpath=$PWD" \
-asmflags "all=-trimpath=$PWD" \
-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/dgraph/ "$srcdir"/src/github.com/dgraph-io/dgraph/{LICENSE*,licenses/*}
install -Dm755 "$srcdir"/src/github.com/dgraph-io/dgraph/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:
|