[72220] trunk/dports/python

michaelld at macports.org michaelld at macports.org
Thu Oct 7 11:04:18 PDT 2010


Revision: 72220
          http://trac.macports.org/changeset/72220
Author:   michaelld at macports.org
Date:     2010-10-07 11:04:16 -0700 (Thu, 07 Oct 2010)
Log 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.

Modified Paths:
--------------
    trunk/dports/python/py25-numpy/Portfile
    trunk/dports/python/py26-numpy/Portfile
    trunk/dports/python/py27-numpy/Portfile

Added Paths:
-----------
    trunk/dports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff
    trunk/dports/python/py26-numpy/files/patch-numpy_linalg_setup.py.diff
    trunk/dports/python/py27-numpy/files/patch-numpy_linalg_setup.py.diff

Modified: trunk/dports/python/py25-numpy/Portfile
===================================================================
--- trunk/dports/python/py25-numpy/Portfile	2010-10-07 17:32:47 UTC (rev 72219)
+++ trunk/dports/python/py25-numpy/Portfile	2010-10-07 18:04:16 UTC (rev 72220)
@@ -1,3 +1,4 @@
+# -*- 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
@@ -5,6 +6,7 @@
 
 name                py25-numpy
 version             1.5.0
+revision            1
 categories          python
 platforms           darwin
 maintainers         ram openmaintainer
@@ -24,62 +26,112 @@
                     patch-fcompiler_g95.diff
 
 depends_lib-append  port:fftw-3 \
-                    port:py25-nose \
-                    port:atlas
+                    port:py25-nose
 
