summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 6a21f97aee62f83f04a4dc4a9f0344f613846650 (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
# Maintainer: Colin Arnott <colin@urandom.co.uk>

pkgname=iferr-git
pkgver=20180615.bb332a3
pkgrel=2
pkgdesc="Tool for generating if err != nil { blocks."
arch=('x86_64')
url="https://github.com/koron/iferr"
license=('MIT')
conflicts=("${pkgname%-git}")
provides=("${pkgname%-git}")
makedepends=('go')
source=("git${url#https}.git" 'go.mod')
sha512sums=('SKIP' '7582cd268119b3ccdb91ac30b8d1084b329883630dfce65060391d7fd6f7e24c18bba3b90d335b4c40bcdd5f6062d08e7f6b7509bd38c668acebc66693727eea')

pkgver() {
	cd "${srcdir}/${pkgname%-git}"
	git log -1 --format='%cd.%h' --date=short | tr -d -
}

build() {
	cd "${srcdir}/${pkgname%-git}"

	export CGO_CPPFLAGS="$CPPFLAGS"
	export CGO_CFLAGS="$CFLAGS"
	export CGO_CXXFLAGS="$CXXFLAGS"
	export CGO_LDFLAGS="$LDFLAGS"
	export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"

	go build -o bin/ .
}

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