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

name                ml
version             6.2
revision            4
categories          math
license             LGPL-2.1
platforms           darwin
maintainers         nomaintainer
description         Multilevel Preconditioning Package
long_description    ML is designed to solve large sparse linear systems of \
                    equations arising primarily from elliptic PDE discretizations.

homepage            http://trilinos.sandia.gov/packages/ml/
master_sites        http://ftp.mcs.anl.gov/pub/petsc/externalpackages

checksums           rmd160  f7a56200e19d89c3aa21927d578384a226146199 \
                    sha256  cd04da3308430c1268560db808bea33e17d82a42324ebbd624ca451b4a6e03ba

mpi.setup           require_fortran

universal_variant   no
use_parallel_build  no

patchfiles-append   patch-perl.diff

configure.args      --disable-ml-epetra \
                    --disable-ml-aztecoo \
                    --disable-ml-examples \
                    --disable-tests \
                    --with-blas=/usr/lib/libblas.dylib \
                    --with-lapack=/usr/lib/liblapack.dylib

configure.cflags    -O3 -mtune=native -fPIC
configure.cxxflags  -O3 -mtune=native -fPIC
configure.fflags    -O3 -mtune=native -fPIC
configure.f90flags  -O3 -mtune=native -fPIC

post-build {
    system -W ${worksrcpath}/src "${configure.cxx} *.o /usr/lib/libblas.dylib /usr/lib/liblapack.dylib -dynamiclib -Wl,-multiply_defined,suppress,-commons,use_dylibs,-search_paths_first -install_name ${prefix}/lib/lib${name}.${version}.dylib -o lib${name}.${version}.dylib"
}

post-destroot {
    move ${worksrcpath}/src/lib${name}.${version}.dylib ${destroot}${prefix}/lib
    system -W ${destroot}${prefix}/lib "ln -s lib${name}.${version}.dylib lib${name}.dylib"
}

if {[mpi_variant_isset]} {
    configure.args-append      --enable-mpi
    configure.cflags-append    -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX
    configure.cxxflags-append  -DMPICH_SKIP_MPICXX -DOMPI_SKIP_MPICXX
}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
