summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 61ad8f1bc62b8d2184e3ec917bee17b23d62ffe0 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
_gitname="Sonarr"
_gitver="2.0.0"
_gitbranch="develop"

pkgname="sonarr-git"
pkgver=2.0.0.r6923.713e109
pkgrel=1
pkgdesc="Automated TV series manager and downloader - git branch ${_gitbranch}"
arch=(any)
url="https://sonarr.tv"
license=('GPL3')
groups=()
depends=('mono'
         'libmediainfo'
         'sqlite')
makedepends=('git'
             'npm'
             'nodejs')
optdepends=()
provides=('sonarr')
conflicts=('sonarr'
           'sonarr-develop')
replaces=()
backup=()
options=('!strip')
install='sonarr.install'
changelog=
source=("git://github.com/Sonarr/Sonarr.git#branch=${_gitbranch}"
        "sonarr.sh"
        "sonarr.service"
        "0001-Mono-Set-process-name.patch")
sha256sums=('SKIP'
            'd594c4d5ad3c1b196a00cb9f005d4917ad4d8bb2ebf501010e8be7f349b3caa6'
            '1ebf903e6199dae6032c7839b00ed20566404daf87cb307ffc9ee8539722a845'
            '28ed9a1aa71d0d255c18e2ca17c52b845f69c19e3d2653607cff9a7f478931e1')


pkgver() {
  cd "${_gitname}"

  printf "%s.r%s.%s" "${_gitver}" "$(git rev-list --count ${_gitbranch})" "$(git rev-parse --short  ${_gitbranch})"
}

prepare() {
  cd "${_gitname}"

  # Install necessary nodejs libraries
  npm install

  msg2 "Patching Mono-Set-process-name"
  git apply --ignore-whitespace "${srcdir}/0001-Mono-Set-process-name.patch"

  git submodule update --init
}

build() {
  cd "${_gitname}"

  export MONO_IOMAP=case
  mono ./tools/nuget/nuget.exe restore ./src/NzbDrone.sln
  xbuild ./src/NzbDrone.sln /t:Configuration=Release /t:Build

  node ./node_modules/gulp/bin/gulp.js build
}

package() {
  find "${_gitname}/_output/" \( \
        -name "ServiceUninstall.*" \
     -o -name "ServiceInstall.*" \
     -o -name "sqlite3.*" \
     -o -name "MediaInfo.*" \
     -o -name "NzbDrone.Windows.*" \
   \) -type f -delete

  install -d "${pkgdir}/var/lib/sonarr"

  install -Dm755 "sonarr.sh" "${pkgdir}/usr/bin/sonarr"
  install -Dm644 "sonarr.service" "${pkgdir}/usr/lib/systemd/system/sonarr.service"

  install -d "${pkgdir}/opt/sonarr"
  cp -a "${_gitname}/_output/"* "${pkgdir}/opt/sonarr"
  find "${pkgdir}/opt/sonarr" -type d -exec chmod 755 {} \;
  find "${pkgdir}/opt/sonarr" -type f -exec chmod 644 {} \;
  find "${pkgdir}/opt/sonarr" -name \*.exe -type f -exec chmod 755 {} \;
}