summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0c85c3c0a5ea469c8399a31f80091eb490353379 (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: hashworks <hashworks@archlinux.org>

pkgname=paperless-cli
pkgver=0.7.1
pkgrel=1
pkgdesc="A golang command line binary to interact with a Paperless instance"
license=('Apache')
arch=('x86_64')
url='https://github.com/stgarf/paperless-cli'
depends=('glibc')
makedepends=('go')
options=('!lto')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz")
sha256sums=('2dfa01695c97c8cfc3db862565fe90c56d81e317e885e45a7da38dfd6bf723ea')

prepare(){
	cd "paperless-cli-${pkgver}"
	mkdir -p build/
}

build() {
	cd "paperless-cli-${pkgver}"
	export CGO_CPPFLAGS="${CPPFLAGS}"
	export CGO_CFLAGS="${CFLAGS}"
	export CGO_CXXFLAGS="${CXXFLAGS}"
	export CGO_LDFLAGS="${LDFLAGS}"
	export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"

	importPath="github.com/stgarf/paperless-cli/cmd"

	go build -ldflags "-X ${importPath}.Version=${pkgver} -X ${importPath}.BuildDate=$(date -Im) -X ${importPath}.GitCommit=v${pkgver} -X ${importPath}.GitState=clean -X ${importPath}.GitBranch=tag" -o build .
}

check() {
	cd "paperless-cli-${pkgver}"
	go test .
}

package() {
	cd "paperless-cli-${pkgver}"

	install -Dm755 "build/paperless-cli" "${pkgdir}/usr/bin/paperless-cli"

	install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
	install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}