summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7426cacd7982a02e48bd576f31ff57254a8d283a (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
# Maintainer: Jguer <joaogg3@gmail.com>
pkgname=go-dwmstatus
pkgver=1.26
pkgrel=1
pkgdesc="DWM status bar written in go. Fork without mdp support and with PulseAudio support for volume."
arch=('i686' 'x86_64' 'arm')
url="https://github.com/petRUShka/go-dwmstatus"
license=('GPL')
depends=(
  'sudo'
)
makedepends=(
	'go'
	'git'
)
conflicts=()


source=(
	"go-dwmstatus::git://github.com/petRUShka/go-dwmstatus.git#branch=${BRANCH:-master}"
)

md5sums=(
	'SKIP'
)

backup=(
)

pkgver() {
	if [[ "$PKGVER" ]]; then
		echo "$PKGVER"
		return
	fi

	cd "$srcdir/$pkgname"
	local count=$(git rev-list --count HEAD)
	echo "1.${count}"
}

build() {
	cd "$srcdir/$pkgname"

	if [ -L "$srcdir/$pkgname" ]; then
		rm "$srcdir/$pkgname" -rf
		mv "$srcdir/.go/src/$pkgname/" "$srcdir/$pkgname"
	fi

	rm -rf "$srcdir/.go/src"

	mkdir -p "$srcdir/.go/src"

	export GOPATH="$srcdir/.go"

	mv "$srcdir/$pkgname" "$srcdir/.go/src/"

	go get -v \
		-gcflags "-trimpath $GOPATH/src" \
		-ldflags="-X main.version=$pkgver"
}

package() {
  #install executable
	find "$srcdir/.go/bin/" -type f -executable | while read filename; do
		install -DT "$filename" "$pkgdir/usr/bin/$(basename $filename)"
	done

	cd "$srcdir/.go/src/$pkgname"
}