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

name                shtools
revision            0

categories          science math
platforms           darwin
license             BSD
maintainers         {@MarkWieczorek aleeas.com:github.59oty}
description         Spherical Harmonic Tools
long_description    SHTOOLS is a library of Fortran 95 software that can be \
                    used to perform spherical harmonic transforms, multitaper \
                    spectral analyses, expansions of functions into Slepian \
                    bases, and standard operations on global gravitational \
                    and magnetic field data. Requires linking with FFTW-3 and \
                    LAPACK compatible libraries.
homepage            https://shtools.github.io/SHTOOLS/index-fortran.html

github.setup        SHTOOLS SHTOOLS 4.13.1 v
github.tarball_from   releases
checksums           sha256  d5890049fb915604f25576cbbb9f18980a3fc88d28fe380809e3c3497448dacb \
                    rmd160  0e1ac881e89a3538392ea6d6a2a521b09032385a \
                    size    41573197

use_configure       no

compilers.choose    f90
compilers.setup     default_fortran

pre-build {
    build.args      F95=${configure.f90}
}
build.target        fortran

variant openmp description {Add OpenMP support} {
    use_parallel_build      no
    build.target-append     fortran-mp
}

pre-test {
    test.args       F95=${configure.f90} \
                    PREFIX=${prefix} \
                    LAPACK="-lopenblas" \
                    BLAS=""
}
test.run            yes
test.target         fortran-tests-no-timing

destroot.args       PREFIX=${prefix}

depends_test        [fortran_variant_depends]
depends_lib         port:fftw-3 \
                    port:openblas
