Changeset 72220


Ignore:
Timestamp:
Oct 7, 2010, 6:04:16 PM (9 years ago)
Author:
michaelld@…
Message:

Partially or fully addresses tickets #19397, #22165, #22360, #22731,
#23244, #24942, #25395, #25409, #26117, and #26419.

  • Fix universal install.
  • Add variant for gcc45; default is still gcc44 but is used only in conjunction with +atlas. If -atlas is specified then no gcc4X variant is provided.
  • When building with +atlas, require a +gcc4X variant and patch the linalg module to link correctly. In f2py (and numpy's fortran discovery scripts), use the gcc4X's gfortran and no other.
  • Make atlas optional; NOTE: when building as -atlas, numpy will link with OSX-provided Accelerate framework, which does not require a fortran compiler for correct linking. In this case, the functionality of f2py is the default, and thus not guaranteed because this port no longer depends on fortran via gcc4X.
Location:
trunk/dports/python
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/python/py25-numpy/Portfile

    r71173 r72220  
     1# -*- 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
    12# $Id$
    23
     
    67name                py25-numpy
    78version             1.5.0
     9revision            1
    810categories          python
    911platforms           darwin
     
    2527
    2628depends_lib-append  port:fftw-3 \
    27                     port:py25-nose \
    28                     port:atlas
     29                    port:py25-nose
    2930
    30 build.env-append      ATLAS=${prefix}/lib \
    31                       LAPACK=${prefix}/lib \
    32                       BLAS=${prefix}/lib
     31variant atlas \
     32description {Use the MacPorts' ATLAS libraries \
     33             instead of Apple's Accelerate framework} {
     34    build.env-append    ATLAS=${prefix}/lib \
     35                        LAPACK=${prefix}/lib \
     36                        BLAS=${prefix}/lib
     37    destroot.env-append ATLAS=${prefix}/lib \
     38                        LAPACK=${prefix}/lib \
     39                        BLAS=${prefix}/lib
     40    depends_lib-append  port:atlas
     41}
    3342
    34 destroot.env-append   ATLAS=${prefix}/lib \
    35                       LAPACK=${prefix}/lib \
    36                       BLAS=${prefix}/lib
     43# use ALTAS by default; if MacPorts' ATLAS is not used, numpy will
     44# link with that supplied by Apple's Accelerate framework.
     45if {![variant_isset atlas]} {
     46    default_variants +atlas
     47}
     48
     49# when using ATLAS (whether by default or specified by the user via
     50# the +atlas variant) ...
     51set gcc_version ""
     52if {[variant_isset atlas]} {
     53    # see if the user has set -gcc4X to disable using MacPorts'
     54    # compiler; if not, either use what the user set (as +gcc4X) or
     55    # default to gcc44.
     56
     57    variant gcc43 conflicts gcc44 gcc45 \
     58    description {Use the gcc43 compiler (enables fortran linking)} {}
     59
     60    variant gcc44 conflicts gcc43 gcc45 \
     61    description {Use the gcc44 compiler (enables fortran linking)} {}
     62
     63    variant gcc45 conflicts gcc43 gcc44 \
     64    description {Use the gcc45 compiler (enables fortran linking)} {}
     65
     66    if {![variant_isset gcc43] &&
     67        ![variant_isset gcc44] &&
     68        ![variant_isset gcc45]} {
     69        default_variants +gcc44
     70    }
     71    if {[variant_isset gcc43]} {
     72        set gcc_version "4.3"
     73    }
     74    if {[variant_isset gcc44]} {
     75        set gcc_version "4.4"
     76    }
     77    if {[variant_isset gcc45]} {
     78        set gcc_version "4.5"
     79    }
     80
     81    if {${gcc_version} != ""} {
     82        # when using non-Apple GCC for universal install, it can
     83        # create binaries only for the native OS architecture, at
     84        # either 32 or 64 bits.  Restrict the supported archs
     85        # accordingly.
     86        if {[variant_exists universal] && [variant_isset universal]} {
     87            if { ${os.arch}=="i386" } {
     88                set universal_archs_supported { i386 x86_64 }
     89            } else {
     90                set universal_archs_supported { ppc  ppc64 }
     91            }
     92        }
     93
     94        # include all the correct GCC4X port
     95        depends_lib-append port:gcc[join [split ${gcc_version} "."] ""]
     96
     97        # force LDFLAGS for correct linking of the linalg module
     98        # for non-Apple GCC compilers
     99        patchfiles-append  patch-numpy_linalg_setup.py.diff
     100
     101    } else {
     102        # user specified -gcc4X but +atlas (either as default or
     103        # explicitly); do not allow since it might lead to
     104        # undetermined runtime execution.
     105        return -code error \
     106"\n\nWhen using the +atlas variant (either as the default or setting
     107explicitly), one of the +gcc4X variants must be selected.\n"
     108    }
     109}
     110
     111variant universal {
     112    patchfiles-append   patch-setup.py.diff
     113}
    37114
    38115post-patch {
    39   reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" ${worksrcpath}/numpy/f2py/setup.py
     116    reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
     117        ${worksrcpath}/numpy/f2py/setup.py
     118
     119    # disallow searching for any fortran executable except what is
     120    # specified in this Portfile; NOTE: this change only works when
     121    # setting the GCC version; if this flag is not set (meaning no
     122    # +gcc4X variant is set), then F2PY may or not work.
     123    if {${gcc_version} != ""} {
     124        # set which fortran to use in the f2py Python scripts
     125        reinplace "/possible_executables/s|\\\[.*\\\]|\['gfortran-mp-${gcc_version}'\]|g" ${worksrcpath}/numpy/distutils/fcompiler/gnu.py
     126    }
    40127}
    41128
     
    46133}
    47134
    48 variant gcc43 conflicts gcc44 description {Use the gcc43 compiler (enables fortran code)} {
    49   depends_lib-append  port:gcc43
    50   configure.compiler  macports-gcc-4.3
    51   build.env-append    CC="${prefix}/bin/gcc-mp-4.3" \
    52                       CXX="${prefix}/bin/g++-mp-4.3"
    53 
    54   destroot.env-append CC="${prefix}/bin/gcc-mp-4.3" \
    55                       CXX="${prefix}/bin/g++-mp-4.3"
    56 }
    57 
    58 variant gcc44 conflicts gcc43 description {Use the gcc44 compiler (enables fortran code)} {
    59   depends_lib-append  port:gcc44
    60   configure.compiler  macports-gcc-4.4
    61   build.env-append    CC="${prefix}/bin/gcc-mp-4.4" \
    62                       CXX="${prefix}/bin/g++-mp-4.4"
    63 
    64   destroot.env-append CC="${prefix}/bin/gcc-mp-4.4" \
    65                       CXX="${prefix}/bin/g++-mp-4.4"
    66 }
    67 
    68 if {![variant_isset gcc43]} {
    69     default_variants +gcc44
    70 }
    71 
    72 variant no_atlas description {Do not use the macports atlas libs} {
    73   depends_lib-delete  port:atlas
    74   build.env-delete    ATLAS=${prefix}/lib \
    75                       LAPACK=${prefix}/lib \
    76                       BLAS=${prefix}/lib
    77 
    78   destroot.env-delete ATLAS=${prefix}/lib \
    79                       LAPACK=${prefix}/lib \
    80                       BLAS=${prefix}/lib
    81 }
    82 
    83135livecheck.type        regex
    84136livecheck.url         http://sourceforge.net/projects/numpy/files/
  • trunk/dports/python/py26-numpy/Portfile

    r71178 r72220  
    88epoch                   20100319
    99version                 1.5.0
     10revision                1
    1011categories              python
    1112platforms               darwin
     
    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
    39 
    40 post-patch {
    41     reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" ${worksrcpath}/numpy/f2py/setup.py
     41    depends_lib-append  port:atlas
    4242}
    4343
    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"
    49 
    50     destroot.env-append CC="${prefix}/bin/gcc-mp-4.3" \
    51                         CXX="${prefix}/bin/g++-mp-4.3"
     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
    5248}
    5349
    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"
     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.
    5957
    60     destroot.env-append CC="${prefix}/bin/gcc-mp-4.4" \
    61                         CXX="${prefix}/bin/g++-mp-4.4"
    62 }
     58    variant gcc43 conflicts gcc44 gcc45 \
     59    description {Use the gcc43 compiler (enables fortran linking)} {}
    6360
    64 if {![variant_isset gcc43]} {
    65     default_variants +gcc44
    66 }
     61    variant gcc44 conflicts gcc43 gcc45 \
     62    description {Use the gcc44 compiler (enables fortran linking)} {}
    6763
    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
     64    variant gcc45 conflicts gcc43 gcc44 \
     65    description {Use the gcc45 compiler (enables fortran linking)} {}
    7266
    73     destroot.env-delete ATLAS=${prefix}/lib \
    74                         LAPACK=${prefix}/lib \
    75                         BLAS=${prefix}/lib
    76     depends_lib-delete  port:atlas
     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    }
     81
     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        }
     94
     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
     
    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 GCC version; 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/
  • trunk/dports/python/py27-numpy/Portfile

    r71179 r72220  
     1# -*- 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
    12# $Id$
    23
     
    67name                    py27-numpy
    78version                 1.5.0
     9revision                1
    810categories              python
    911platforms               darwin
     
    2527
    2628depends_lib-append      port:fftw-3 \
    27                         port:py27-nose \
    28                         port:atlas
     29                        port:py27-nose
    2930
    30 build.env-append        ATLAS=${prefix}/lib \
     31variant atlas \
     32description {Use the MacPorts' ATLAS libraries \
     33             instead of Apple's Accelerate framework} {
     34    build.env-append    ATLAS=${prefix}/lib \
    3135                        LAPACK=${prefix}/lib \
    3236                        BLAS=${prefix}/lib
    33 
    34 destroot.env-append     ATLAS=${prefix}/lib \
     37    destroot.env-append ATLAS=${prefix}/lib \
    3538                        LAPACK=${prefix}/lib \
    3639                        BLAS=${prefix}/lib
    37 
    38 post-patch {
    39     reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" ${worksrcpath}/numpy/f2py/setup.py
     40    depends_lib-append  port:atlas
    4041}
    4142
    42 variant gcc43 conflicts gcc44 description {Use the gcc43 compiler (enables fortran code)} {
    43     depends_lib-append  port:gcc43
    44     configure.compiler  macports-gcc-4.3
    45     build.env-append    CC="${prefix}/bin/gcc-mp-4.3" \
    46                         CXX="${prefix}/bin/g++-mp-4.3"
    47 
    48     destroot.env-append CC="${prefix}/bin/gcc-mp-4.3" \
    49                         CXX="${prefix}/bin/g++-mp-4.3"
     43# use ALTAS by default; if MacPorts' ATLAS is not used, numpy will
     44# link with that supplied by Apple's Accelerate framework.
     45if {![variant_isset atlas]} {
     46    default_variants +atlas
    5047}
    5148
    52 variant gcc44 conflicts gcc43 description {Use the gcc44 compiler (enables fortran code)} {
    53     depends_lib-append  port:gcc44
    54     configure.compiler  macports-gcc-4.4
    55     build.env-append    CC="${prefix}/bin/gcc-mp-4.4" \
    56                         CXX="${prefix}/bin/g++-mp-4.4"
     49# when using ATLAS (whether by default or specified by the user via
     50# the +atlas variant) ...
     51set gcc_version ""
     52if {[variant_isset atlas]} {
     53    # see if the user has set -gcc4X to disable using MacPorts'
     54    # compiler; if not, either use what the user set (as +gcc4X) or
     55    # default to gcc44.
    5756
    58     destroot.env-append CC="${prefix}/bin/gcc-mp-4.4" \
    59                         CXX="${prefix}/bin/g++-mp-4.4"
    60 }
     57    variant gcc43 conflicts gcc44 gcc45 \
     58    description {Use the gcc43 compiler (enables fortran linking)} {}
    6159
    62 if {![variant_isset gcc43]} {
    63     default_variants +gcc44
    64 }
     60    variant gcc44 conflicts gcc43 gcc45 \
     61    description {Use the gcc44 compiler (enables fortran linking)} {}
    6562
    66 variant no_atlas description {Do not use the macports atlas libs} {
    67     build.env-delete    ATLAS=${prefix}/lib \
    68                         LAPACK=${prefix}/lib \
    69                         BLAS=${prefix}/lib
     63    variant gcc45 conflicts gcc43 gcc44 \
     64    description {Use the gcc45 compiler (enables fortran linking)} {}
    7065
    71     destroot.env-delete ATLAS=${prefix}/lib \
    72                         LAPACK=${prefix}/lib \
    73                         BLAS=${prefix}/lib
    74     depends_lib-delete  port:atlas
     66    if {![variant_isset gcc43] &&
     67        ![variant_isset gcc44] &&
     68        ![variant_isset gcc45]} {
     69        default_variants +gcc44
     70    }
     71    if {[variant_isset gcc43]} {
     72        set gcc_version "4.3"
     73    }
     74    if {[variant_isset gcc44]} {
     75        set gcc_version "4.4"
     76    }
     77    if {[variant_isset gcc45]} {
     78        set gcc_version "4.5"
     79    }
     80
     81    if {${gcc_version} != ""} {
     82        # when using non-Apple GCC for universal install, it can
     83        # create binaries only for the native OS architecture, at
     84        # either 32 or 64 bits.  Restrict the supported archs
     85        # accordingly.
     86        if {[variant_exists universal] && [variant_isset universal]} {
     87            if { ${os.arch}=="i386" } {
     88                set universal_archs_supported { i386 x86_64 }
     89            } else {
     90                set universal_archs_supported { ppc  ppc64 }
     91            }
     92        }
     93
     94        # include all the correct GCC4X port
     95        depends_lib-append port:gcc[join [split ${gcc_version} "."] ""]
     96
     97        # force LDFLAGS for correct linking of the linalg module
     98        # for non-Apple GCC compilers
     99        patchfiles-append  patch-numpy_linalg_setup.py.diff
     100
     101    } else {
     102        # user specified -gcc4X but +atlas (either as default or
     103        # explicitly); do not allow since it might lead to
     104        # undetermined runtime execution.
     105        return -code error \
     106"\n\nWhen using the +atlas variant (either as the default or setting
     107explicitly), one of the +gcc4X variants must be selected.\n"
     108    }
    75109}
    76110
     
    79113}
    80114
     115post-patch {
     116    reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
     117        ${worksrcpath}/numpy/f2py/setup.py
     118
     119    # disallow searching for any fortran executable except what is
     120    # specified in this Portfile; NOTE: this change only works when
     121    # setting the GCC version; if this flag is not set (meaning no
     122    # +gcc4X variant is set), then F2PY may or not work.
     123    if {${gcc_version} != ""} {
     124        # set which fortran to use in the f2py Python scripts
     125        reinplace "/possible_executables/s|\\\[.*\\\]|\['gfortran-mp-${gcc_version}'\]|g" ${worksrcpath}/numpy/distutils/fcompiler/gnu.py
     126    }
     127}
     128
    81129livecheck.type  regex
    82130livecheck.url   http://sourceforge.net/projects/numpy/files/
Note: See TracChangeset for help on using the changeset viewer.