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

github.setup            iqtree iqtree3 3.1.3 v
github.tarball_from     archive
revision                0

categories              science
license                 GPL-2
maintainers             {reneeotten @reneeotten} openmaintainer

description             IQ-TREE version 3: software for phylogenetics
long_description        {*}${description}

homepage                https://iqtree.github.io

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

boost.depends_type      build
boost.version           1.88

depends_build-append    path:share/pkgconfig/eigen3.pc:eigen3 \
                        port:zlib \
                        port:gtest

depends_lib-append      port:lsd2

compiler.cxx_standard   2017
compiler.openmp_version 2.5

configure.args-append   -DUSE_CMAPLE=OFF \
                        -DUSE_LSD2=ON \
                        -DBUILD_TESTING=OFF \
                        -DIQTREE_TEST=OFF \
                        -DFETCHCONTENT_FULLY_DISCONNECTED=ON \
                        -DFETCHCONTENT_TRY_FIND_PACKAGE_MODE=ALWAYS

if {${os.platform} eq "darwin" && ${os.major} < 16} {
    configure.args-append \
                        -DIQTREE_FLAGS=oldmac
}

if {[string match *clang* ${configure.compiler}]} {
    configure.cxxflags-append   -I${prefix}/include/libomp
    configure.ldflags-append    -L${prefix}/lib/libomp
}

post-destroot {
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    foreach file {example.nex example.cf models.nex example.phy} {
        move ${destroot}${prefix}/${file} ${destroot}${prefix}/share/doc/${name}
    }
}

github.livecheck.regex  {([0-9.]+)}
