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

name                itsol
version             2.0
revision            3

# bump epoch to reduce version from "2.0.0" to "2.0", for livecheck
# compliance. looks like no updates forthcoming given how old the
# project is.
epoch               1

license             GPL-2+
categories          math
platforms           darwin
maintainers         {michaelld @michaelld} openmaintainer

description         ITerative SOLvers for sparse linear systems.

long_description    ITSOL is a library of iterative solvers for general sparse linear systems of equations. \
                    ITSOL can be viewed as an extension of the itsol module in SPARSKIT. It is written in C \
                    and offers a selection of recently developed preconditioners. The preconditioner suite includes: \
                    ILUK (ILU preconditioner with level of fill),  \
                    ILUT (ILU preconditioner with threshold), \
                    ILUC (Crout version of ILUT), \
                    VBILUK (variable block preconditioner with level of fill - with automatic block detection), \
                    VBILUT (variable block preconditioner with threshold - with automatic block detection), \
                    ARMS (Algebraic Recursive Multilevel Solvers -- includes actually several methods, \
                    in particular the standard ARMS and the ddPQ version which uses nonsymmetric permutations). \
                    Note that ITSOL is a scalar package.

homepage            https://www-users.cs.umn.edu/~saad/software/ITSOL/

set distname        ITSOL_2
master_sites        ${homepage}
checksums           rmd160 fe61d6602df541a30e0f3b587ac123bd6f1d318e \
                    sha256 de8f2726e2dbc248e8ccebdbc9ce8515ad47a8c8595cca87264c22b44845736a

patchfiles          patch-INC_protos.h.diff \
                    patch-SRC.diff \
                    patch-makefile.diff \
                    patch-TESTS-matfile.diff

compilers.choose    fc
compilers.setup     require_fortran

##########################
# configure MacPorts build

use_configure        yes
configure.cmd        make
configure.pre_args   lib
configure.env-append PREFIX=${prefix}
configure.universal_args
destroot.env-append  PREFIX=${prefix}

pre-configure {
    configure.ldflags-append "${linalglib}"
}

test.run       yes
pre-test {
    test.args-append     LINKS="-L../LIB -litsol" \
        FC="${configure.fc}" FCFLAGS="${configure.fcflags}" \
        CC="${configure.cc}" CCFLAGS="-c -I ../INC ${configure.cflags} -DLINUX" \
        LD="${configure.fc}" LDFLAGS="${configure.ldflags}"
}

livecheck.type      regex
livecheck.regex     VERSION (\\d+(\\.\\d+)*)
