summaryrefslogtreecommitdiff
path: root/pcr/discosrv/PKGBUILD
blob: 13b169a8b2e6f1181f9407ad554dc265eae4c7d8 (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
# Maintainer : fauno <fauno@parabola.nu>

_pkgname=discosrv
pkgname=${_pkgname}-git
pkgver=2014.12.27
pkgrel=1
pkgdesc="Discovery server for syncthing"
url="https://github.com/syncthing/discosrv"
license=('GPL3' 'custom:BSD1' 'custom:BSD3' 'Apache')
arch=('i686' 'x86_64')
depends=('glibc')
makedepends=('git' 'go' 'godep')
install=${_pkgname}.install
source=(https://repo.parabola.nu/other/${pkgname}/${pkgname}-${pkgver}.tar.xz{,.sig}
        ${_pkgname}.service)
md5sums=('4ddae1dd5cb4745953e97d7537ad36c3'
         'SKIP'
         '511efdc439b909da5cc7e3037b2a4391')

mksource() {
  set -o pipefail
  mkdir -p "${pkgname}-${pkgver}"
  export GOPATH="${srcdir}/${pkgname}-${pkgver}"

  go get -d github.com/syncthing/discosrv
}

build() {
  export GOPATH="${srcdir}/${pkgname}-${pkgver}"
  cd "${srcdir}/${pkgname}-${pkgver}/src/github.com/syncthing/${_pkgname}"
  go build
}

package() {
  cd "${srcdir}/${pkgname}-${pkgver}/src/github.com/syncthing/${_pkgname}"
  install -D -m 755 ${_pkgname} "${pkgdir}/usr/bin/${_pkgname}"

  for license in "${srcdir}/${pkgname}-${pkgver}"/src/*/*/*/LICENSE; do
    local dir="$(dirname "${license}")"
    install -Dm 644 "${license}" "${pkgdir}/usr/share/licenses/${pkgname}/${dir##*/}/LICENSE"
  done

  install -dm750 --owner nobody --group nobody ${pkgdir}/var/discosrv
  install -Dm644 ${srcdir}/${_pkgname}.service ${pkgdir}/usr/lib/systemd/system/${_pkgname}.service
}