# -*- 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
# $Id: Portfile 63684 2010-02-12 15:28:11Z mnick@macports.org $

PortSystem          1.0

name                svdlibc
version             1.34
maintainers         mnick

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}
distname            ${name}
extract.suffix      .tgz
worksrcdir          SVDLIBC

checksums           md5     0e1b3bc149f1da476fd81c58742b5ee9 \
                    sha1    2f843ad31af6bc0ea28297f123eabd33aae1604b \
                    rmd160  90ddc5fe3f53e0d9da0e8921f927df877be0598a

use_configure       no
universal_variant   no

set hosttype        macos
build.env-append    HOSTTYPE='${hosttype}'
build.target        svd
 
pre-build {
    reinplace "s|-march=i486|${configure.cc_archflags}|g" ${worksrcpath}/Makefile
}

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
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
    file copy ${worksrcpath}/Manual ${destroot}${prefix}/share/${name}
}