-build.env-append      ATLAS=${prefix}/lib \
-                      LAPACK=${prefix}/lib \
-                      BLAS=${prefix}/lib
-
-destroot.env-append   ATLAS=${prefix}/lib \
-                      LAPACK=${prefix}/lib \
-                      BLAS=${prefix}/lib
-
-post-patch {
-  reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" ${worksrcpath}/numpy/f2py/setup.py
+variant atlas \
+description {Use the MacPorts' ATLAS libraries \
+             instead of Apple's Accelerate framework} {
+    build.env-append    ATLAS=${prefix}/lib \
+                        LAPACK=${prefix}/lib \
+                        BLAS=${prefix}/lib
+    destroot.env-append ATLAS=${prefix}/lib \
+                        LAPACK=${prefix}/lib \
+                        BLAS=${prefix}/lib
+    depends_lib-append  port:atlas
 }
 
-post-destroot {
-  if {${os.platform} == "darwin" && ${os.major} < 10} {
-    move ${destroot}${prefix}/bin/f2py ${destroot}${prefix}/bin/f2py${python.branch}
-  }
+# use ALTAS by default; if MacPorts' ATLAS is not used, numpy will
+# link with that supplied by Apple's Accelerate framework.
+if {![variant_isset atlas]} {
+    default_variants +atlas
 }
 
-variant gcc43 conflicts gcc44 description {Use the gcc43 compiler (enables fortran code)} {
-  depends_lib-append  port:gcc43
-  configure.compiler  macports-gcc-4.3
-  build.env-append    CC="${prefix}/bin/gcc-mp-4.3" \
-                      CXX="${prefix}/bin/g++-mp-4.3"
+# when using ATLAS (whether by default or specified by the user via
+# the +atlas variant) ...
+set gcc_version ""
+if {[variant_isset atlas]} {
+    # see if the user has set -gcc4X to disable using MacPorts'
+    # compiler; if not, either use what the user set (as +gcc4X) or
+    # default to gcc44.
 
-  destroot.env-append CC="${prefix}/bin/gcc-mp-4.3" \
-                      CXX="${prefix}/bin/g++-mp-4.3"
-}
+    variant gcc43 conflicts gcc44 gcc45 \
+    description {Use the gcc43 compiler (enables fortran linking)} {}
 
-variant gcc44 conflicts gcc43 description {Use the gcc44 compiler (enables fortran code)} {
-  depends_lib-append  port:gcc44
-  configure.compiler  macports-gcc-4.4
-  build.env-append    CC="${prefix}/bin/gcc-mp-4.4" \
-                      CXX="${prefix}/bin/g++-mp-4.4"
+    variant gcc44 conflicts gcc43 gcc45 \
+    description {Use the gcc44 compiler (enables fortran linking)} {}
 
-  destroot.env-append CC="${prefix}/bin/gcc-mp-4.4" \
-                      CXX="${prefix}/bin/g++-mp-4.4"
+    variant gcc45 conflicts gcc43 gcc44 \
+    description {Use the gcc45 compiler (enables fortran linking)} {}
+
+    if {![variant_isset gcc43] &&
+        ![variant_isset gcc44] &&
+        ![variant_isset gcc45]} {
+        default_variants +gcc44
+    }
+    if {[variant_isset gcc43]} {
+        set gcc_version "4.3"
+    }
+    if {[variant_isset gcc44]} {
+        set gcc_version "4.4"
+    }
+    if {[variant_isset gcc45]} {
+        set gcc_version "4.5"
+    }
+
+    if {${gcc_version} != ""} {
+        # 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 {[variant_exists universal] && [variant_isset universal]} {
+            if { ${os.arch}=="i386" } {
+                set universal_archs_supported { i386 x86_64 }
+            } else {
+                set universal_archs_supported { ppc  ppc64 }
+            }
+        }
+
+        # include all the correct GCC4X port
+        depends_lib-append port:gcc[join [split ${gcc_version} "."] ""]
+
+        # force LDFLAGS for correct linking of the linalg module
+        # for non-Apple GCC compilers
+        patchfiles-append  patch-numpy_linalg_setup.py.diff
+
+    } else {
+        # user specified -gcc4X but +atlas (either as default or
+        # explicitly); do not allow since it might lead to
+        # undetermined runtime execution.
+        return -code error \
+"\n\nWhen using the +atlas variant (either as the default or setting
+explicitly), one of the +gcc4X variants must be selected.\n"
+    }
 }
 
-if {![variant_isset gcc43]} {
-    default_variants +gcc44
+variant universal {
+    patchfiles-append   patch-setup.py.diff
 }
 
-variant no_atlas description {Do not use the macports atlas libs} {
-  depends_lib-delete  port:atlas
-  build.env-delete    ATLAS=${prefix}/lib \
-                      LAPACK=${prefix}/lib \
-                      BLAS=${prefix}/lib
+post-patch {
+    reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
+        ${worksrcpath}/numpy/f2py/setup.py
 
-  destroot.env-delete ATLAS=${prefix}/lib \
-                      LAPACK=${prefix}/lib \
-                      BLAS=${prefix}/lib
+    # disallow searching for any fortran executable except what is
+    # specified in this Portfile; NOTE: this change only works when
+    # setting the GCC version; if this flag is not set (meaning no
+    # +gcc4X variant is set), then F2PY may or not work.
+    if {${gcc_version} != ""} {
+        # set which fortran to use in the f2py Python scripts
+        reinplace "/possible_executables/s|\\\[.*\\\]|\['gfortran-mp-${gcc_version}'\]|g" ${worksrcpath}/numpy/distutils/fcompiler/gnu.py
+    }
 }
 
+post-destroot {
+  if {${os.platform} == "darwin" && ${os.major} < 10} {
+    move ${destroot}${prefix}/bin/f2py ${destroot}${prefix}/bin/f2py${python.branch}
+  }
+}
+
 livecheck.type        regex
 livecheck.url         http://sourceforge.net/projects/numpy/files/
 livecheck.regex       {numpy-(\d+(\.\d+)*)\.tar}

Added: trunk/dports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff
===================================================================
--- trunk/dports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff	                        (rev 0)
+++ trunk/dports/python/py25-numpy/files/patch-numpy_linalg_setup.py.diff	2010-10-07 18:04:16 UTC (rev 72220)
@@ -0,0 +1,10 @@
+--- numpy/linalg/setup.py.orig	2010-09-14 11:44:21.000000000 -0400
++++ numpy/linalg/setup.py	2010-09-14 11:45:01.000000000 -0400
+@@ -27,6 +27,7 @@
+                                     'zlapack_lite.c', 'dlapack_lite.c',
+                                     'blas_lite.c', 'dlamch.c',
+                                     'f2c_lite.c','f2c.h'],
++                         extra_link_args=['-undefined dynamic_lookup -bundle'],
+                          extra_info = lapack_info
+                          )
+ 

Modified: trunk/dports/python/py26-numpy/Portfile
===================================================================
--- trunk/dports/python/py26-numpy/Portfile	2010-10-07 17:32:47 UTC (rev 72219)
+++ trunk/dports/python/py26-numpy/Portfile	2010-10-07 18:04:16 UTC (rev 72220)
@@ -7,6 +7,7 @@
 name                    py26-numpy
 epoch                   20100319
 version                 1.5.0
+revision                1
 categories              python
 platforms               darwin
 maintainers             mcalhoun openmaintainer
@@ -26,60 +27,106 @@
                         patch-fcompiler_g95.diff
 
 depends_lib-append      port:fftw-3 \
-                        port:py26-nose \
-                        port:atlas
+                        port:py26-nose
 
-build.env-append        ATLAS=${prefix}/lib \
+variant atlas \
+description {Use the MacPorts' ATLAS libraries \
+             instead of Apple's Accelerate framework} {
+    build.env-append    ATLAS=${prefix}/lib \
                         LAPACK=${prefix}/lib \
                         BLAS=${prefix}/lib
-
-destroot.env-append     ATLAS=${prefix}/lib \
+    destroot.env-append ATLAS=${prefix}/lib \
                         LAPACK=${prefix}/lib \
                         BLAS=${prefix}/lib
+    depends_lib-append  port:atlas
+}
 
-post-patch {
-    reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" ${worksrcpath}/numpy/f2py/setup.py
+# use ALTAS by default; if MacPorts' ATLAS is not used, numpy will
+# link with that supplied by Apple's Accelerate framework.
+if {![variant_isset atlas]} {
+    default_variants +atlas
 }
 
-variant gcc43 conflicts gcc44 description {Use the gcc43 compiler (enables fortran code)} {
-    depends_lib-append  port:gcc43
-    configure.compiler  macports-gcc-4.3
-    build.env-append    CC="${prefix}/bin/gcc-mp-4.3" \
-                        CXX="${prefix}/bin/g++-mp-4.3"
+# when using ATLAS (whether by default or specified by the user via
+# the +atlas variant) ...
+set gcc_version ""
+if {[variant_isset atlas]} {
+    # see if the user has set -gcc4X to disable using MacPorts'
+    # compiler; if not, either use what the user set (as +gcc4X) or
+    # default to gcc44.
 
-    destroot.env-append CC="${prefix}/bin/gcc-mp-4.3" \
-                        CXX="${prefix}/bin/g++-mp-4.3"
-}
+    variant gcc43 conflicts gcc44 gcc45 \
+    description {Use the gcc43 compiler (enables fortran linking)} {}
 
-variant gcc44 conflicts gcc43 description {Use the gcc44 compiler (enables fortran code)} {
-    depends_lib-append  port:gcc44
-    configure.compiler  macports-gcc-4.4
-    build.env-append    CC="${prefix}/bin/gcc-mp-4.4" \
-                        CXX="${prefix}/bin/g++-mp-4.4"
+    variant gcc44 conflicts gcc43 gcc45 \
+    description {Use the gcc44 compiler (enables fortran linking)} {}
 
-    destroot.env-append CC="${prefix}/bin/gcc-mp-4.4" \
-                        CXX="${prefix}/bin/g++-mp-4.4"
-}
+    variant gcc45 conflicts gcc43 gcc44 \
+    description {Use the gcc45 compiler (enables fortran linking)} {}
 
-if {![variant_isset gcc43]} {
-    default_variants +gcc44
-}
+    if {![variant_isset gcc43] &&
+        ![variant_isset gcc44] &&
+        ![variant_isset gcc45]} {
+        default_variants +gcc44
+    }
+    if {[variant_isset gcc43]} {
+        set gcc_version "4.3"
+    }
+    if {[variant_isset gcc44]} {
+        set gcc_version "4.4"
+    }
+    if {[variant_isset gcc45]} {
+        set gcc_version "4.5"
+    }
 
-variant no_atlas description {Do not use the macports atlas libs} {
-    build.env-delete    ATLAS=${prefix}/lib \
-                        LAPACK=${prefix}/lib \
-                        BLAS=${prefix}/lib
+    if {${gcc_version} != ""} {
+        # 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 {[variant_exists universal] && [variant_isset universal]} {
+            if { ${os.arch}=="i386" } {
+                set universal_archs_supported { i386 x86_64 }
+            } else {
+                set universal_archs_supported { ppc  ppc64 }
+            }
+        }
 
-    destroot.env-delete ATLAS=${prefix}/lib \
-                        LAPACK=${prefix}/lib \
-                        BLAS=${prefix}/lib
-    depends_lib-delete  port:atlas
+        # include all the correct GCC4X port
+        depends_lib-append port:gcc[join [split ${gcc_version} "."] ""]
+
+        # force LDFLAGS for correct linking of the linalg module
+        # for non-Apple GCC compilers
+        patchfiles-append  patch-numpy_linalg_setup.py.diff
+
+    } else {
+        # user specified -gcc4X but +atlas (either as default or
+        # explicitly); do not allow since it might lead to
+        # undetermined runtime execution.
+        return -code error \
+"\n\nWhen using the +atlas variant (either as the default or setting
+explicitly), one of the +gcc4X variants must be selected.\n"
+    }
 }
 
 variant universal {
     patchfiles-append   patch-setup.py.diff
 }
 
+post-patch {
+    reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
+        ${worksrcpath}/numpy/f2py/setup.py
+
+    # disallow searching for any fortran executable except what is
+    # specified in this Portfile; NOTE: this change only works when
+    # setting the GCC version; if this flag is not set (meaning no
+    # +gcc4X variant is set), then F2PY may or not work.
+    if {${gcc_version} != ""} {
+        # set which fortran to use in the f2py Python scripts
+        reinplace "/possible_executables/s|\\\[.*\\\]|\['gfortran-mp-${gcc_version}'\]|g" ${worksrcpath}/numpy/distutils/fcompiler/gnu.py
+    }
+}
+
 livecheck.type  regex
 livecheck.url   http://sourceforge.net/projects/numpy/files/
 livecheck.regex "files\/NumPy\/(\\d+(?:\\.\\d+)*)\/numpy"

Added: trunk/dports/python/py26-numpy/files/patch-numpy_linalg_setup.py.diff
===================================================================
--- trunk/dports/python/py26-numpy/files/patch-numpy_linalg_setup.py.diff	                        (rev 0)
+++ trunk/dports/python/py26-numpy/files/patch-numpy_linalg_setup.py.diff	2010-10-07 18:04:16 UTC (rev 72220)
@@ -0,0 +1,10 @@
+--- numpy/linalg/setup.py.orig	2010-09-14 11:44:21.000000000 -0400
++++ numpy/linalg/setup.py	2010-09-14 11:45:01.000000000 -0400
+@@ -27,6 +27,7 @@
+                                     'zlapack_lite.c', 'dlapack_lite.c',
+                                     'blas_lite.c', 'dlamch.c',
+                                     'f2c_lite.c','f2c.h'],
++                         extra_link_args=['-undefined dynamic_lookup -bundle'],
+                          extra_info = lapack_info
+                          )
+ 

