summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8861b3e0792699743014e07898f3245d1a904355 (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
# Maintainer: Araaha <ara.ahady@gmail.com>

pkgname=tb.go
pkgver=1.0.2
pkgrel=1
pkgdesc="Tasks, boards & notes for the terminal"
arch=('x86_64' 'aarch64' 'i686' 'armv7h')
url="https://github.com/araaha/tb.go"
license=('GPL3')
makedepends=('go' 'git')
_tag="v$pkgver-$pkgrel"
source=("$pkgname::git+https://github.com/araaha/tb.go.git#tag=$_tag")
b2sums=('SKIP')

prepare() {
    cd "$pkgname"
}

build() {
    cd "$pkgname"

    local revision="$(git rev-parse --short "$_tag")"

    export CGO_CFLAGS="$CFLAGS"
    export CGO_CXXFLAGS="$CXXFLAGS"
    export CGO_CPPFLAGS="$CPPFLAGS"
    export CGO_LDFLAGS="$LDFLAGS"

    go build \
        -trimpath \
        -buildmode=pie \
        -mod=readonly \
        -modcacherw \
        -ldflags="-linkmode=external -X github.com/araaha/tb.go/cmd.Version=$_tag -X github.com/araaha/tb.go/cmd.Revision=$revision -extldflags '$LDFLAGS'" \
        -o tb
}

check() {
    cd "$pkgname"
    go test ./...
}

package() {
    cd "$pkgname"
    install -Dm755 tb "$pkgdir/usr/bin/tb"
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}