description="Portable version of the NetBSD 'make' build tool"
url="http://www.crufty.net/help/sjg/bmake.html"

packager="tnut at nutyx dot org"
contributors="Rems"

name=bmake
version=20181221

source=(http://www.crufty.net/ftp/pub/sjg/bmake-$version.tar.gz)

build(){
    cd $name
    # Add missing bsd.*.mk symlinks (thanks to Arch)
    _links_orig="dep doc init lib links man nls obj own prog subdir"
    _links_new="dep doc inc init lib links man nls obj own prog subdir"
    sed -i -e "s/$_links_orig/$_links_new/" mk/install-mk

    cd ..
    mkdir -p bmake-build
    cd bmake-build
    sh ../bmake/boot-strap --prefix=/usr op=build

    cd ../bmake-build
    # Fix directory permissions on install
    install -dm0755 $PKG/usr/bin
    install -dm0755 $PKG/usr/share/man/cat1
    sh ../bmake/boot-strap --prefix=/usr --install-destdir=$PKG op=install
}
uptodate() {
local url ext
ext=".tar.gz"
url="http://www.crufty.net/ftp/pub/sjg/"

lynx -read_timeout=20 -dump -listonly -nonumbers \
$url?C=M\;O=D|grep $ext$|grep $url$name-|sed "s@$url$name-@@"|sed "s@$ext@@"|head -1
}
