# $Id: Portfile 66721 2010-04-21 14:10:40Z raimue@macports.org $

PortSystem 1.0

name            valgrind
version         3.5.0
categories      devel
platforms       darwin
maintainers     raimue

description     A powerful open-source memory debugger.
long_description \
    Valgrind is a powerful open-source memory debugger. When valgrind is \
    attached to a program, it intercepts calls to malloc/new/free/delete and \
    all memory operations are checked for invalid read or write.
homepage        http://valgrind.org

master_sites    http://valgrind.org/downloads/
checksums       md5     f03522a4687cf76c676c9494fcc0a517 \
                sha1    76678c2617278cc9fbda1232e4e56fb2a96b0eb8 \
                rmd160  dd0ca80d73daac774b9352fe7a07ab72aae767c9
use_bzip2 yes

pre-fetch {
    if {"darwin" == ${os.platform} && ${os.major} < 9} {
        ui_error "${name} ${version} is only compatible with Mac OS X 10.5."
        return -code error "incompatible Mac OS X version"
    }
    if {"darwin" == ${os.platform} && ${os.major} > 9} {
        ui_error "${name} ${version} is not compatible with Mac OS X 10.6 or later. Until ${name} 3.6.0 is released, please install valgrind-devel instead."
        return -code error "incompatible Mac OS X version"
    }
}

depends_build   bin:perl:perl5
# Ignore trace reports about boost, Qt and OpenMP
# as they are only used for tests

configure.args  --mandir=${prefix}/share/man \
                --without-mpicc

variant mpich2 description {Use mpich2 for MPI support} {
    depends_lib-append port:mpich2
    configure.args-delete --without-mpicc
    configure.args-append --with-mpicc=${prefix}/bin/mpicc
}

variant openmpi description {Use openmpi for MPI support} {
    depends_lib-append port:openmpi
    configure.args-delete --without-mpicc
    configure.args-append --with-mpicc=${prefix}/bin/mpicc
}

livecheck.type  regex
livecheck.url ${homepage}
livecheck.regex ${name}-(\\d(?:\\.\\d)+)
