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

name                ViennaRNA
version             2.7.2
revision            0

categories          science
maintainers         {gmail.com:giovanni.bussi @GiovanniBussi} openmaintainer
description         C Library and programs for the prediction and comparison\
                    of RNA secondary structures.
long_description    The Vienna RNA Package consists of a C code library and\
                    several stand-alone programs for the prediction and\
                    comparison of RNA secondary structures.
homepage            https://www.tbi.univie.ac.at/RNA/
set branch          [join [lrange [split ${version} .] 0 1] _]_x
master_sites        ${homepage}download/sourcecode/${branch}/

# https://github.com/ViennaRNA/ViennaRNA/blob/master/license.txt
license             restrictive

checksums           rmd160  12e9c6b93a4efd8254750a033c365c0313e2ebac \
                    sha256  1ab5f4a4f76fc85a2243546088e45f5d85f2d7a56cc656e969b005cce9bfab5f \
                    size    67253851

compiler.cxx_standard 2011

configure.args-append \
                    --disable-silent-rules \
                    --disable-lto \
                    --with-cluster \
                    --without-kinwalker \
                    --without-kinfold \
                    --without-rnalocmin \
                    --without-doc \
                    --without-doc-pdf \
                    --without-doc-html \
                    --without-cla \
                    --without-cla-pdf \
                    --without-perl \
                    --without-python2 \
                    --without-python \
                    --without-swig \
                    --disable-vectorize \
                    --disable-simd

depends_build       path:bin/pkg-config:pkgconfig

depends_lib-append  port:gsl \
                    port:mpfr

test.run            yes
test.target         check

post-destroot {
    if {[file exists ${destroot}/RNA]} {
        delete -force ${destroot}/RNA
    }
}

variant native description {Enable CPU-specific optimizations} {
    configure.args-delete \
                    --disable-vectorize \
                    --disable-simd
}

variant python312 conflicts python313 python314 description {Enable python3.12 wrappers} {
    depends_build-append    port:swig-python
    depends_lib-append      port:python312
    configure.args-replace  --without-python --with-python
    configure.args-replace  --without-swig --with-swig
    configure.env-append    PYTHON3=${prefix}/bin/python3.12 \
                            PYTHON3_DIR=${frameworks_dir}/Python.framework/Versions/3.12/lib/python3.12/site-packages \
                            PYTHON3_EXECDIR=${frameworks_dir}/Python.framework/Versions/3.12/lib/python3.12/site-packages
}

variant python313 conflicts python312 python314 description {Enable python3.13 wrappers} {
    depends_build-append    port:swig-python
    depends_lib-append      port:python313
    configure.args-replace  --without-python --with-python
    configure.env-append    PYTHON3=${prefix}/bin/python3.13 \
                            PYTHON3_DIR=${frameworks_dir}/Python.framework/Versions/3.13/lib/python3.13/site-packages \
                            PYTHON3_EXECDIR=${frameworks_dir}/Python.framework/Versions/3.13/lib/python3.13/site-packages
}

variant python314 conflicts python312 python313 description {Enable python3.14 wrappers} {
    depends_build-append    port:swig
    depends_lib-append      port:python314
    configure.args-replace  --without-python --with-python
    configure.args-replace  --without-swig --with-swig
    configure.env-append    PYTHON3=${prefix}/bin/python3.14 \
                            PYTHON3_DIR=${frameworks_dir}/Python.framework/Versions/3.14/lib/python3.14/site-packages \
                            PYTHON3_EXECDIR=${frameworks_dir}/Python.framework/Versions/3.14/lib/python3.14/site-packages
}
