Username: Password: Remember me
# Maintainer (as of 1.1.1): Mark Haferkamp <chakralinux.org@refola.com>
# Contributor ([desktop] repo to CCR): Justin berthault <justin.berthault@zaclys.net>
# Contributors from package's [desktop] era: https://code.chakralinux.org/chakra/packages/desktop/commits/497b2449f7c2beb43441338567b86698abb1db77/syncthing/PKGBUILD
 
pkgname='syncthing'
pkgver="1.3.0"
pkgrel="1"
pkgdesc="Open Source Continuous File Synchronization"
arch=('x86_64')
url="https://syncthing.net"
license=('MPLv2')
depends=('glibc')
makedepends=('git' 'go' 'inetutils')
source=("https://github.com/syncthing/syncthing/releases/download/v${pkgver}/syncthing-source-v${pkgver}.tar.gz")
sha256sums=('684c4700b6f51d4fc89b422fbc3f26cae703df4649e74e20783c2d0cf845538e')
 
prepare() {
  install -d "src/github.com/syncthing"
  mv "${pkgbase}" "src/github.com/syncthing/${pkgbase}"
}
 
build() {
  export GOPATH="${srcdir}" GOROOT_FINAL="/usr/bin"
  cd "${srcdir}/src/github.com/syncthing/${pkgbase}"
  go run build.go -no-upgrade -version "v${pkgver}" build
}
 
check() {
  export GOPATH="${srcdir}" GOROOT_FINAL="/usr/bin"
  cd "${srcdir}/src/github.com/syncthing/${pkgbase}"
  if [ "${CARCH}" == "x86_64" ] ; then
    go run build.go -no-upgrade test
  fi
}
 
package() {
  install="$pkgname.install"
 
  cd "${srcdir}/src/github.com/syncthing/${pkgbase}"
  install -Dm755 "${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
  install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
  install -Dm644 "etc/linux-systemd/system/${pkgname}-resume.service" \
          "${pkgdir}/usr/lib/systemd/system/${pkgname}-resume.service"
  install -Dm644 "etc/linux-systemd/system/${pkgname}@.service" \
          "${pkgdir}/usr/lib/systemd/system/${pkgname}@.service"
  install -Dm644 "etc/linux-systemd/user/${pkgname}.service" \
          "${pkgdir}/usr/lib/systemd/user/${pkgname}.service"
 
  # license
  install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
 
  # ufw preset
  install -Dm644 etc/firewall-ufw/syncthing \
          "$pkgdir/etc/ufw/applications.d/ufw-syncthing"
 
  # man pages
  cd "${srcdir}/src/github.com/syncthing/${pkgname}/man"
  for file in $(find . -name '*.1' -print); do
    install -Dm644 "$file" "${pkgdir}/usr/share/man/man1/$file"
  done
  for file in $(find . -name '*.5' -print); do
    install -Dm644 "$file" "${pkgdir}/usr/share/man/man5/$file"
  done
  for file in $(find . -name '*.7' -print); do
    install -Dm644 "$file" "${pkgdir}/usr/share/man/man7/$file"
  done
}