# -*- 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 105921 2013-05-10 02:09:51Z ryandesign@macports.org $

PortSystem          1.0

name                wannier90
version             1.2
categories          science
platforms           darwin
license             GPL-2+
maintainers         gmail.com:dstrubbe

description         A Tool for Obtaining Maximally-Localised Wannier Functions

long_description    Wannier90 uses inputs from an electronic-structure code \
                    to transform the Bloch orbitals of a crystal into \
                    maximally-localised Wannier functions. Interfaces exist \
                    for various density-functional theory codes.

homepage            http://www.wannier.org/
master_sites        ${homepage}code/

checksums           rmd160  4a8035ed4faf5256ad66aa9fe23ac32a86b3abf4 \
                    sha1    b4caaddb6e91afe673c122507e92c6b5fbc7689f

depends_lib         port:atlas

use_configure       no

pre-build {
    build.args      F90=${configure.f90} FCOPTS="-O3" LDOPTS="-O3"
    if {[variant_isset threads]} {
        build.args-append LIBS="-L${prefix}/lib -ltatlas"
    } else {
        build.args-append LIBS="-L${prefix}/lib -lsatlas"
    }
}

use_parallel_build  no

destroot {
    xinstall ${worksrcpath}/wannier90.x  ${destroot}${prefix}/bin/
    xinstall ${worksrcpath}/libwannier.a ${destroot}${prefix}/lib/
}

variant gcc46 conflicts gcc47 description {Build with GCC 4.6} {
    configure.compiler  macports-gcc-4.6
    depends_lib-append  port:gcc46
}

variant gcc47 conflicts gcc46 description {Build with GCC 4.7} {
    configure.compiler  macports-gcc-4.7
    depends_lib-append  port:gcc47
}

if {![variant_isset gcc46]} {
    default_variants    +gcc47
}

variant threads description {Build with threaded ATLAS} {}

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