[130954] trunk/dports/python/py-numpy/Portfile

sean at macports.org sean at macports.org
Sat Jan 3 22:01:06 PST 2015


Revision: 130954
          https://trac.macports.org/changeset/130954
Author:   sean at macports.org
Date:     2015-01-03 22:01:06 -0800 (Sat, 03 Jan 2015)
Log Message:
-----------
py-numpy: refactor port to use compilers portgroup

This is a big refactor that cleans up a lot of old and now incorrect logic,
mostly with ATLAS. This changeset is accomplishes:

- ensure that numpy has a fortran compiler
- ensure that compilers match the same ones as ATLAS
- remove python 3.2

Modified Paths:
--------------
    trunk/dports/python/py-numpy/Portfile

Modified: trunk/dports/python/py-numpy/Portfile
===================================================================
--- trunk/dports/python/py-numpy/Portfile	2015-01-04 06:01:04 UTC (rev 130953)
+++ trunk/dports/python/py-numpy/Portfile	2015-01-04 06:01:06 UTC (rev 130954)
@@ -4,9 +4,11 @@
 PortSystem              1.0
 PortGroup               python 1.0
 PortGroup               github 1.0
+PortGroup               compilers 1.0
 
 github.setup            numpy numpy 1.9.1 v
 name                    py-numpy
+revision                1
 categories-append       math
 license                 BSD
 platforms               darwin
@@ -17,8 +19,10 @@
 checksums               rmd160  c043ce0045166762e36c513458abc499d36bbcf5 \
                         sha256  504b7cbc3b47df592d683e0f3b992cfa4d29338f8d23fca07f040164018b607f
 
-python.versions         26 27 32 33 34
+python.versions         26 27 33 34
 
+compilers.setup         require_fortran -clang -dragonegg -gcc44 -gcc45 -gcc46 -g95
+
 if {${name} ne ${subport}} {
     patchfiles              patch-f2py_setup.py.diff \
                             patch-fcompiler_g95.diff \
@@ -28,18 +32,20 @@
                             port:py${python.version}-nose \
                             port:py${python.version}-cython
 
-    # 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]"
+    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]"
+        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} {
@@ -52,61 +58,8 @@
 
     # 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 gcc48.
-
-        variant gcc43 conflicts gcc44 gcc45 gcc46 gcc47 gcc48 \
-        description {Use the gcc43 compiler (enables fortran linking)} {
-            configure.compiler      macports-gcc-4.3
-        }
-
-        variant gcc44 conflicts gcc43 gcc45 gcc46 gcc47 gcc48 \
-        description {Use the gcc44 compiler (enables fortran linking)} {
-            configure.compiler      macports-gcc-4.4
-        }
-
-        variant gcc45 conflicts gcc43 gcc44 gcc46 gcc47 gcc48 \
-        description {Use the gcc45 compiler (enables fortran linking)} {
-            configure.compiler      macports-gcc-4.5
-        }
-
-        variant gcc46 conflicts gcc43 gcc44 gcc45 gcc47 gcc48 \
-        description {Use the gcc46 compiler (enables fortran linking)} {
-            configure.compiler      macports-gcc-4.6
-        }
-
-        variant gcc47 conflicts gcc43 gcc44 gcc45 gcc46 gcc48 \
-        description {Use the gcc47 compiler (enables fortran linking)} {
-            configure.compiler      macports-gcc-4.7
-        }
-
-        variant gcc48 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 \
-        description {Use the gcc48 compiler (enables fortran linking)} {
-            configure.compiler      macports-gcc-4.8
-        }
-
-        if {![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc47]} {
-            default_variants        +gcc48
-        }
-
-        if {[variant_isset gcc43]} {
-            set gcc_version "4.3"
-        } elseif {[variant_isset gcc44]} {
-            set gcc_version "4.4"
-        } elseif {[variant_isset gcc45]} {
-            set gcc_version "4.5"
-        } elseif {[variant_isset gcc46]} {
-            set gcc_version "4.6"
-        } elseif {[variant_isset gcc47]} {
-            set gcc_version "4.7"
-        } elseif {[variant_isset gcc48]} {
-            set gcc_version "4.8"
-        }
-
         # 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
@@ -117,21 +70,48 @@
             supported_archs         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
 
-        if {${gcc_version} == ""} {
-            # 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"
+        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 {
@@ -188,23 +168,6 @@
     }
 
     livecheck.type        none
-
-    if {[variant_isset atlas]} {
-        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
-    }
-
 } else {
     livecheck.regex       archive/[join ${github.tag_prefix} ""](\[\\d+(?:\\.\\d+)*"\]+)${extract.suffix}"
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20150103/a1d531bd/attachment.html>


More information about the macports-changes mailing list