void-packages/srcpkgs/net-tools/template

53 lines
1.8 KiB
Bash

# Template file for 'net-tools'
pkgname=net-tools
version=2.10
revision=1
build_style="gnu-makefile"
make_use_env=yes
short_desc="Basic networking tools"
maintainer="0x5c <dev@0x5c.io>"
license="GPL-2.0-or-later"
homepage="https://github.com/ecki/net-tools"
distfiles="https://github.com/ecki/net-tools/archive/refs/tags/v${version}.tar.gz"
checksum=8e186f65f0ff304989b3dc8b0067c3a07d36ae777da60667bdd6ccb2730908d2
alternatives="
ifconfig:ifconfig:/usr/bin/${pkgname}-ifconfig
ifconfig:/usr/share/man/man1/ifconfig.1:/usr/share/man/man8/${pkgname}-ifconfig.8
hostname:hostname:/usr/bin/${pkgname}-hostname
hostname:/usr/share/man/man1/hostname.1:/usr/share/man/man8/${pkgname}-hostname.1"
post_patch() {
# Hacky and flaky, but upstream does not support $PREFIX !
vsed -e "s|/sbin|/bin|" -i Makefile
vsed -e "s|/bin|/usr/bin|" -i Makefile
case "$XBPS_TARGET_MACHINE" in
*-musl)
# HZ is defined in <asm/param.h>
vsed -i ${wrksrc}/lib/inet_sr.c \
-e "/#include <sys\/param.h>/a #include <asm\/param.h>"
vsed -i ${wrksrc}/netstat.c \
-e "/#include <sys\/param.h>/a #include <asm\/param.h>"
# Need <termios.h> for tty constants and structure
vsed -i ${wrksrc}/slattach.c \
-e "/#include <limits.h>/a #include <termios.h>"
esac
}
do_configure() {
replace_interpreter bash configure.sh
yes "" | make config
}
post_install() {
# Rename ifconfig for alternatives.
mv ${DESTDIR}/usr/bin/{ifconfig,${pkgname}-ifconfig}
mv ${DESTDIR}/usr/share/man/man8/{ifconfig,${pkgname}-ifconfig}.8
# Rename hostname(1) for alternatives.
mv ${DESTDIR}/usr/bin/{hostname,${pkgname}-hostname}
mv ${DESTDIR}/usr/share/man/man1/{hostname,${pkgname}-hostname}.1
# Remove dnsdomainname(1), conflicts with busybox/inetutils.
rm ${DESTDIR}/usr/bin/*domainname
rm ${DESTDIR}/usr/share/man/man1/*domainname*
}