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

# Temporary switch to commit to pick up fixes from upstream:
# https://github.com/stclib/STC/issues/60
# https://github.com/stclib/STC/issues/61
github.setup        stclib STC 19501aacdcb9ed90618fd494e353d8ff65a4210c
version             4.2
revision            3

categories          devel
platforms           any
supported_archs     noarch
license             MIT
maintainers         {mascguy @mascguy} {@barracuda156 gmail.com:vital.had} openmaintainer

description         A modern, user-friendly, generic, type-safe and fast C99 container library
long_description    {*}${description} featuring string, vector, sorted and unordered map and set,\
                    deque, forward list, smart pointers, bitset and random numbers.

checksums           rmd160  524ee9078b45f9b4392d3322a0518c1516d77de4 \
                    sha256  30b96748a5e192366d95fa6d7090bdd4f895b4f5c2e633f082309a5273638bcf \
                    size    1284438
github.tarball_from archive

compiler.c_standard 1999
cmake.set_c_standard yes

configure.args-append \
                    -DBUILD_TESTING=OFF

# Needs support for atomic operations.
# Re Xcode clang: https://github.com/stclib/STC/issues/62
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2 {clang < 1200}

destroot {
    set incdir ${prefix}/include/${name}
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${incdir}
    xinstall -d ${destroot}${docdir}
    foreach srcdir [list c11 stc] {
        copy ${worksrcpath}/include/${srcdir} ${destroot}${incdir}
    }
    copy ${worksrcpath}/docs ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} LICENSE README.md ${destroot}${docdir}
}

variant tests description {Enable tests} {
    configure.args-replace \
                    -DBUILD_TESTING=OFF \
                    -DBUILD_TESTING=ON

    test.run        yes
    test.cmd        ctest
}
