summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 06164f29262fca0c6e12fe5d4d0dae2107a4b57c (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
# Maintainer: HurricanePootis <hurricanepootis@protonmail.com>
pkgname=scotty
pkgver=0.7.1
pkgrel=3
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')
source=("git+$url#tag=v${pkgver}")
sha256sums=('74370775d15be853afc6102ae9d030668398698a9e34c43f01bf987b8999d4c2')

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


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