# -*- 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           github   1.0
PortGroup           legacysupport 1.1
PortGroup           makefile 1.0

github.setup        michaelforney samurai 1.2
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            3

description         ninja-compatible build tool written in C.

long_description    samurai (samu) is a compatible replacement ninja build tool written in C99 with \
                    a focus on simplicity, speed, and portability. \
                    samurai implements the ninja build language through version 1.9.0 except \
                    for MSVC dependency handling (deps = msvc). It uses the same format for \
                    .ninja_log and .ninja_deps as ninja, currently version 5 and 4 respectively. \
                    It is feature-complete and supports most of the same options as ninja. \
                    The port provides the native `samu` command and a symlink so it can be called \
                    as `ninja` by standard build systems.

conflicts           ninja

categories          devel
maintainers         nomaintainer
license             Apache-2
installs_libs       no
supported_archs     x86_64 arm64 i386

checksums           rmd160  77ec117bd14e2dbbf57aa016ed1973990eb2c368 \
                    sha256  ddb3725e58bb4f8f645bf8a4f6a8d01c650999a13fc88c9c5f5037e327842c22 \
                    size    32540

patch {
    reinplace "s|/usr/local|${prefix}|g" ${worksrcpath}/Makefile
}

build.env-append    CC=${configure.cc} \
                    "CFLAGS=${configure.cflags}" \
                    "LDFLAGS=${configure.ldflags}"

build.target        samu

post-destroot {
    ln -s samu ${destroot}${prefix}/bin/ninja
    ln -s samu.1.gz ${destroot}${prefix}/share/man/man1/ninja.1.gz
}
