description="Programs for basic and advanced network routing."
url="https://www.kernel.org/pub/linux/utils/net/iproute2/"

packager="Grat-OS Team"
maintainer="Grat-OS Team"

name=iproute2
version=6.12.0
release=1

PKGMK_GROUPS=(devel man doc)

source=($url/iproute2-$version.tar.xz)

build() {
  cd iproute2-$version

  sed -i /ARPD/d Makefile
  sed -i 's/arpd.8//' man/man8/Makefile

  # disable building one module that requires iptables
  sed -i 's/.m_ipt.o//' tc/Makefile

  make NETNS_RUN_DIR=/run/netns
  make DESTDIR=$PKG \
      DOCDIR=/usr/share/doc/iproute2-$version \
      SBINDIR=/usr/sbin \
      install
}

devel() {
  cd $PKG
  bsdtar -cf \
  $PKGMK_PACKAGE_DIR/${name}.devel${PKGMK_BUILDVER}any.$PKGMK_PACKAGE_EXT \
  usr/lib

  rm -r usr/lib
}
