summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d2c7e8487c45203f1990aaf8d98d56f3617b3507 (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: Julien Virey <julien.virey@gmail.com>

pkgname=rarbg-selfhosted
pkgver=0.0.5
pkgrel=3
pkgdesc='A self-hosted Torznab API for the RARBG backup, compatible with Prowlarr, Radarr, Sonarr etc.'
arch=('x86_64')
url='https://github.com/mgdigital/rarbg-selfhosted'
license=('BSD')
makedepends=(go)
options=(!lto)
source=(
  rarbg-selfhosted-$pkgver.tar.gz::$url/archive/refs/tags/v$pkgver.tar.gz
  rarbg-selfhosted.service
  )
sha256sums=('6aa61545d50dd301104bd52fefe458bff7dece0339dec6d2e1b15419b823e318'
            'b93a74382119cb82cd06973954e31fa6fe6ae33c07ae9d941d14941654309ce5')

install=rarbg-selfhosted.install

prepare(){
    cd "$pkgname-$pkgver"
    export GOPATH="${srcdir}"
    go mod download
}

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

  go build \
    -ldflags "-linkmode external -extldflags $LDFLAGS" \
    -o $pkgname
}

package() {
  cd "$pkgname-$pkgver"
  install -Dm755 $pkgname "$pkgdir"/usr/bin/$pkgname
  install -Dm644 trackers.txt -t "${pkgdir}"/usr/share/${pkgname}
  install -Dm644 ../rarbg-selfhosted.service -t "$pkgdir"/usr/lib/systemd/system/
}