[103464] trunk/dports/math/atlas/Portfile

vince at macports.org vince at macports.org
Tue Feb 26 06:35:03 PST 2013


Revision: 103464
          https://trac.macports.org/changeset/103464
Author:   vince at macports.org
Date:     2013-02-26 06:35:03 -0800 (Tue, 26 Feb 2013)
Log Message:
-----------
Uses a sysctl to detect the number of processors on the machine and build threaded or non-threaded accordingly. On non-threaded builds, make libtatlas a symlink to libsatlas so that dependencies like qrupdate build correctly without to have to figure out which atlas library is present.

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

Modified: trunk/dports/math/atlas/Portfile
===================================================================
--- trunk/dports/math/atlas/Portfile	2013-02-26 13:25:34 UTC (rev 103463)
+++ trunk/dports/math/atlas/Portfile	2013-02-26 14:35:03 UTC (rev 103464)
@@ -7,7 +7,7 @@
 license                 BSD
 name                    atlas
 version                 3.10.1
-revision                1
+revision                2
 
 # additional versions
 set lapackversion       3.4.2
@@ -221,11 +221,6 @@
     configure.args-append   --nof77
 }
 
-if {${build_arch} == "ppc" || ${build_arch} == "ppc64"} {
-
-    configure.args-append   -t 0
-}
-
 # MacPorts defaults to ppc on G4 and G5, so we must override 64-bit
 # detection by Atlas, even if we are on a G5
 
@@ -319,6 +314,16 @@
     configure.args-append   -Si omp 1 
 }
 
+pre-fetch {
+    # If we run on a mono-processor machine (PPC), then disable threading
+
+    if {![catch {sysctl hw.logicalcpu} result] && $result == 1} {
+    configure.args-append    -t 0
+    ui_msg "Building sequential only version of atlas."
+    }
+}
+
+
 extract {
     # extract Atlas and move to a consistent working directory name
     system -W ${workpath}   "bunzip2 -dc ${distpath}/${atlasdist} | \
@@ -499,16 +504,16 @@
 
         # Ensure libgomp is linked
         if {[info exists gccversion] && ${gccnumber} > 45} {
-			set gmpfx	${prefix}/lib/gcc${gccnumber}
-			if {[file exists ${gmpfx}/${arch}/libgomp.dylib]} {
-				reinplace -E \
-					"s|(LIBS =.*)|\\1 ${gmpfx}/${arch}/libgomp.dylib|" \
-					${atlas_path}/build/Make.inc
-			} else {
-				reinplace -E \
-					"s|(LIBS =.*)|\\1 ${gmpfx}/libgomp.dylib|" \
-					${atlas_path}/build/Make.inc
-			}
+            set gmpfx    ${prefix}/lib/gcc${gccnumber}
+            if {[file exists ${gmpfx}/${arch}/libgomp.dylib]} {
+                reinplace -E \
+                    "s|(LIBS =.*)|\\1 ${gmpfx}/${arch}/libgomp.dylib|" \
+                    ${atlas_path}/build/Make.inc
+            } else {
+                reinplace -E \
+                    "s|(LIBS =.*)|\\1 ${gmpfx}/libgomp.dylib|" \
+                    ${atlas_path}/build/Make.inc
+            }
         }
     }
 }
@@ -520,19 +525,30 @@
 
 post-build {
     if {! [variant_isset universal]} {
+        set libdir ${build.dir}/lib
         reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \
-            ${build.dir}/lib/Makefile
-        reinplace "s|dynamic|dynamiclib|g" \
-            ${build.dir}/lib/Makefile
-        system "cd ${build.dir}/lib && ${build.cmd} shared_all"
+            ${libdir}/Makefile
+        reinplace "s|dynamic|dynamiclib|g" ${libdir}/Makefile
+
+        # On mono-processors machines, build libsatlas.dylib only
+        if {![catch {sysctl hw.logicalcpu} result] && $result == 1} {
+            system -W ${libdir} "${build.cmd} dylib"
+        } else {
+            system -W ${libdir} "${build.cmd} shared_all"
+        }
     } else {
         foreach arch ${universal_archs_to_use} {
+            set libdir ${workpath}/${name}-${version}-${arch}/build/lib
             reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \
-                ${workpath}/${name}-${version}-${arch}/build/lib/Makefile
-            reinplace "s|dynamic|dynamiclib|g" \
-                ${workpath}/${name}-${version}-${arch}/build/lib/Makefile
-            system "cd ${workpath}/${name}-${version}-${arch}/build/lib && \
-                    ${build.cmd} shared_all"
+                ${libdir}/Makefile
+            reinplace "s|dynamic|dynamiclib|g" ${libdir}/Makefile
+
+        # Same as above
+            if {![catch {sysctl hw.logicalcpu} result] && $result == 1} {
+                system -W ${libdir} "${build.cmd} dylib"
+            } else {
+                system -W ${libdir} "${build.cmd} shared_all"
+            }
         }
     }
 }
@@ -540,5 +556,13 @@
 destroot.dir          ${build.dir}
 destroot.destdir      DESTDIR=${destroot}${prefix}
 
+post-destroot {
+    # On monoprocessor machines, make tatlas and satlas synonymous
+    if {![catch {sysctl hw.logicalcpu} result] && $result == 1} {
+        set libdir ${destroot}${prefix}/lib
+        system -W ${libdir} "ln -s libsatlas.dylib libtatlas.dylib"
+    }
+}
+    
 livecheck.name        math-atlas
 livecheck.distname    Stable
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20130226/5791a130/attachment-0001.html>


More information about the macports-changes mailing list