# -*- 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           compilers 1.0
PortGroup           github 1.0
PortGroup           linear_algebra 1.1

github.setup        jchristopherson linalg 1.8.6 v
revision            0
categories          math science
license             GPL-3
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         Linear algebra library that provides a user-friendly interface \
                    to several BLAS and LAPACK routines
long_description    {*}${description}
checksums           rmd160  2c2ee5a048b2c8db818e62a211295a79679c6b68 \
                    sha256  2ccd547e2a73f007fe611f6dbf6ed652ed98f9b3a21ebd037547c4faa33c5e9e \
                    size    2468286
github.tarball_from archive

depends_lib-append  port:qrupdate

if {${os.major} < 14} {
    # Lion+ (with Xcode 4.1+) have git; earlier need to bring their own.
    # However Lion through Mavericks fail with SSL errors.
    depends_build-append \
                    path:bin/git:git
    git.cmd         ${prefix}/bin/git
}

compilers.choose    fc cc
compilers.setup     require_fortran

compiler.c_standard 2011

if {![variant_isset accelerate] && ![variant_isset atlas] && ![variant_isset blis] \
    && ![variant_isset flexiblas] && ![variant_isset openblas]} {
        default_variants-append +accelerate
}

# Needed in order for correct version of BLAS to be picked:
pre-configure {
    configure.args-append ${cmake_linalglib}
}

configure.args-append \
                    -DBUILD_C_API=ON \
                    -DBUILD_TESTING=ON \
                    -DBUILD_LINALG_EXAMPLES=OFF

test.run            yes
test.cmd            ctest
