[111803] trunk/dports/math/OpenBLAS/Portfile

nicos at macports.org nicos at macports.org
Wed Oct 2 07:58:21 PDT 2013


Revision: 111803
          https://trac.macports.org/changeset/111803
Author:   nicos at macports.org
Date:     2013-10-02 07:58:21 -0700 (Wed, 02 Oct 2013)
Log Message:
-----------
openblas: adding clang variant, disabling avx if not clang (ticket #40592)

Modified Paths:
--------------
    trunk/dports/math/OpenBLAS/Portfile

Modified: trunk/dports/math/OpenBLAS/Portfile
===================================================================
--- trunk/dports/math/OpenBLAS/Portfile	2013-10-02 14:44:31 UTC (rev 111802)
+++ trunk/dports/math/OpenBLAS/Portfile	2013-10-02 14:58:21 UTC (rev 111803)
@@ -23,34 +23,53 @@
 checksums           rmd160  5f08d211f20a46c77eda4ff212201e684a2baf14 \
                     sha256  048986f4e0a8d480c5e6d439915738f3298f2629d6a399a1ddb16e1629b07901
 
-variant gcc45 conflicts gcc46 gcc47 gcc48 gcc49 \
+variant gcc45 conflicts gcc46 gcc47 gcc48 gcc49 clang \
     description "Use Gcc45 as compiler" { 
     configure.compiler  macports-gcc-4.5
 }
 
-variant gcc46 conflicts gcc45 gcc47 gcc48 gcc49 \
+variant gcc46 conflicts gcc45 gcc47 gcc48 gcc49 clang \
     description "Use Gcc46 as compiler" { 
     configure.compiler  macports-gcc-4.6
 }
 
-variant gcc47 conflicts gcc45 gcc46 gcc48 gcc49 \
+variant gcc47 conflicts gcc45 gcc46 gcc48 gcc49 clang \
     description "Use Gcc47 as compiler" { 
     configure.compiler  macports-gcc-4.7
 }
 
-variant gcc48 conflicts gcc45 gcc46 gcc47 gcc49 \
+variant gcc48 conflicts gcc45 gcc46 gcc47 gcc49 clang \
     description "Use Gcc48 as compiler" { 
     configure.compiler  macports-gcc-4.8
 }
 
-variant gcc49 conflicts gcc45 gcc46 gcc47 gcc48 \
+variant gcc49 conflicts gcc45 gcc46 gcc47 gcc48 clang \
     description "Use Gcc49 as compiler" { 
     configure.compiler  macports-gcc-4.9
 }
 
+variant clang conflicts gcc45 gcc46 gcc47 gcc48 gcc49 \
+    description "Use Clang as compiler" {
+    if {[vercmp $xcodeversion 5.0] >= 0} {
+        configure.compiler      clang
+    } else {
+        # Xcode's clang < 5.0 does not support avx
+        configure.compiler      macports-clang-3.3
+    }
+    #Also need gcc for compiling fortran code: forcing to default gcc
+    depends_build-append    port:gcc48
+    configure.fc            ${prefix}/bin/gfortran-mp-4.8
+}
+
 if {![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc47] && \
-    ![variant_isset gcc48] && ![variant_isset gcc49]} {
-    default_variants +gcc48
+    ![variant_isset gcc48] && ![variant_isset gcc49] && ![variant_isset clang]} {
+    if { ![catch {sysctl hw.optional.avx1_0} has_avx] && $has_avx == 1 } {
+        #Use clang if the processor has avx instructions
+        default_variants +clang        
+    } else {
+        #Else, use gcc48 as default
+        default_variants +gcc48
+    }
 }
 
 variant lapack description "Add Lapack/CLapack support to the library" { }
@@ -78,6 +97,9 @@
             if {![variant_isset lapack]} {
                 puts $makeINC "NO_LAPACK = 1"
             }
+            if {![variant_isset clang]} {
+                puts $makeINC "NO_AVX = 1"
+            }
             close $makeINC
         }
     } else {
@@ -99,6 +121,9 @@
         if {![variant_isset lapack]} {
             puts $makeINC "NO_LAPACK = 1"
         }
+        if {![variant_isset clang]} {
+            puts $makeINC "NO_AVX = 1"
+        }
         close $makeINC
     }
 }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131002/a3584e1a/attachment.html>


More information about the macports-changes mailing list