# -*- 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 103538 2013-02-28 15:57:21Z macsforever2000@macports.org $

PortSystem          1.0
PortGroup           python 1.0

name                py-usadel1
version             0.2.4
categories-append   science
platforms           darwin
maintainers         macsforever2000 openmaintainer
license             GPL-2

description         Usadel equation solver

long_description    This code solves Usadel equations in a circuit consisting of quasi-1D \
                    metallic wires. This is an efficient approach for modelling charge and heat \
                    transport in mesoscopic electronic circuits made of superconducting and normal-state \
                    metals, in the presence of a sufficient amount of impurities (dirty limit).

homepage            http://ltl.tkk.fi/~theory/usadel1/
master_sites        ${homepage}_static/
distname            usadel1-${version}

checksums           rmd160  a520258f5171002af6806ddc39672a60362d3082 \
                    sha256  13a15231627ab2bcb86b4e85540979af1c12adb9265b3b0169c5a848f0761c4d

python.versions        26 27

if {$subport != $name} {
    depends_lib-append  port:py${python.version}-numpy \
                        port:py${python.version}-scipy \
                        port:py${python.version}-tables
    
    python.add_archflags no
    
    variant gcc45 conflicts gcc46 gcc47 gcc48 description {Use the gcc45 compiler (enables fortran code)} {
        depends_lib-append  port:gcc45
        configure.compiler  macports-gcc-4.5
    }
    
    variant gcc46 conflicts gcc45 gcc47 gcc48 description {Use the gcc46 compiler (enables fortran code)} {
        depends_lib-append  port:gcc46
        configure.compiler  macports-gcc-4.6
    }
    
    variant gcc47 conflicts gcc45 gcc46 gcc48 description {Use the gcc47 compiler (enables fortran code)} {
        depends_lib-append  port:gcc47
        configure.compiler  macports-gcc-4.7
    }
    
    variant gcc48 conflicts gcc45 gcc46 gcc47 description {Use the gcc48 compiler (enables fortran code)} {
        depends_lib-append  port:gcc48
        configure.compiler  macports-gcc-4.8
    }
    
    if {![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc48]} {
        default_variants +gcc47
    }

    build.args          config_fc \
                        --fcompiler=gfortran \
                        --noarch
    
    build.env-append    CC=${configure.cc} \
                        F90=${configure.fc}

    post-destroot {
        # Fix permissions problems on these files
        xinstall -m 0644 -W ${worksrcpath}/usadel1.egg-info PKG-INFO SOURCES.txt dependency_links.txt requires.txt top_level.txt \
            ${destroot}${python.pkgd}/usadel1-${version}-py${python.branch}.egg-info
    }

    livecheck.type  none
} else {
    livecheck.type  regex
    livecheck.url   http://ltl.tkk.fi/~theory/usadel1/download.html
    livecheck.regex {usadel1-(\d+(?:\.\d+)*)}
}
