# Template file for 'lok'
pkgname=lok
version=6.2
revision=1
build_style=gnu-makefile
short_desc="A Linux port of OpenBSD's awk"
maintainer="maxice8 <thinkabit.ukim@gmail.com>"
license="ISC"
homepage="https://github.com/dimkr/lok"
distfiles="https://github.com/dimkr/lok/archive/${version}.tar.gz"
checksum=17215d1ef5760e282562bd852abab5ac5ae136fe579c02bb8fb6f9734e2c3185
make_build_args="PROG=lok" # Make the binary built be called lok
make_install_args="PROG=lok MANDIR=usr/share/man"

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

pre_build() {
	sed -i 's|^PROG=.*||g' Makefile # PROG variable is hard-defined
	sed -i 's|^MANDIR=.*||g' Makefile # MANDIR variable is set wrong and hard-defined
}

pre_install() {
	mv "${wrksrc}"/{awk,lok}.1 # rename the manpage to lok
}

post_install() {
	sed -n 3,23p README.upstream > LICENSE
	vlicense LICENSE
}