Modified: trunk/dports/python/py27-numpy/Portfile
===================================================================
--- trunk/dports/python/py27-numpy/Portfile	2010-10-07 17:32:47 UTC (rev 72219)
+++ trunk/dports/python/py27-numpy/Portfile	2010-10-07 18:04:16 UTC (rev 72220)
@@ -1,3 +1,4 @@
+# -*- 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
@@ -5,6 +6,7 @@
 
 name                    py27-numpy
 version                 1.5.0
+revision                1
 categories              python
 platforms               darwin
 maintainers             ram openmaintainer
@@ -24,60 +26,106 @@
                         patch-fcompiler_g95.diff
 
 depends_lib-append      port:fftw-3 \
-                        port:py27-nose \
-                        port:atlas
+                        port:py27-nose
 
-build.env-append        ATLAS=${prefix}/lib \
+variant atlas \
+description {Use the MacPorts' ATLAS libraries \
+             instead of Apple's Accelerate framework} {
+    build.env-append    ATLAS=${prefix}/lib \
                         LAPACK=${prefix}/lib \
                         BLAS=${prefix}/lib
-
-destroot.env-append     ATLAS=${prefix}/lib \
+    destroot.env-append ATLAS=${prefix}/lib \
                         LAPACK=${prefix}/lib \
                         BLAS=${prefix}/lib
+    depends_lib-append  port:atlas
+}
 
