# Maintainer: PktSurf <smlinux@pktsurf.in>
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"

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

  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="
df1f75305eda70294d5217131a63a1f42fc5fd78fd5d73d53c930c81707e2a0750a137ccc739d111f398f0c49775c847b73b27e1f00931d7a174261eb253c409  chrony-4.2.tar.lz
"
