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

github.setup        eiscor eiscor 849f56c64eb79a4fd75c46c9d2591045a6d5c889
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             0.2.0
revision            0
categories          math fortran
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             MIT
description         eigensolvers based on unitary core transformations
long_description    This package is a collection of Fortran 90 subroutines \
                    for accurately and efficiently solving matrix eigenvalue problems \
                    using essentially 2×2 unitary matrices.
checksums           rmd160  37c7f7e2eb22ce63bf49c46971be4e86b2f55ded \
                    sha256  42707068984ef9bbec3c8ab85bc0500e1ed8f4fb4437e63a9ec36286aa83f900 \
                    size    92239

patchfiles          patch-make.inc.diff \
                    patch-tests.diff \
                    patch-jacobwilliams.diff

post-patch {
    reinplace "s,@PREFIX@,${destroot}${prefix}," ${worksrcpath}/make.inc
    reinplace "s,@FC@,${configure.fc}," ${worksrcpath}/make.inc
    reinplace "s,@BUILDDIR@,${worksrcpath}," ${worksrcpath}/test/logical/Makefile
    reinplace "s,@BUILDDIR@,${worksrcpath}," ${worksrcpath}/test/double/Makefile
    reinplace "s,@BUILDDIR@,${worksrcpath}," ${worksrcpath}/test/complex_double/Makefile
}

# error: invalid instruction mnemonic 'cvtsi2sdl'
compiler.blacklist-append \
                    {clang < 500}
compilers.choose    fc f90
compilers.setup     require_fortran

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} LICENSE.md README.md ${destroot}${docdir}
}

test.run            yes
test.target         tests
test.cmd-prepend    DYLD_LIBRARY_PATH=${build.dir}
