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

# utimensat
legacysupport.newest_darwin_requires_legacy 15

github.setup        xmake-io xmake 3.0.9 v
github.tarball_from archive
revision            0

homepage            https://xmake.io/

description         A cross-platform build utility based on Lua

long_description    \
    Xmake is a cross-platform build utility based on the Lua scripting \
    language. Xmake is very lightweight and has no dependencies outside of \
    the standard library. Uses the xmake.lua file to maintain project builds \
    with a simple and readable syntax.

categories          devel
installs_libs       no
license             Apache-2
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

fetch.type          git

# https://trac.macports.org/ticket/70544
# https://github.com/xmake-io/xmake/issues/6748
# cleanup unnecessary flags
patchfiles-append   patch-fix-flags.diff

depends_build-append \
                    path:bin/pkg-config:pkgconfig

depends_lib-append  port:ncurses

if {${os.platform} eq "darwin" && ${os.major} < 16} {
    # "SSL certificate problem: Invalid certificate chain" on macOS <10.12
    # Only use non-system Git on legacy systems
    depends_build-append \
                    path:bin/git:git
    git.cmd         ${prefix}/bin/git
}

post-fetch {
    system -W ${worksrcpath} "git submodule update --init --recursive"
}

# requirement for downloaded dependencies
compiler.c_standard 2011
compiler.cxx_standard \
                    2011
# error: unknown directive on macOS <10.9
compiler.blacklist-append \
                    {clang < 600}

build.args-append   VERBOSE=1
