# -*- 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
# $Id$

PortSystem          1.0
PortGroup           github 1.0

epoch               1
github.setup        ninja-build ninja 1.7.1 v
categories          devel
platforms           darwin
maintainers         nomaintainer
license             Apache-2
installs_libs       no

description         Small build system with a focus on speed.

long_description    Ninja is yet another build system. It takes as input    \
                    the interdependencies of files (typically source code   \
                    and output executables) and orchestrates building them, \
                    quickly.                                                \
                                                                            \
                    Ninja joins a sea of other build systems. Its           \
                    distinguishing goal is to be fast. It is born from my   \
                    work on the Chromium browser project, which has over    \
                    30,000 source files and whose other build systems       \
                    (including one built from custom non-recursive          \
                    Makefiles) can take ten seconds to start building       \
                    after changing one file. Ninja is under a second.

homepage            https://ninja-build.org

checksums           rmd160  16a67643cf07dd695c3c68b29e058a62e8e06cb5 \
                    sha256  e8d7aca6141d7fb79efa757b86e8e20f3f40f8f55b7986de4af18a0064e3763e

patchfiles          patch-configure.py-use-system-python.diff \
                    patch-configure.py-bootstrap-only.diff \
                    patch-configure.diff


variant universal {}

depends_build-append \
                   port:re2c

configure.cxx      "${configure.cxx} [get_canonical_archflags cxx]"

build.cmd           ./ninja
build.target
build.args
build.env           CXX="${configure.cxx} [get_canonical_archflags cxx]"

post-patch {
    file attributes ${worksrcpath}/configure -permissions +x
}

destroot {
    xinstall -m 755 ${worksrcpath}/${name} ${destroot}${prefix}/bin
    xinstall -d ${destroot}${prefix}/etc/bash_completion.d
    xinstall -m 644 ${worksrcpath}/misc/bash-completion ${destroot}${prefix}/etc/bash_completion.d/ninja
}