# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                svdlibc
version             1.4
license             BSD
maintainers         nomaintainer

categories          math science
description         SVDLIBC is a C library to perform singular value decomposition
long_description    SVDLIBC is a C library based on the SVDPACKC library. It offers a \
                    cleaned-up version of the code with a sane library interface and a \
                    front-end executable that performs matrix file type conversions, along \
                    with computing singular value decompositions. Currently the only SVDPACKC \
                    algorithm implemented in SVDLIBC is las2, because it seems to be \
                    consistently the fastest.

platforms           darwin

homepage            http://tedlab.mit.edu/~dr/SVDLIBC/
master_sites        ${homepage}
dist_subdir         ${name}/${version}
distname            ${name}
extract.suffix      .tgz
worksrcdir          SVDLIBC

checksums           md5     1b644ab4a3df72d6d0a1aeccb93ac503 \
                    sha1    9243fbc0516af42b020423442212a025b3406dac \
                    rmd160  3ef133f8ccd9cb1659c11c7692e148709aca7431

use_configure       no

variant universal {}

configure.cflags-append -Wall -fno-common

set hosttype        bin
build.env-append    HOSTTYPE=${hosttype}
build.target        svd
build.args          CC="${configure.cc} ${configure.cflags} [get_canonical_archflags cc]"

destroot {
    xinstall -m 644 ${worksrcpath}/${hosttype}/libsvd.a ${destroot}${prefix}/lib
    xinstall -m 755 ${worksrcpath}/${hosttype}/svd ${destroot}${prefix}/bin
    foreach h {svdutil.h svdlib.h} {
        xinstall -m 644 ${worksrcpath}/${h} ${destroot}${prefix}/include
    }

    # Documentation
    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    copy {*}[glob ${worksrcpath}/Manual/*] ${destroot}${docdir}
    delete ${destroot}${docdir}/svdlib.h
}

livecheck.type    regexm
livecheck.regex   Version Notes</h3>\n\n<table>\n<tr><td valign=top><b>(\[0-9.\]+)
