summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d1ed893f4e1a76106a38c5effb7b273a513a846a (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
# Maintainer: Egor Kovetskiy <e.kovetskiy@gmail.com>
pkgname=taskfile-git
_pkgname=task
pkgver=${PKGVER:-autogenerated}
pkgrel=${PKGREL:-1}
pkgdesc="A task runner / simpler Make alternative written in Go"
arch=('i686' 'x86_64')
license=('GPL')
depends=(
)
makedepends=(
	'go'
	'git'
)

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

md5sums=(
	'SKIP'
)

backup=(
)

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

	cd "$srcdir/$_pkgname"
	local date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
	local count=$(git rev-list --count HEAD)
	local commit=$(git rev-parse --short HEAD)
	echo "$date.${count}_$commit"
}

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

	rm -rf "$srcdir/go/src"

    mkdir -p "$srcdir/go/src/$(dirname $_goname)"

	export GOPATH="$srcdir/go"

	cp -r "$srcdir/$_pkgname" "$srcdir/go/src/$_goname"
	cd "$srcdir/go/src/$_goname/"

	echo ":: Building binary"
	go get -v \
		-gcflags "-trimpath $GOPATH/src" ./cmd/...
}

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

    install -DT "$srcdir/$_pkgname/completion/zsh/_task" \
        "$pkgdir/usr/share/zsh/site-functions/_task"
}