pkgname=inetutils
pkgver=2.6
pkgdesc="A collection of common network programs"
homepage="https://www.gnu.org/software/inetutils/"
license=('GPL-3.0-or-later')
sources=("${pkgname}-${pkgver}.tar.xz")
urls=("https://ftp.gnu.org/gnu/${pkgname}/${sources[0]}")
md5sums=("401d7d07682a193960bcdecafd03de94")

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
  sed -i 's/def HAVE_TERMCAP_TGETENT/ 1/' telnet/telnet.c
}

src_build() {
  ./configure --prefix=/usr        \
              --bindir=/usr/bin    \
              --localstatedir=/var \
              --disable-logger     \
              --disable-whois      \
              --disable-rcp        \
              --disable-rexec      \
              --disable-rlogin     \
              --disable-rsh        \
              --disable-servers
  make
}

src_check() {
  make check
}

src_install() {
  make DESTDIR="${pkgdir}" install
  install -d -m 755 "${pkgdir}/usr/sbin/"
  mv -v "${pkgdir}"/usr/{,s}bin/ifconfig
}

