summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 316226d733e181af20781842cb0898433df0205d (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
# Maintainer: Bazyli Cyran <bazyli@cyran.dev>

pkgname=bumper
pkgver=1.0.0
pkgrel=1
pkgdesc='Easily bump $pkgver in your AUR packages.'
url='https://github.com/bcyran/bumper'
provides=('bumper')
conflicts=('bumper-bin')
makedepends=('go')
checkdepends=('go')
license=('MIT')
arch=('x86_64')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('241d1299eaa9d9bd721fe910ffd7a3ccdc22168a7658f66cc2162261fb3717d6')

build() {
    cd "${pkgname}-${pkgver}"
    mkdir -p build/completions

    export CGO_CPPFLAGS="${CPPFLAGS}"
    export CGO_CFLAGS="${CFLAGS}"
    export CGO_CXXFLAGS="${CXXFLAGS}"
    export CGO_LDFLAGS="${LDFLAGS}"
    export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
    go build -o "build/${pkgname}"

    "build/${pkgname}" --completion bash > "build/completions/${pkgname}"
    "build/${pkgname}" --completion zsh > "build/completions/_${pkgname}"
    "build/${pkgname}" --completion fish > "build/completions/${pkgname}.fish"
}

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

package() {
    cd "${pkgname}-${pkgver}"
    install -Dm 755 "build/${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
    install -Dm 644 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"
    install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
    install -Dm 644 "build/completions/${pkgname}" -t "${pkgdir}/usr/share/bash-completion/completions"
    install -Dm 644 "build/completions/_${pkgname}" -t "${pkgdir}/usr/share/zsh/site-functions"
    install -Dm 644 "build/completions/${pkgname}.fish" -t "${pkgdir}/usr/share/fish/vendor_completions.d"
}