-
Notifications
You must be signed in to change notification settings - Fork 0
/
PKGBUILD.template
54 lines (47 loc) · 1.16 KB
/
PKGBUILD.template
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
# Maintainer: Adam Veldhousen adam@vdhsn.com
pkgname=powerbar
pkgver=master
pkgrel=1
pkgdesc="Battery status module for Waybar"
arch=('x86_64')
url="https://github.com/adamveld12/$pkgname"
license=("GPL3")
depends=("upower>=0.99.11-1")
makedepends=("git" "go")
sha1sums=('SKIP')
source=(git://github.com/adamveld12/powerbar.git)
build() {
cd $srcdir/$pkgname
echo "checking out $pkgver"
git checkout $pkgver
go mod vendor
go build -v \
-mod=vendor \
-trimpath \
-ldflags "-extldflags $LDFLAGS -X main.Version=$pkgver" \
-o $pkgname .
}
check() {
cd $srcdir/$pkgname
go mod vendor
go test -mod=vendor
}
package() {
mkdir -p $pkgdir/usr/bin
install -Dm755 -v $srcdir/$pkgname/$pkgname "$pkgdir/usr/bin/"
}
pkgver() {
if [[ "$PKGVER" ]]; then
echo "$PKGVER"
return
fi
cd $srcdir/$pkgname
local VERSION=$(git describe --tags | sed s:-.*::g)
if [[ "$(echo $VERSION | grep "fatal: No names found")" ]]; then
# local date=$(git log -1 --format="%cd" --date=short | sed s/-//g)
local commit=$(git rev-parse --short HEAD)
echo ${commit}
return
fi
echo ${VERSION}
}