# -*- 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 107535 2013-07-02 16:33:45Z mojca@macports.org $

PortSystem          1.0
PortGroup           cmake 1.0

name                clhep
version             2.1.3.1
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/

checksums           rmd160  c7302b5deb84684c04eb3c2990733874d3fb85a2 \
                    sha256  5d3e45b39a861731fe3a532bb1426353bf62b54c7b90ecf268827e50f925642b

worksrcdir          ${version}/CLHEP

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

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

configure.post_args ${worksrcpath}

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

# clean the files bypassing destroot (a bug in 2.1.2.5)
# may be removed in November 2013
pre-activate {
    foreach afile {lib/libCLHEP.a lib/libCLHEP.dylib} {
        set filepath ${prefix}/${afile}
        if {[registry_file_registered ${filepath}] == "0"} {
            catch {delete ${filepath}}
        }
    }
}

livecheck.type      regex
livecheck.regex     {<b>([0-9.]+)</b>}
