Username: Password: Remember me
# NOTICE: This is this package's last update on the CCR until someone
# else adopts it. If you do so, then please update the "Maintainer"
# line below with your information. You may also find the following
# PKGBUILD update script useful:
# https://gist.github.com/refola/cf216e6413b3bd286487df5de2cc9dde
 
# Maintainer: Your Name Here <email address at domain dot tld>
# Contributor (1.1.1 thru 1.11.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.11.1
pkgrel=0
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=('c92ce4693bb1be445e478cbbcfdc26e88763dbd3c5fe7fe48615cfe4b915341cf12fd06dad1de937c11c8b00239597ed2476f089997cb54b969d6044b11fe6eb')
 
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/{}" \;
}