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

name                armadillo
version             14.6.2
revision            0

categories          science
maintainers         {mps @Schamschula} openmaintainer
license             Apache-2

description         Armadillo C++ linear algebra library

long_description    Armadillo is a C++ linear algebra library (matrix maths) \
                    aiming towards a good balance between speed and ease of use. \
                    Integer, floating point and complex numbers are supported, \
                    as well as a subset of trigonometric and statistics functions. \
                    Various matrix decompositions are provided through optional \
                    integration with LAPACK or high-performance LAPACK-compatible \
                    libraries.

homepage            http://arma.sf.net/
master_sites        sourceforge:project/arma

use_xz              yes

checksums           rmd160  91a89c83904ed4b7fc1ac84d916859b3f6fda25b \
                    sha256  49ddb76670b1d1a142f760637e653ec5b20ba730e7630a2f3c2b13d324c37e08 \
                    size    7159264

depends_build-append \
                    port:pkgconfig

depends_lib-append  port:hdf5

mpi.setup
mpi.enforce_variant hdf5
 
configure.args-append \
                    -DARPACK_LIBRARY=

variant arpack description {compile with ARPACK support} {
    depends_lib-append      port:arpack
    configure.args-delete   -DARPACK_LIBRARY=
}

variant openblas description {compile with OpenBLAS support} {
    depends_lib-append      path:lib/libopenblas.dylib:OpenBLAS
    configure.args-append   -DALLOW_BLAS_LAPACK_MACOS=TRUE \
                            -DALLOW_OPENBLAS_MACOS=ON
}

variant superlu description {compile with SuperLU support} {
    depends_lib-append      port:superlu
    configure.args-append   -DARMA_USE_SUPERLU=ON
}

if {${os.platform} eq "darwin" && ${os.major} < 11} {
    # Without OpenBLAS the build fails on Leopard and Rosetta with undefined symbols.
    # https://trac.macports.org/ticket/65292
    # -DALLOW_OPENBLAS_MACOS=ON is necessary.
    default_variants        +openblas
}

# Fix https://trac.macports.org/ticket/59173,
# also see https://trac.macports.org/ticket/56554
if {[variant_isset gcc44] || [variant_isset gcc45] || [variant_isset gcc46] || \
    [variant_isset gcc47] || [variant_isset gcc48] || [variant_isset gcc49] || \
    [variant_isset gcc5] || [variant_isset gcc6] || [variant_isset gcc7] || \
    [variant_isset gcc8] || [variant_isset gcc9]} {
    configure.cxx_stdlib    libstdc++
}

compiler.cxx_standard \
                    2011
compiler.thread_local_storage \
                    yes

livecheck.type      regex
livecheck.url       ${homepage}download.html
livecheck.regex     /${name}-(\[0-9.\]+)${extract.suffix}
