# -*- 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$ PortSystem 1.0 PortGroup python 1.0 PortGroup github 1.0 PortGroup compilers 1.0 github.setup numpy numpy 1.9.2 v revision 1 name py-numpy categories-append math license BSD platforms darwin maintainers dh michaelld openmaintainer description The core utilities for the scientific library scipy for Python long_description ${description} checksums rmd160 43b83224b2c0b67662773bad3cfb03138b86013e \ sha256 5587182f8a749702aff0d55187d1c6685b5484f299166b2ef66b80be14d162bc python.versions 26 27 33 34 # TODO: Fix the +universal variant. This port is a fairly deep dependency and needs to be able to support +universal. # https://trac.macports.org/ticket/48263 universal_variant no if {${name} ne ${subport}} { compilers.setup -clang -dragonegg -gcc44 -gcc45 -gcc46 -g95 patchfiles patch-f2py_setup.py.diff \ patch-fcompiler_g95.diff \ patch-numpy_core_setup.py.diff depends_lib-append port:fftw-3 \ port:py${python.version}-nose \ port:py${python.version}-cython pre-configure { # http://trac.macports.org/ticket/34562 destroot.env-append \ CC="${configure.cc}" \ CFLAGS="${configure.cflags} [get_canonical_archflags cc]" \ CXX="${configure.cxx}" \ CXXFLAGS="${configure.cxxflags} [get_canonical_archflags cxx]" \ OBJC="${configure.objc}" \ OBJCFLAGS="${configure.objcflags} [get_canonical_archflags objc]" \ LDFLAGS="${configure.ldflags} [get_canonical_archflags ld]" build.env-append ARCHFLAGS="[get_canonical_archflags ld]" destroot.env-append ARCHFLAGS="[get_canonical_archflags ld]" } variant atlas description {Use the MacPorts' ATLAS libraries \ instead of Apple's Accelerate framework} { depends_lib-append port:atlas if {[variant_isset universal]} { python.set_compiler no } } # when using ATLAS (whether by default or specified by the user via # the +atlas variant) ... if {[variant_isset atlas]} { # when using non-Apple GCC for universal install, it can # create binaries only for the native OS architecture, at # either 32 or 64 bits. Restrict the supported archs # accordingly. if {${os.arch} eq "i386"} { supported_archs i386 x86_64 } elseif {${os.arch} eq "powerpc"} { supported_archs ppc ppc64 } # force LDFLAGS for correct linking of the linalg module # for non-Apple GCC compilers patchfiles-append patch-numpy_linalg_setup.py.diff pre-fetch { # get the c compiler name, if blank set to clang which is what atlas # does set cc [c_variant_name] if {$cc eq ""} { set cc clang } # check the C compiler for atlas: if not the same then error out; we # don't need to check the fortran compiler because if atlas is compiled # with +clang then gcc48 (+gfortran in the compilers portgroup # language) is used for fortran. If a +gcc variant is used to compile # atlas, then that gcc's fortran is used so the c compiler check will # suffice. if {![catch {set result [active_variants atlas $cc ""]}]} { if {!$result} { return -code error \ "You have selected the $cc compiler (either directly or indirectly) and the\ +atlas variant, which does not match the $cc compiler. Please ensure that both\ are compiled with the same one." } } } build.env-append ATLAS=${prefix}/lib \ LAPACK=${prefix}/lib \ BLAS=${prefix}/lib destroot.env-append ATLAS=${prefix}/lib \ LAPACK=${prefix}/lib \ BLAS=${prefix}/lib } else { build.env-append ATLAS=None \ LAPACK=/usr/lib \ BLAS=/usr/lib destroot.env-append ATLAS=None \ LAPACK=/usr/lib \ BLAS=/usr/lib } post-patch { reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \ ${worksrcpath}/numpy/f2py/setup.py # https://trac.macports.org/ticket/46392 if {${os.arch} eq "powerpc"} { reinplace "s,'-O3','-O2'," \ ${worksrcpath}/numpy/distutils/fcompiler/gnu.py } if {[variant_isset universal] && [variant_isset atlas]} { # Prepare wrappers file copy -force ${filespath}/wrapper-template \ ${worksrcpath}/c-wrapper file copy -force ${filespath}/wrapper-template \ ${worksrcpath}/f-wrapper file copy -force ${filespath}/wrapper-template \ ${worksrcpath}/cxx-wrapper reinplace "s|@@@|${configure.cc}|" ${worksrcpath}/c-wrapper reinplace "s|---|\\\\.c|" ${worksrcpath}/c-wrapper reinplace "s|&&&|${prefix}|" ${worksrcpath}/c-wrapper reinplace "s|@@@|${configure.cxx}|" ${worksrcpath}/cxx-wrapper reinplace "s#---#(\\\\.C|\\\\.cpp|\\\\.cc)#" \ ${worksrcpath}/cxx-wrapper reinplace "s|&&&|${prefix}|" ${worksrcpath}/cxx-wrapper reinplace "s|@@@|${configure.f90}|" ${worksrcpath}/f-wrapper reinplace "s|---|\\\\.f|" ${worksrcpath}/f-wrapper reinplace "s|&&&|${prefix}|" ${worksrcpath}/f-wrapper build.env-append CC="${worksrcpath}/c-wrapper" \ CXX="${worksrcpath}/cxx-wrapper" \ F77="${worksrcpath}/f-wrapper" \ F90="${worksrcpath}/f-wrapper" destroot.env-append CC="${worksrcpath}/c-wrapper" \ CXX="${worksrcpath}/cxx-wrapper" \ F77="${worksrcpath}/f-wrapper" \ F90="${worksrcpath}/f-wrapper" } if {[variant_isset atlas]} { # We must link against libSatlas or libTatlas, not libAtlas if {[file exists ${prefix}/lib/libtatlas.dylib]} { reinplace -E \ "s|_lib_atlas = \\\['atlas'\\\]|_lib_atlas = \\\['tatlas'\\\]|" \ ${worksrcpath}/numpy/distutils/system_info.py } elseif {[file exists ${prefix}/lib/libsatlas.dylib]} { reinplace -E \ "s|_lib_atlas = \\\['atlas'\\\]|_lib_atlas = \\\['satlas'\\\]|" \ ${worksrcpath}/numpy/distutils/system_info.py } else { return -code error "Unable to find Atlas dylibs. Bailing out." } } } if {![fortran_variant_isset]} { default_variants +gfortran } livecheck.type none } else { livecheck.regex archive/[join ${github.tag_prefix} ""](\[\\d+(?:\\.\\d+)*"\]+)${extract.suffix}" }