# Maintainer: PktSurf <smlinux@pktsurf.in>
app=iputils
version=s20180629
build=1sml
homepage="https://github.com/iputils/iputils"
download="https://github.com/iputils/iputils/archive/refs/tags/$version.tar.gz"
desc="Collection of common network tools"
requires="libcap iptables"

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

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

  applypatch $srcdir/fix-defines.patch
  applypatch $srcdir/fix-init-of-cmsg.patch
}

build() {
  make CC="$CC" all USE_GCRYPT=no USE_CRYPTO=no USE_NETTLE=no USE_CAP=no USE_IDN=no

  for f in arping clockdiff ping rarpd rdisc tracepath traceroute6 tftpd ; do
   install -Dm 755 "$f" $pkg/bin/"$f"
  done

  # Set the SUID bit on ping
  chmod u+s $pkg/bin/ping

  cp LICENSE* $pkgdocs/

  mkfinalpkg
}

sha512sums="
b059ef63b01e08b1b7856cd5ef231f14ef87c30a404b480978e4d085b1f71574b077998f02c2e10de42399123cb8c758bad5c4dafb00ed9e2cd005145ac96423  iputils-s20180629.tar.lz
85c766b2cd738aeedb8dda8100af5814d9c0b4b62d6e98ca4329e3d34b19845e34bde772ca27e79360b7911cdb51bad11ca8f7717a367286c08243471fb32c47  fix-defines.patch
2779b9d987089a2a9a39c27a092f16da85881e9dfbc99edcca6baea42912b8a1a7e16b00c19684d2ea1a6123d66f78be12bef43398e63be7d7c97d3d6269a5bf  fix-init-of-cmsg.patch
"
