# -*- 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 120006 2014-05-13 00:03:59Z mojca@macports.org $

PortSystem          1.0
PortGroup           cmake 1.0
PortGroup           compiler_blacklist_versions 1.0

name                clhep
version             2.1.4.2
categories          science
maintainers         mojca openmaintainer
license             LGPL-3

description         A Class Library for High Energy Physics
long_description    A Class Library for High Energy Physics
homepage            http://www.cern.ch/clhep
platforms           darwin
extract.suffix      .tgz
master_sites        http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/tarFiles/
#                   http://git.cern.ch/pubweb/CLHEP.git

checksums           rmd160  73daadddb9541f5ad0b336a42159c675d7ab5b20 \
                    sha256  ffd72997fb921fa7ef770c40c6bb12f603aa4761e642dc577160d1ee2aa695f0

worksrcdir          ${version}/CLHEP

configure.dir       ${workpath}/build
build.dir           ${configure.dir}

post-extract {
    file mkdir ${configure.dir}
}

configure.post_args ${worksrcpath}

# TODO
# the flag could theoretically be replaced by -isystem${prefix}/include,
# but it's not even needed, so let's simply delete it
# (the build fails because it finds headers in ${prefix} before those in the build dir)
# the best way to fix these type of problems would probably be
# to handle this specific flag differently in the cmake PortGroup
configure.cppflags-delete -I${prefix}/include

post-build {
    fs-traverse file ${build.dir} {
        if {[string match {*-config} ${file}]} {
            reinplace -E {s|-arch [^ ]+||g} ${file}
        }
    }
}

livecheck.type      regex
livecheck.url       http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
