# -*- 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

PortSystem          1.0
PortGroup           python 1.0
PortGroup           github 1.0
PortGroup           active_variants 1.1

github.setup        theochem horton ea86b470ed0d6959ad404ebc2c69d20157834d4d
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             2.0.1
revision            1
name                HORTON
license             GPL-3+
categories          science python
maintainers         mcmaster.ca:yangx59 \
                    openmaintainer

description         HORTON is a quantum chemistry program written primarily in Python language.
long_description    {*}${description} It can serve as a stand-alone program for electronic structure calculation (HF, DFT,\Geminals, PT)


homepage            https://theochem.github.io/horton/
checksums           rmd160  68cf1658bf7de122923fc3949fb861a6896ab8be \
                    sha256  e6410d00a012ab6bbeb18bd04d111e26cdcfc86171c092f50d0ad430e372c907

python.default_version      27

depends_lib-append  path:lib/libopenblas.dylib:OpenBLAS \
                    port:libint \
                    port:py${python.default_version}-numpy \
                    port:py${python.default_version}-h5py \
                    port:py${python.default_version}-scipy \
                    port:py${python.default_version}-cython \
                    port:py${python.default_version}-nose \
                    port:py${python.default_version}-sympy \
                    port:py${python.default_version}-sphinx \
                    port:py${python.default_version}-matplotlib \
                    port:libxc

pre-build {
        reinplace "s|python|${python.bin}|g" ${worksrcpath}/data/refatoms/Makefile
        system -W ${worksrcpath}/data/refatoms "make all"
        copy ${worksrcpath}/data/setup_cfgs/setup.Darwin-macport-x86_64.cfg ${worksrcpath}/setup.cfg
        reinplace "s|/opt/local|${prefix}|g" ${worksrcpath}/setup.cfg
        reinplace "s|atlas|openblas|g" ${worksrcpath}/setup.cfg
        reinplace "s|cblas|cblas_openblas|g" ${worksrcpath}/horton/gbasis/cholesky.h
}

post-destroot {
    reinplace "s|${destroot}${prefix}|${prefix}|" ${destroot}${python.pkgd}/horton/data_dir.txt
}

pre-activate {
    if {![active_variants py27-numpy openblas]} {
        notes {In order to have CHOLESKY work properly, please install numpy +openblas manually with the following command: sudo port -n upgrade --enforce-variants py27-numpy +openblas}
    }
}
