# $Id: Portfile 63235 2010-01-30 12:39:26Z ryandesign@macports.org $

PortSystem          1.0

name                iAIDA
version             1.0.17
categories          science
maintainers         pd.infn.it:cristiano.fontana
license             LGPLv3
description         An implementation in C++ of the AIDA Abstract Interfaces for Data Analysis
long_description    iAIDA is an implementation in C++ of the AIDA Abstract Interfaces for Data Analysis, a set of interfaces designed for data analysis.
homepage            http://iaida.dynalias.net/
platforms           darwin
extract.suffix      .tgz
master_sites        sourceforge:iaida

checksums           md5 a352ea32ad61678cda6c94e299f94ca3

depends_lib         port:aida \
                    port:grace \
                    port:boost \
                    port:root \
                    port:openssl \
                    port:expat \
                    port:zlib

universal_variant   no

patchfiles          patch-configure.diff

post-patch {
    foreach d {"" /examples /include /src /tests} {
        reinplace "s:@PREFIX_DIR@:${destroot}${prefix}:g" ${worksrcpath}${d}/Makefile.in
    }
}

configure.args      --with-grace=${prefix} \
                    --with-boost=${prefix} \
                    --with-aida=${prefix}/include

build.args          CXX=${configure.cxx}

post-build {
    system "cd ${worksrcpath}/examples && make ${build.args}"
    system "cd ${worksrcpath}/tests && make ${build.args}"

    foreach f {examples/Makefile examples/Makefile.in tests/Makefile tests/Makefile.in tests/runTests.py tests/runTests.py.in} {
        reinplace "s:../bin/aida-config:aida-config:g" ${worksrcpath}/${f}
    }

    foreach f {tests/runTests.py tests/runTests.py.in} {
        reinplace "s:logFile = entry+'.log':logFile = '/tmp/'+entry+'.log':g" ${worksrcpath}/${f}
    }
}

post-destroot {
    xinstall -d ${destroot}${prefix}/share/${name}
    file copy ${worksrcpath}/examples ${worksrcpath}/tests ${destroot}${prefix}/share/${name}

    file copy ${worksrcpath}/src ${destroot}${prefix}/src/${name}
}
