# Maintainer: PktSurf <smlinux@pktsurf.in>
app=chrony
version=4.4
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"

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

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

build() {
  ./configure \
    --prefix="" \
    --bindir=/bin \
    --sbindir=/bin \
    --mandir=/share/man \
    --with-user=chrony

  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 -s chrony -d

  mkfinalpkg
}

sha512sums="
6c8c39864dbfcfac8e6a9c3a09fbe91c5f697d987eb044bf241c78b4654b55e968544cebfe644563b199cc7632a14aea1da4cb07b7ebe60f6a152334cf23af9a  chrony-4.4.tar.lz
"