# $Id: Portfile 112890 2013-11-03 14:03:53Z g5pw@macports.org $

PortSystem          1.0

name                pythia
version             8.180
set my_version      [strsed ${version} g/\\.//]
categories          science
platforms           darwin
maintainers         gmail.com:mattiafrancescomoro
license             LGPL-2.1
description         Generator of high-energy physics events
long_description    PYTHIA is a program for the generation of high-energy physics events, \
                    i.e. for the description of collisions at high energies between elementary particles \
                    such as e+, e-, p and pbar in various combinations. It contains theory and models for \
                    a number of physics aspects, including hard and soft interactions, parton distributions, \
                    initial- and final-state parton showers, multiple interactions, fragmentation and decay. \
                    It is largely based on original research, but also borrows many formulae and other \
                    knowledge from the literature.

homepage            http://home.thep.lu.se/~torbjorn/Pythia.html
master_sites        http://home.thep.lu.se/~torbjorn/pythia8/

distname            ${name}${my_version}
extract.suffix      .tgz

checksums           rmd160  9b887a39da0e4d6c00d75f96e15f536589cdc4ab \
                    sha256  7c3ce6efbdc588035e333a6dbbde56755066a237caadf9df00f22248c2033df0

universal_variant   no

depends_lib         port:zlib \
                    port:boost

configure.pre_args
configure.args      --enable-shared \
                    --with-boost=${prefix} \
                    --with-zlib=${prefix}/lib

build.args          CC=${configure.cc} \
                    CXX=${configure.cxx}

post-build {
    foreach dylib {libpythia8.dylib liblhapdfdummy.dylib} {
        system "install_name_tool -id ${prefix}/lib/${dylib} ${worksrcpath}/lib/${dylib}"
    }
}

destroot {
    xinstall -W ${worksrcpath}/lib libpythia8.dylib liblhapdfdummy.dylib ${destroot}${prefix}/lib
    xinstall -W ${worksrcpath}/lib/archive liblhapdfdummy.a libpythia8.a ${destroot}${prefix}/lib
    file mkdir ${destroot}${prefix}/include/${name}/Pythia8/
    eval xinstall -m 644 [glob ${worksrcpath}/include/Pythia8/*.h] ${destroot}${prefix}/include/${name}/Pythia8/
    file mkdir ${destroot}${prefix}/share/doc/${name}/xmldoc/
    eval xinstall -m 644 [glob ${worksrcpath}/xmldoc/*] ${destroot}${prefix}/share/doc/${name}/xmldoc/
}

livecheck.type      regex
livecheck.version   ${my_version}
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}(\\d+)${extract.suffix}
