summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 22c2f3d1debab8fae06be73c700213e8d9f0edda (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
# Maintainer: Your Name <youremail@domain.com>
# Contributor: Mark Wagie <yochanan dot marqos at gmail dot com>
# Contributor: Juan Simón <play4pro at protonmail dot com>
pkgname=gosearch-git
pkgver=0.1.r21.518ad3c
pkgrel=1
pkgdesc="A fast, real-time file searching program"
arch=('x86_64')
url="https://github.com/ozeidan/gosearch"
license=('GPL3')
makedepends=('git' 'go-pie' 'dep')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
install="${pkgname%-git}.install"
source=('git+https://github.com/ozeidan/gosearch.git')
sha256sums=('SKIP')

pkgver() {
	cd "$srcdir/${pkgname%-git}"
	printf "%s" "$(git describe --long | sed 's/^v//;s/\([^-]*-\)g/r\1/;s/-/./g')"
}

prepare() {
	mkdir -p gopath/src/github.com/ozeidan
	ln -rTsf "${pkgname%-git}" gopath/src/github.com/ozeidan/"${pkgname%-git}"
	
	export GOPATH="$srcdir"/gopath
	export GO111MODULE=on
	
	cd gopath/src/github.com/ozeidan/"${pkgname%-git}"
	dep init
	dep ensure
}

build() {
	export GOPATH="$srcdir"/gopath
	export GOFLAGS="-gcflags=all=-trimpath=${PWD} -asmflags=all=-trimpath=${PWD} -ldflags=-extldflags=-zrelro -ldflags=-extldflags=-znow"

	cd "$srcdir/${pkgname%-git}"
	make build
}

package() {
	cd "$srcdir/${pkgname%-git}"
	install -Dm755 ${pkgname%-git} $pkgdir/usr/bin/${pkgname%-git}
	install -Dm755 gosearchServer $pkgdir/usr/bin/gosearchServer
	install -Dm644 init/${pkgname%-git}.service $pkgdir/etc/systemd/system/${pkgname%-git}.service
}