summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorKyle Westhaus2019-11-18 19:15:07 -0500
committerKyle Westhaus2019-11-18 19:15:07 -0500
commit45d195b301735432f25ccd8386cecaaf12fb3747 (patch)
treedb634a16941b20f1fd27ee8ee326000c31acf98d
parentb433ce8653c5a3112bb1fceb9130e4890f8ef467 (diff)
downloadaur-45d195b301735432f25ccd8386cecaaf12fb3747.tar.gz
Uses modern go modules, simplifies trimpath option, and adjusts license directory
Updating to go modules removes the need for complicated prepare() logic. We now pass the trimpath option to the main build command instead of enumerating all subtools.
-rw-r--r--PKGBUILD27
1 files changed, 5 insertions, 22 deletions
diff --git a/PKGBUILD b/PKGBUILD
index 1632aa943934..1aa0b1928c79 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -20,22 +20,6 @@ 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
@@ -58,12 +42,11 @@ build() {
# '-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 \
+ cd "$srcdir/$pkgname"/dgraph
+ go build -v \
-o dgraph \
-buildmode=pie \
- -gcflags "all=-trimpath=$PWD" \
- -asmflags "all=-trimpath=$PWD" \
+ -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)' \
@@ -74,8 +57,8 @@ build() {
}
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 -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"
}