# Template file for 'gawk'
pkgname=gawk
version=5.1.1
revision=1
build_style=gnu-configure
configure_args="--with-readline"
makedepends="readline-devel"
short_desc="GNU awk utility"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="GPL-3.0-or-later"
homepage="https://directory.fsf.org/wiki/Gawk"
distfiles="${GNU_SITE}/${pkgname}/${pkgname}-${version}.tar.xz"
checksum=d87629386e894bbea11a5e00515fc909dc9b7249529dad9e6a3a2c77085f7ea2
lib32disabled=yes

provides="awk-0_1"
alternatives="
 awk:awk:/usr/bin/gawk
 awk:awk.1:/usr/share/man/man1/gawk.1"

pre_check() {
	vsed -i 's/done | more/done/g' test/Makefile

	# This fixes tests on glibc, relevant tests on musl are disabled
	# because the locale command doesn't exist.
	vsed -i 's/en_US.ISO-8859-1//' test/localenl.sh
	vsed -i '/^LC_ALL=en_US.ISO-8859-1 passed$/d' test/localenl.ok

	case "$XBPS_TARGET_MACHINE" in
		*-musl)
			vsed -i '/testext/d' test/Makefile
			vsed -i '/clos1way6/d' test/Makefile ;;
	esac
}

post_install() {
	rm ${DESTDIR}/usr/bin/awk
}
