Ticket #24942: py26-numpy_svn_2.2.diff

File py26-numpy_svn_2.2.diff, 6.4 KB (added by michaelld (Michael Dickens), 9 years ago)

"svn diff" in py26-numpy port directory; should fix F2PY script finding fortran.

  • files/patch-numpy_linalg_setup.py.diff

     
     1--- numpy/linalg/setup.py.orig  2010-09-14 11:44:21.000000000 -0400
     2+++ numpy/linalg/setup.py       2010-09-14 11:45:01.000000000 -0400
     3@@ -27,6 +27,7 @@
     4                                     'zlapack_lite.c', 'dlapack_lite.c',
     5                                     'blas_lite.c', 'dlamch.c',
     6                                     'f2c_lite.c','f2c.h'],
     7+                         extra_link_args=['-undefined dynamic_lookup -bundle'],
     8                          extra_info = lapack_info
     9                          )
     10 
  • Portfile

     
    77name                    py26-numpy
    88epoch                   20100319
    99version                 1.5.0
     10revision                1
    1011categories              python
    1112platforms               darwin
    1213maintainers             mcalhoun openmaintainer
     
    2627                        patch-fcompiler_g95.diff
    2728
    2829depends_lib-append      port:fftw-3 \
    29                         port:py26-nose \
    30                         port:atlas
     30                        port:py26-nose
    3131
    32 build.env-append        ATLAS=${prefix}/lib \
     32variant atlas \
     33description {Use the MacPorts' ATLAS libraries \
     34             instead of Apple's Accelerate framework} {
     35    build.env-append    ATLAS=${prefix}/lib \
    3336                        LAPACK=${prefix}/lib \
    3437                        BLAS=${prefix}/lib
    35 
    36 destroot.env-append     ATLAS=${prefix}/lib \
     38    destroot.env-append ATLAS=${prefix}/lib \
    3739                        LAPACK=${prefix}/lib \
    3840                        BLAS=${prefix}/lib
     41    depends_lib-append  port:atlas
     42}
    3943
    40 post-patch {
    41     reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" ${worksrcpath}/numpy/f2py/setup.py
     44# use ALTAS by default; if MacPorts' ATLAS is not used, numpy will
     45# link with that supplied by Apple's Accelerate framework.
     46if {![variant_isset atlas]} {
     47    default_variants +atlas
    4248}
    4349
    44 variant gcc43 conflicts gcc44 description {Use the gcc43 compiler (enables fortran code)} {
    45     depends_lib-append  port:gcc43
    46     configure.compiler  macports-gcc-4.3
    47     build.env-append    CC="${prefix}/bin/gcc-mp-4.3" \
    48                         CXX="${prefix}/bin/g++-mp-4.3"
     50# when using ATLAS (whether by default or specified by the user via
     51# the +atlas variant) ...
     52set gcc_version ""
     53if {[variant_isset atlas]} {
     54    # see if the user has set -gcc4X to disable using MacPorts'
     55    # compiler; if not, either use what the user set (as +gcc4X) or
     56    # default to gcc44.
    4957
    50     destroot.env-append CC="${prefix}/bin/gcc-mp-4.3" \
    51                         CXX="${prefix}/bin/g++-mp-4.3"
    52 }
     58    variant gcc43 conflicts gcc44 gcc45 \
     59    description {Use the gcc43 compiler (enables fortran linking)} {}
    5360
    54 variant gcc44 conflicts gcc43 description {Use the gcc44 compiler (enables fortran code)} {
    55     depends_lib-append  port:gcc44
    56     configure.compiler  macports-gcc-4.4
    57     build.env-append    CC="${prefix}/bin/gcc-mp-4.4" \
    58                         CXX="${prefix}/bin/g++-mp-4.4"
     61    variant gcc44 conflicts gcc43 gcc45 \
     62    description {Use the gcc44 compiler (enables fortran linking)} {}
    5963
    60     destroot.env-append CC="${prefix}/bin/gcc-mp-4.4" \
    61                         CXX="${prefix}/bin/g++-mp-4.4"
    62 }
     64    variant gcc45 conflicts gcc43 gcc44 \
     65    description {Use the gcc45 compiler (enables fortran linking)} {}
    6366
    64 if {![variant_isset gcc43]} {
    65     default_variants +gcc44
    66 }
     67    if {![variant_isset gcc43] &&
     68        ![variant_isset gcc44] &&
     69        ![variant_isset gcc45]} {
     70        default_variants +gcc44
     71    }
     72    if {[variant_isset gcc43]} {
     73        set gcc_version "4.3"
     74    }
     75    if {[variant_isset gcc44]} {
     76        set gcc_version "4.4"
     77    }
     78    if {[variant_isset gcc45]} {
     79        set gcc_version "4.5"
     80    }
    6781
    68 variant no_atlas description {Do not use the macports atlas libs} {
    69     build.env-delete    ATLAS=${prefix}/lib \
    70                         LAPACK=${prefix}/lib \
    71                         BLAS=${prefix}/lib
     82    if {${gcc_version} != ""} {
     83        # when using non-Apple GCC for universal install, it can
     84        # create binaries only for the native OS architecture, at
     85        # either 32 or 64 bits.  Restrict the supported archs
     86        # accordingly.
     87        if {[variant_exists universal] && [variant_isset universal]} {
     88            if { ${os.arch}=="i386" } {
     89                set universal_archs_supported { i386 x86_64 }
     90            } else {
     91                set universal_archs_supported { ppc  ppc64 }
     92            }
     93        }
    7294
    73     destroot.env-delete ATLAS=${prefix}/lib \
    74                         LAPACK=${prefix}/lib \
    75                         BLAS=${prefix}/lib
    76     depends_lib-delete  port:atlas
     95        # include all the correct GCC4X port
     96        depends_lib-append port:gcc[join [split ${gcc_version} "."] ""]
     97
     98        # force LDFLAGS for correct linking of the linalg module
     99        # for non-Apple GCC compilers
     100        patchfiles-append  patch-numpy_linalg_setup.py.diff
     101
     102    } else {
     103        # user specified -gcc4X but +atlas (either as default or
     104        # explicitly); do not allow since it might lead to
     105        # undetermined runtime execution.
     106        return -code error \
     107"\n\nWhen using the +atlas variant (either as the default or setting
     108explicitly), one of the +gcc4X variants must be selected.\n"
     109    }
    77110}
    78111
    79112variant universal {
    80113    patchfiles-append   patch-setup.py.diff
    81114}
    82115
     116post-patch {
     117    reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
     118        ${worksrcpath}/numpy/f2py/setup.py
     119
     120    # disallow searching for any fortran executable except what is
     121    # specified in this Portfile; NOTE: this change only works when
     122    # setting the F90 flag above; if this flag is not set (meaning no
     123    # +gcc4X variant is set), then F2PY may or not work.
     124    if {${gcc_version} != ""} {
     125        # set which fortran to use in the f2py Python scripts
     126        reinplace "/possible_executables/s|\\\[.*\\\]|\['gfortran-mp-${gcc_version}'\]|g" ${worksrcpath}/numpy/distutils/fcompiler/gnu.py
     127    }
     128}
     129
    83130livecheck.type  regex
    84131livecheck.url   http://sourceforge.net/projects/numpy/files/
    85132livecheck.regex "files\/NumPy\/(\\d+(?:\\.\\d+)*)\/numpy"