# -*- 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

name                meschach
version             1.2b
categories          math
maintainers         {gmail.com:howarth.at.macports @jwhowarth}
description         Calculations on matrices and vectors
long_description    Meschach is a library of routines written in C for matrix \
                    computations. These include operations for basic numerical \
                    linear algebra, routines for matrix factorisations, solving \
                    least squares problems, computing eigenvalues, eigenvectors \
                    and singular values, sparse matrix computations including both \
                    direct and iterative methods.
homepage            http://www.cs.uiowa.edu/~dstewart/meschach/
platforms           darwin
master_sites        http://ftp.de.debian.org/debian/pool/main/m/meschach
patch_sites         http://ftp.de.debian.org/debian/pool/main/m/meschach
distfiles           meschach_${version}.orig.tar.gz
checksums           ${name}_${version}.orig.tar.gz \
                    md5 faf05a52c1a8a44a5716c6a2d681999f \
                    sha1 9cd3c102234b06a59a24f73db5cb76673614d413 \
                    rmd160 bbd1d09a2b5cddd5695038f9f8477af1d0c1b0d6 \
                    size 220166 \
                    meschach_1.2b-13.diff.gz \
                    md5 bdc7289be71d235afc92b5707f6732d2 \
                    sha1 da298acd0a90c9d5c78c08095800e8e725aaf378 \
                    rmd160 7455d201f0d5ac70e091f27f4f1a5ed15d0b59fd \
                    size 54026
patchfiles          meschach_1.2b-13.diff.gz meschach.diff
set branch          1.2
set major           1
patch.pre_args-replace  -p0 -p1
post-patch {
         reinplace  "s|@PREFIX@|${prefix}|g" ${worksrcpath}/makefile.in
         reinplace  "s|-O3|-O3 -D_REENTRANT -fno-common|g" ${worksrcpath}/makefile.in
         reinplace  "s|@VERSION@|${branch}|g" ${worksrcpath}/makefile.in
         }
configure.args       --with-all --with-unroll --with-munroll
post-build {
         system "cd ${worksrcpath} && make torture"
}
destroot {
         file mkdir ${destroot}${prefix}/include/meschach
         xinstall -m 0644 {*}[glob ${worksrcpath}/*.h] ${destroot}${prefix}/include/meschach
         xinstall {*}[glob ${worksrcpath}/*.a] ${destroot}${prefix}/lib
         xinstall {*}[glob ${worksrcpath}/*.dylib] ${destroot}${prefix}/lib
         ln -s ${prefix}/lib/libmeschach.${branch}.dylib ${destroot}${prefix}/lib/libmeschach.dylib
         ln -s ${prefix}/lib/libmeschach.${branch}.dylib ${destroot}${prefix}/lib/libmeschach.${major}.dylib
         system "cd ${worksrcpath} && ./torture"
}
