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.10.0
pkgrel=1
pkgdesc='Open Source Continuous File Synchronization'
arch=(x86_64)
url='https://syncthing.net'
license=(MPLv2)
depends=(glibc)
makedepends=(git 'go>=1.14' inetutils)
source=("https://github.com/syncthing/syncthing/releases/download/v${pkgver}/syncthing-source-v${pkgver}.tar.gz")
b2sums=('4bb976b993ff1545c6ec9eba8ae3b0b9fc1e4ba3ef81c0f0796a62fff57559f8c631d3bb29df24ed0ca57ea1b1d6a766068a67572c7cafdeb361b5ba8a38b681')
 
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"
  find . -name '*.1' -exec \
       install -Dm644 "{}" "${pkgdir}/usr/share/man/man1/{}" \;
  find . -name '*.5' -exec \
       install -Dm644 "{}" "${pkgdir}/usr/share/man/man5/{}" \;
  find . -name '*.7' -exec \
       install -Dm644 "{}" "${pkgdir}/usr/share/man/man7/{}" \;
}