app=chrony
version=4.2
build=1sml
homepage="https://chrony.tuxfamily.org/"
download="https://download.tuxfamily.org/chrony/chrony-$version.tar.gz"
desc="Lightweight program to maintain accuracy of the real time clock via NTP"
requires="nettle libcap"

build() {
  mkandenterbuilddir
  rm -rf $app-$version

  tar xf $srcdir/$app-$version.tar.?z*
  cd $app-$version
  fixbuilddirpermissions

  ./configure \
    --prefix="" \
    --bindir=/bin \
    --sbindir=/bin \
    --mandir=/share/man

  make $MAKEFLAGS
  make install DESTDIR=$pkg

  cp COPYING $pkgdocs/

  install -Dm 644 $srcdir/chrony.conf $pkg/etc/chrony.conf.new
  # raspberry pi example
  install -Dm 644 $srcdir/chrony.conf.rpi $pkg/etc/chrony.conf.rpi.new
  install -Dm 644 $srcdir/README $pkg/etc/chrony.README

  mkdir -p $pkg/var/lib/chrony

  preprunitservice chrony down

  mkfinalpkg
}

sha512sums="
7f946b27de605b3ebea62cf23916dfad77c99e8b2338ba239ede6b8216ce436b3d4d87770f371c8d8e006507c51d5c831b51f067957abd2935adfdec3f5aa67d  chrony-4.2.tar.gz
"
