# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           muniversal 1.1

name                bmake
version             20260406
revision            0
checksums           rmd160  c761149450be8bedd2ae64e424b594fa3b3138a7 \
                    sha256  ed6e5fa0d661ea3c71d12e7481cbbcac6f2bff34051ce36ae7575811766adf26 \
                    size    900053

categories          devel
maintainers         {ryandesign @ryandesign} openmaintainer
license             BSD

homepage            http://www.crufty.net/help/sjg/bmake.html
master_sites        http://www.crufty.net/ftp/pub/sjg/

description         Portable NetBSD make
long_description    bmake is the portable version of NetBSD make.

worksrcdir          ${name}

patchfiles          boot-strap.patch

# https://trac.macports.org/wiki/WimplicitFunctionDeclaration#strchr
configure.checks.implicit_function_declaration.whitelist-append strchr

# No idea what the legal values are or how these are used. These values should
# more or less match the defaults except that I haven't checked ppc64.
configure.args.arm64    --with-machine=arm64    --with-machine_arch=arm
configure.args.i386     --with-machine=i386     --with-machine_arch=i386
configure.args.ppc      --with-machine=powerpc  --with-machine_arch=powerpc
configure.args.ppc64    --with-machine=powerpc  --with-machine_arch=powerpc
configure.args.x86_64   --with-machine=x86_64   --with-machine_arch=i386

configure.cmd       ./boot-strap
configure.post_args op=configure
configure.args      --objdir build \
                    --without-makefile

build.cmd           ${configure.cmd}
build.target        op=build
build.args          {*}${configure.pre_args} \
                    {*}${configure.args}

destroot.target     op=install
destroot.args       {*}${configure.pre_args} \
                    {*}${configure.args}

if {[variant_isset universal]} {
    destroot.args-append \
                    BMAKE=[muniversal::get_arch_dir ${build.dir} ${configure.build_arch}]/build/bmake
}

# Tests are already run after the build but you can also run them separately.
test.target         op=test
test.args           {*}${configure.pre_args} \
                    {*}${configure.args}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     "${name}-(\[\\d\]+)${extract.suffix}"
