# -*- 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 106022 2013-05-13 17:39:09Z macsforever2000@macports.org $

PortSystem              1.0
PortGroup               python 1.0
PortGroup               active_variants 1.1

name                    py-qutip
version                 2.2.0
categories-append       science
platforms               darwin
license                 GPL-3
maintainers             macsforever2000 openmaintainer

description             Quantum Toolbox in Python
long_description        QuTiP is open-source software for simulating the dynamics of open quantum systems.

homepage                http://code.google.com/p/qutip/
master_sites            googlecode:qutip
distname                QuTiP-${version}
worksrcdir              qutip-${version}

checksums               rmd160  e2e6a8c8790e8cd1444b0e4f1c52c91d42fffada \
                        sha256  a26a639d74b2754b3a1e329d91300e587e8c399d8a81d8f18a4a74c6d6f02ba3
                        
python.versions         26 27

if {$subport != $name} {
    depends_lib-append  port:py${python.version}-cython \
                        port:py${python.version}-ipython \
                        port:py${python.version}-matplotlib \
                        port:py${python.version}-mayavi \
                        port:py${python.version}-numpy \
                        port:py${python.version}-pyqt4 \
                        port:py${python.version}-scipy \
                        port:vtk5
 
    require_active_variants py${python.version}-ipython "pyqt4 notebook parallel scientific"
    require_active_variants py${python.version}-matplotlib latex
    require_active_variants vtk5 "python${python.version} qt4_mac"

    use_parallel_build  no

    if {[variant_isset gcc47] || [variant_isset gcc48] || [variant_isset gcc49]} {
        if {[variant_exists universal] && [variant_isset universal]} {
            build.env-append CFLAGS="${configure.universal_cflags}" \
                             OBJCFLAGS="${configure.universal_cflags}" \
                             CXXFLAGS="${configure.universal_cxxflags}" \
                             LDFLAGS="-undefined dynamic_lookup -bundle ${configure.universal_ldflags}"
        } else {
            build.env-append CFLAGS="${configure.cc_archflags}" \
                             OBJCFLAGS="${configure.objc_archflags}" \
                             CXXFLAGS="${configure.cxx_archflags}" \
                             FFLAGS="${configure.f77_archflags}" \
                             F90FLAGS="${configure.f90_archflags}" \
                             FCFLAGS="${configure.fc_archflags}" \
                             LDFLAGS="-undefined dynamic_lookup -bundle ${configure.ld_archflags}"
        }
    }

    variant gcc47 conflicts gcc48 gcc49 description "Install Monte Carlo solver using gcc 4.7 gfortran as Fortran compiler" {
        configure.compiler  macports-gcc-4.7
        depends_lib-append  port:gcc47

        python.add_archflags no

        build.args
        build.post_args-append  --with-f90mc
    }

    variant gcc48 conflicts gcc47 gcc49 description "Install Monte Carlo solver using gcc 4.8 gfortran as Fortran compiler" {
        configure.compiler  macports-gcc-4.8
        depends_lib-append  port:gcc48

        python.add_archflags no

        build.args
        build.post_args-append  --with-f90mc
    }

    variant gcc49 conflicts gcc47 gcc48 description "Install Monte Carlo solver using gcc 4.9 gfortran as Fortran compiler" {
        configure.compiler  macports-gcc-4.9
        depends_lib-append  port:gcc49

        python.add_archflags no

        build.args
        build.post_args-append  --with-f90mc
    }

    if { ![variant_isset gcc48] && ![variant_isset gcc49]} {
        default_variants    +gcc47
    }

    livecheck.type      none
} else {
    livecheck.type      regex
    livecheck.url       ${homepage}
    livecheck.regex     {QuTiP-([0-9\.]+)\.tar\.gz}
}

