# -*- 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           cmake 1.1
PortGroup           java 1.0

name                astyle
version             3.6.11
set branch          [join [lrange [split ${version} .] 0 1] .]
revision            0
categories          devel
license             MIT
maintainers         nomaintainer

description         source code beautifier for the C, C++, C# and Java programming languages
long_description    Artistic Style is a source code indenter, source code formatter, \
                    and source code beautifier for the C, C++, C# and Java \
                    programming languages.

homepage            https://astyle.sourceforge.net
master_sites        sourceforge:project/astyle/astyle/astyle%20${branch}
use_bzip2           yes
checksums           rmd160  4e090bc7f9375fca3e1f7fde84cf1eceb1948dd8 \
                    sha256  0eabee3fd9d07406772abce93241d62c1f47d456d3f941cbf15af9c23dc74ad6 \
                    size    217154

patchfiles          dont-force-stdlib.diff

compiler.cxx_standard   2017

# The <filesystem> header is only provided by Xcode 11 and later.
compiler.blacklist-append {clang < 1100}

# This build system can only build one thing at a time. Since we want several
# things, we have to do each one separately. Docs will be installed with the
# exectuable.
set builds {
                    executable  {-DINSTALL_DOC=ON}
                    shared      {-DBUILD_SHARED_LIBS=ON}
                    static      {-DBUILD_STATIC_LIBS=ON}
}

configure {
    foreach {build_type configure_args} ${builds} {
        cmake.build_dir         ${workpath}/build-${build_type}
        configure.args-append   {*}${configure_args}
        portconfigure::configure_main
        configure.args-delete   {*}${configure_args}
    }
}

build {
    foreach {build_type configure_args} ${builds} {
        cmake.build_dir         ${workpath}/build-${build_type}
        portbuild::build_main
    }
}

destroot {
    foreach {build_type configure_args} ${builds} {
        cmake.build_dir         ${workpath}/build-${build_type}
        portdestroot::destroot_main
    }
}

variant java description {Build and install the JNI library} {
    global builds
    lappend builds  java        {-DBUILD_JAVA_LIBS=ON}
}

livecheck.regex     "[quotemeta $name]-(\\d+(\\.\\d+)*)"
