blob: cf49145b644f90590120b7afbfb059c66f0d9880 (
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
55
56
57
58
59
60
61
62
63
64
|
# Maintainer: George Rawlinson <grawlinson@archlinux.org>
pkgname=brpaste
pkgver=2.1.0
pkgrel=1
pkgdesc="A pastebin so fast, it burns rubber"
arch=('x86_64')
url="https://github.com/CosmicToast/brpaste"
license=('MIT') # switch to Unlicense for later versions
makedepends=('go' 'git' 'asciidoctor')
optdepends=(
'redis: for local instance'
)
source=("$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver.tar.gz")
b2sums=('b9f7ee0e7a9358782ba2a46b9f4bf7cfe5b74ea33e1785cddf038dcd26c6c0720b69a6924128800a81ad28e57b6496822437bd0286c664e1ef4e527f0a9f3b1e')
prepare() {
cd "$pkgname-$pkgver"
# create directory for build output
mkdir build
# download dependencies
go mod vendor
}
build() {
cd "$pkgname-$pkgver"
# set Go flags
export CGO_CPPFLAGS="${CPPFLAGS}"
export CGO_CFLAGS="${CFLAGS}"
export CGO_CXXFLAGS="${CXXFLAGS}"
# compile binary
go build -v \
-trimpath \
-buildmode=pie \
-mod=vendor \
-modcacherw \
-ldflags "-linkmode external -extldflags ${LDFLAGS}" \
-o build \
.
# generate man page
asciidoctor -b manpage "doc/$pkgname.adoc"
}
package() {
cd "$pkgname-$pkgver"
# binary
install -vDm755 -t "$pkgdir/usr/bin" "build/$pkgname"
# license
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
# documentation
install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
cp -vr server client "$pkgdir/usr/share/doc/$pkgname"
install -vDm644 -t "$pkgdir/usr/share/man/man1" "doc/$pkgname.1"
}
# vim:set ts=2 sw=2 et:
|