# $Id: Portfile 66745 2010-04-21 23:57:33Z raimue@macports.org $

PortSystem 1.0

name            valgrind-devel
svn.revision    11104
version         3.6.0-r${svn.revision}
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

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

fetch.type      svn
svn.url         svn://svn.valgrind.org/valgrind/trunk
svn.args        --ignore-externals
worksrcdir      trunk

post-fetch {
    system "cd ${worksrcpath} && ${svn.cmd} ${svn.pre_args} ${svn.method} svn://svn.valgrind.org/vex/trunk@1965 VEX"
}

patchfiles      patch-snow-leopard.diff \
                patch-arc4random.diff \
                patch-sidt.diff \
                patch-signal.diff

post-patch {
    system "cd ${worksrcpath} && touch darwin10.supp darwin10-drd.supp"
}

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

# valgrind sets up -arch by itself, adding our own interferes with the build
configure.cc_archflags {}
if [exists configure.ld_archflags] {
    configure.ld_archflags {}
}

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 none