-post-patch {
-    reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" ${worksrcpath}/numpy/f2py/setup.py
+# use ALTAS by default; if MacPorts' ATLAS is not used, numpy will
+# link with that supplied by Apple's Accelerate framework.
+if {![variant_isset atlas]} {
+    default_variants +atlas
 }
 
-variant gcc43 conflicts gcc44 description {Use the gcc43 compiler (enables fortran code)} {
-    depends_lib-append  port:gcc43
-    configure.compiler  macports-gcc-4.3
-    build.env-append    CC="${prefix}/bin/gcc-mp-4.3" \
-                        CXX="${prefix}/bin/g++-mp-4.3"
+# when using ATLAS (whether by default or specified by the user via
+# the +atlas variant) ...
+set gcc_version ""
+if {[variant_isset atlas]} {
+    # see if the user has set -gcc4X to disable using MacPorts'
+    # compiler; if not, either use what the user set (as +gcc4X) or
+    # default to gcc44.
 
-    destroot.env-append CC="${prefix}/bin/gcc-mp-4.3" \
-                        CXX="${prefix}/bin/g++-mp-4.3"
-}
+    variant gcc43 conflicts gcc44 gcc45 \
+    description {Use the gcc43 compiler (enables fortran linking)} {}
 
-variant gcc44 conflicts gcc43 description {Use the gcc44 compiler (enables fortran code)} {
-    depends_lib-append  port:gcc44
-    configure.compiler  macports-gcc-4.4
-    build.env-append    CC="${prefix}/bin/gcc-mp-4.4" \
-                        CXX="${prefix}/bin/g++-mp-4.4"
+    variant gcc44 conflicts gcc43 gcc45 \
+    description {Use the gcc44 compiler (enables fortran linking)} {}
 
-    destroot.env-append CC="${prefix}/bin/gcc-mp-4.4" \
-                        CXX="${prefix}/bin/g++-mp-4.4"
-}
+    variant gcc45 conflicts gcc43 gcc44 \
+    description {Use the gcc45 compiler (enables fortran linking)} {}
 
-if {![variant_isset gcc43]} {
-    default_variants +gcc44
-}
+    if {![variant_isset gcc43] &&
+        ![variant_isset gcc44] &&
+        ![variant_isset gcc45]} {
+        default_variants +gcc44
+    }
+    if {[variant_isset gcc43]} {
+        set gcc_version "4.3"
+    }
+    if {[variant_isset gcc44]} {
+        set gcc_version "4.4"
+    }
+    if {[variant_isset gcc45]} {
+        set gcc_version "4.5"
+    }
 
-variant no_atlas description {Do not use the macports atlas libs} {
-    build.env-delete    ATLAS=${prefix}/lib \
-                        LAPACK=${prefix}/lib \
-                        BLAS=${prefix}/lib
+    if {${gcc_version} != ""} {
+        # 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 {[variant_exists universal] && [variant_isset universal]} {
+            if { ${os.arch}=="i386" } {
+                set universal_archs_supported { i386 x86_64 }
+            } else {
+                set universal_archs_supported { ppc  ppc64 }
+            }
+        }
 
-    destroot.env-delete ATLAS=${prefix}/lib \
-                        LAPACK=${prefix}/lib \
-                        BLAS=${prefix}/lib
-    depends_lib-delete  port:atlas
+        # include all the correct GCC4X port
+        depends_lib-append port:gcc[join [split ${gcc_version} "."] ""]
+
+        # force LDFLAGS for correct linking of the linalg module
+        # for non-Apple GCC compilers
+        patchfiles-append  patch-numpy_linalg_setup.py.diff
+
+    } else {
+        # user specified -gcc4X but +atlas (either as default or
+        # explicitly); do not allow since it might lead to
+        # undetermined runtime execution.
+        return -code error \
+"\n\nWhen using the +atlas variant (either as the default or setting
+explicitly), one of the +gcc4X variants must be selected.\n"
+    }
 }
 
 variant universal {
     patchfiles-append   patch-setup.py.diff
 }
 
