# Template file for 'nawk'
pkgname=nawk
version=20180827
revision=1
wrksrc="awk-${version}"
hostmakedepends="bison"
short_desc="The one, true implementation of AWK"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
license="SMLNJ"
homepage="https://github.com/onetrueawk/awk"
changelog="https://raw.githubusercontent.com/onetrueawk/awk/master/ChangeLog"
distfiles="https://github.com/onetrueawk/awk/archive/${version}.tar.gz"
checksum=c9232d23410c715234d0c26131a43ae6087462e999a61f038f1790598ce4807f

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

do_configure() {
	sed -i '/maketab/{s/CC/BUILD_CC/;s/CFLAGS/BUILD_CFLAGS/}' makefile
	sed -i '/YACC = yacc -d -S/ s|^|#|' makefile
	sed -i 's/-lm/$(LDFLAGS) &/' makefile
}
do_build() {
	make CC=$CC CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS -DHAS_ISBLANK" LDFLAGS="$LDFLAGS"
}
do_install() {
	vbin a.out nawk
	vman awk.1 nawk.1
	vlicense LICENSE
}
