# -*- 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 fcdc0f454d00be218225aff0dd760906d8d09175
version             0.2.0
revision            1
categories          math fortran
maintainers         nomaintainer
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  ad87bb6ba78d8f752e4f8515ae21f65c004fa3ba \
                    sha256  fd3b139e89377bf8a35d46a4709a530899bc6c54dd47153176abd0b063d56f46 \
                    size    92813
github.tarball_from archive

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}