+post-patch {
+    reinplace "s|@@MPORTS_PYTHON@@|${python.bin}|" \
+        ${worksrcpath}/numpy/f2py/setup.py
+
+    # disallow searching for any fortran executable except what is
+    # specified in this Portfile; NOTE: this change only works when
+    # setting the GCC version; if this flag is not set (meaning no
+    # +gcc4X variant is set), then F2PY may or not work.
+    if {${gcc_version} != ""} {
+        # set which fortran to use in the f2py Python scripts
+        reinplace "/possible_executables/s|\\\[.*\\\]|\['gfortran-mp-${gcc_version}'\]|g" ${worksrcpath}/numpy/distutils/fcompiler/gnu.py
+    }
+}
+
 livecheck.type  regex
 livecheck.url   http://sourceforge.net/projects/numpy/files/
 livecheck.regex "files\/NumPy\/(\\d+(?:\\.\\d+)*)\/numpy"

Added: trunk/dports/python/py27-numpy/files/patch-numpy_linalg_setup.py.diff
===================================================================
--- trunk/dports/python/py27-numpy/files/patch-numpy_linalg_setup.py.diff	                        (rev 0)
+++ trunk/dports/python/py27-numpy/files/patch-numpy_linalg_setup.py.diff	2010-10-07 18:04:16 UTC (rev 72220)
@@ -0,0 +1,10 @@
+--- numpy/linalg/setup.py.orig	2010-09-14 11:44:21.000000000 -0400
++++ numpy/linalg/setup.py	2010-09-14 11:45:01.000000000 -0400
+@@ -27,6 +27,7 @@
+                                     'zlapack_lite.c', 'dlapack_lite.c',
+                                     'blas_lite.c', 'dlamch.c',
+                                     'f2c_lite.c','f2c.h'],
++                         extra_link_args=['-undefined dynamic_lookup -bundle'],
+                          extra_info = lapack_info
+                          )
+ 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20101007/b1ee53f7/attachment-0001.html>


More information about the macports-changes mailing list