summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0b6941db0e4bba96e4bf21a5efcb3e7ff45f287f (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
# Maintainer: aksr <aksr at t-com dot me>
pkgname=torrent-git
pkgver=1.26.1.r767.g8c267645
pkgrel=1
pkgdesc="Full-featured BitTorrent client package and utilities"
arch=('i686' 'x86_64')
url="https://github.com/anacrolix/torrent"
license=('MPL')
makedepends=('git' 'go')
provides=("${pkgname%-*}")
conflicts=("${pkgname%-*}")
source=("$pkgname::git+$url.git")
md5sums=(SKIP)

pkgver() {
	cd "$srcdir/${pkgname}"
	printf "%s" "$(git describe | cut -c2- | sed 's!-!.r!' | tr - .)"
}

build() {
	export CGO_CPPFLAGS="${CPPFLAGS}"
	export CGO_CFLAGS="${CFLAGS}"
	export CGO_CXXFLAGS="${CXXFLAGS}"
	export CGO_LDFLAGS="${LDFLAGS}"
	export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
	
	cd "$srcdir/${pkgname}"
	[[ -d build ]] || mkdir build
	go build -o build ./...

}

package() {
	cd "$srcdir/${pkgname}/build"
	for i in *; do
		install -Dm755 $i "$pkgdir/usr/bin/$i"
	done
	rm -rf $pkgdir/usr/bin/issue-*
	install -Dm644 ../README.md $pkgdir/usr/share/doc/${pkgname%-*}/README.md
	install -Dm644 ../LICENSE $pkgdir/usr/share/licenses/${pkgname%-*}/LICENSE
}