# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 66966 2010-04-27 01:48:39Z ram@macports.org $

PortSystem              1.0
PortGroup               python26 1.0

name                    py26-numpy
epoch                   20100319
version                 1.4.1
revision                1
categories              python
platforms               darwin
maintainers             mcalhoun openmaintainer
description             The core utilities for the scientific library scipy for Python
long_description        ${description}

homepage                http://numpy.scipy.org/
master_sites            sourceforge:numpy
distname                numpy-${version}

checksums               md5 5c7b5349dc3161763f7f366ceb96516b \
                        sha1 ec6078aa09acbcca3d90f9f36353fc83e7e1daa0 \
                        rmd160 a0bbebd1138ffc93517095e3c06459cd9744a9d6

patchfiles              patch-f2py_setup.py.diff \
                        patch-system_info.py.diff \
                        patch-fcompiler_g95.diff

depends_lib-append      port:fftw-3 \
                        port:py26-nose \
                        port:atlas \
                        port:gcc43

if {![variant_isset no_gcc43]} {
    configure.compiler      macports-gcc-4.3
}

build.env-append        CC="${prefix}/bin/gcc-mp-4.3" \
                        CXX="${prefix}/bin/g++-mp-4.3" \
                        ATLAS=${prefix}/lib \
                        LAPACK=${prefix}/lib \
                        BLAS=${prefix}/lib

destroot.env-append     CC="${prefix}/bin/gcc-mp-4.3" \
                        CXX="${prefix}/bin/g++-mp-4.3" \
                        ATLAS=${prefix}/lib \
                        LAPACK=${prefix}/lib \
                        BLAS=${prefix}/lib

post-patch {
    reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" ${worksrcpath}/numpy/f2py/setup.py
}

variant no_gcc43 description {Do not use the gcc43 compiler (disables fortran code)} {
    depends_lib-delete port:gcc43
    build.env-delete    CC="${prefix}/bin/gcc-mp-4.3" \
                        CXX="${prefix}/bin/g++-mp-4.3"

    destroot.env-delete CC="${prefix}/bin/gcc-mp-4.3" \
                        CXX="${prefix}/bin/g++-mp-4.3"
}

variant no_atlas description {Do not use the macports atlas libs} {
    build.env-delete    ATLAS=${prefix}/lib \
                        LAPACK=${prefix}/lib \
                        BLAS=${prefix}/lib

    destroot.env-delete ATLAS=${prefix}/lib \
                        LAPACK=${prefix}/lib \
                        BLAS=${prefix}/lib
    depends_lib-delete  port:atlas
}

variant universal {
    patchfiles-append   patch-setup.py.diff
}

livecheck.type  regex
livecheck.url   http://sourceforge.net/projects/numpy/files/
livecheck.regex "files\/NumPy\/(\\d+(?:\\.\\d+)*)\/numpy"
