blob: 20aca72bdbb827e8cbc396d779b728699e674a01 (
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
|
# Maintainer: Adam Veldhousen adam@vdhsn.com
pkgname=powerbar
pkgver=v1.0.1.10
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}
}
|