summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d3aac717fcd18e9923b36232f6ede6ae0f5c9aa4 (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
# Maintainer: HurricanePootis <hurricanepootis@protonmail.com>
pkgname=scotty-git
pkgver=0.7.1.r6.g75478f7
pkgrel=1
pkgdesc="Transfer listens and loves between music services"
arch=('x86_64')
url="https://git.sr.ht/~phw/scotty"
license=('GPL-3.0-or-later')
depends=('glibc')
makedepends=('go' 'git')
provides=('scotty')
conflicts=('scotty')
source=("git+$url")
sha256sums=('SKIP')

pkgver() {
	cd "$srcdir/${pkgname::-4}"
	git describe --long --abbrev=7 | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
	cd "$srcdir/${pkgname::-4}"
	GOPATH="${srcdir}" go mod download -modcacherw
}

build() {
	cd "$srcdir/${pkgname::-4}"
	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"
	GOPATH="${srcdir}" go build
}

package() {
	cd "$srcdir/${pkgname::-4}"
	install -Dm755 "$srcdir/${pkgname::-4}/${pkgname::-4}" "$pkgdir/usr/bin/${pkgname::-4}"
	install -Dm644 "$srcdir/${pkgname::-4}/config.example.toml" "$pkgdir/usr/share/doc/${pkgname}/config.example.toml"
	install -Dm644 "$srcdir/${pkgname::-4}/COPYING" "$pkgdir/usr/share/licenses/${pkgname}/COPYING"
	for _shell in {bash,fish,zsh}
	do
		./${pkgname::-4} completion ${_shell} > "$srcdir/${pkgname::-4}-${_shell}"
	done
	install -Dm644 "$srcdir"/${pkgname::-4}-bash "$pkgdir/usr/share/bash-completion/completions/${pkgname::-4}"
	install -Dm644 "$srcdir"/${pkgname::-4}-fish "$pkgdir/usr/share/fish/completions/${pkgname::-4}.fish"
	install -Dm644 "$srcdir"/${pkgname::-4}-zsh "$pkgdir/usr/share/zsh/site-functions/_${pkgname::-4}"
}