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

mcalhoun at macports.org mcalhoun at macports.org
Sat Dec 12 16:47:03 PST 2015


Revision: 143471
          https://trac.macports.org/changeset/143471
Author:   mcalhoun at macports.org
Date:     2015-12-12 16:47:03 -0800 (Sat, 12 Dec 2015)
Log Message:
-----------
py-numpy: allow universal builds for all compilers (#42416)

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

Modified: trunk/dports/python/py-numpy/Portfile
===================================================================
--- trunk/dports/python/py-numpy/Portfile	2015-12-13 00:38:42 UTC (rev 143470)
+++ trunk/dports/python/py-numpy/Portfile	2015-12-13 00:47:03 UTC (rev 143471)
@@ -19,14 +19,24 @@
 checksums               rmd160 8635b0d5e9e1744dd444927cbcfc7be29ffeaad7 \
                         sha256 53425e0f53900f9206f0f71f7209524011c0e5140cfda0ce6b2147272f395723
 
+if {${name} ne ${subport}} {
+    # the python PortGroup puts compiler names in build.env and destroot.env
+    # for this to be done correctly, the following must be located before python.versions
+    pre-build    { set_compilers }
+    pre-destroot { set_compilers }
+}
+
 python.versions         26 27 33 34 35
 
 # respect ${build_arch} value
 compilers.clear_archflags  no
 
+# http://trac.macports.org/ticket/34562
+python.consistent_destroot yes
+
 # 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
+#universal_variant no
 
 if {${name} ne ${subport}} {
     compilers.setup         -dragonegg -gcc44 -gcc45 -gcc46 -g95
@@ -44,25 +54,11 @@
     }
 
     pre-destroot {
-        # 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]"
-
         destroot.env-append     ARCHFLAGS="[get_canonical_archflags ld]"
     }
 
     variant atlas description conflicts openblas {Use MacPorts ATLAS Libraries} {
         depends_lib-append      port:atlas
-
-        if {[variant_isset universal]} {
-            python.set_compiler     no
-        }
     }
 
     variant openblas conflicts atlas description "Use MacPorts OpenBLAS Libraries" {
@@ -150,7 +146,7 @@
                 ${worksrcpath}/numpy/distutils/fcompiler/gnu.py
         }
 
-        if {[variant_isset universal] && [variant_isset atlas]} {
+        if { [use_wrapper] } {
             # Prepare wrappers
             file copy -force ${filespath}/wrapper-template \
                 ${worksrcpath}/c-wrapper
@@ -171,16 +167,6 @@
             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]} {
@@ -203,6 +189,39 @@
         default_variants      +gfortran
     }
 
+    # determine if special wrapper values are needed for compiler names
+    # a procedure is needed since variants from PortGroup compilers must
+    #    be evaluated before it can be determined if clang is being used
+    proc use_wrapper {} {
+        global configure.cc
+
+        if {[variant_isset universal]} {
+            if {[variant_isset atlas]} {
+                # uses fortran as a linker, which does not handle multile -arch values properly
+                return 1
+            }
+            if {![string match *clang* ${configure.cc}]} {
+                # gcc compilers do not handle multile -arch values properly
+                return 1
+            }
+        }
+        return 0
+    }
+
+    # set compiler names
+    proc set_compilers {} {
+        global configure.cc configure.cxx configure.fc worksrcpath
+
+        if {[use_wrapper]} {
+            # override values set in compilers PortGroup
+            configure.cc  ${worksrcpath}/c-wrapper
+            configure.cxx ${worksrcpath}/cxx-wrapper
+            configure.fc  ${worksrcpath}/f-wrapper
+            configure.f77 ${worksrcpath}/f-wrapper
+            configure.f90 ${worksrcpath}/f-wrapper
+        }
+    }
+
     livecheck.type        none
 } 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/20151212/49c6d86e/attachment.html>


More information about the macports-changes mailing list