# -*- 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
# $Id: Portfile 105327 2013-04-17 20:18:48Z ryandesign@macports.org $

PortSystem          1.0

name                metis
version             5.1.0
categories          math
platforms           darwin
maintainers         nomaintainer
# Included license is for "evaluation purposes" only (whatever that means) if
# you're not a non-profit or US government agency.
license             Restrictive

description         A package for unstructured graph partitioning

long_description    METIS is a set of programs for partitioning graphs and \
                    for producing fill reducing orderings for sparse \
                    matrices. The algorithms implemented by METIS are based \
                    on the multilevel graph partitioning scheme described \
                    in \[KK95a\] and \[KK95e\]. METIS provides high quality \
                    partitions, is extremely fast, and produces low fill \
                    orderings.

homepage            http://glaros.dtc.umn.edu/gkhome/metis/metis/overview
master_sites        http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/

checksums           rmd160  2c4a54bcd3179a609842cde1908dbd232a770495 \
                    sha256  76faebe03f6c963127dbb73c13eab58c9a3faeae48779f049066a21c087c5db2

patchfiles          patch-Makefile-add-install-name-dir.diff \
                    patch-GKlib_GKlibSystem.cmake.diff

# Metis uses a GNU make file to fire off a cmake command.
# Used for configure, build, and install.
depends_build       port:cmake

configure.cmd       /usr/bin/make
configure.universal_args
configure.pre_args
configure.args      config \
                    prefix=${prefix} \
                    shared=1 \

# "-w" which MacPorts base now adds to these by default causes problems here
build.pre_args      ${build.target}
destroot.pre_args   ${destroot.target}

post-destroot {
    # Move metis.h to include/metis/metis.h
    xinstall -d -m 755 ${destroot}${prefix}/include/metis
    file rename ${destroot}${prefix}/include/metis.h \
                ${destroot}${prefix}/include/metis/metis.h
    
    # Install documentation
    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/manual/manual.pdf \
        ${destroot}${prefix}/share/doc/${name}
}

# openmpi is not universal
variant openmpi conflicts universal description {Build Metis with MPI support} {
    depends_build-append    port:openmpi
    
    configure.args-append   openmp=1
}

livecheck.type  regex
livecheck.url   http://glaros.dtc.umn.edu/gkhome/metis/metis/changes
livecheck.regex {Ver: ([0-9.]+),}
