[64567] trunk/dports/math/atlas

jameskyle at macports.org jameskyle at macports.org
Tue Mar 9 07:14:17 PST 2010


Revision: 64567
          http://trac.macports.org/changeset/64567
Author:   jameskyle at macports.org
Date:     2010-03-09 07:14:13 -0800 (Tue, 09 Mar 2010)
Log Message:
-----------
Applied patch to atlas build provided in #23349. Build and Linking verified on intel mac pro 10.6

Modified Paths:
--------------
    trunk/dports/math/atlas/Portfile
    trunk/dports/math/atlas/files/patch-build-Make.top.diff

Modified: trunk/dports/math/atlas/Portfile
===================================================================
--- trunk/dports/math/atlas/Portfile	2010-03-09 14:54:03 UTC (rev 64566)
+++ trunk/dports/math/atlas/Portfile	2010-03-09 15:14:13 UTC (rev 64567)
@@ -42,10 +42,8 @@
                     rmd160  e8fabba2fdd944afbc02a83599cf45a0d721030d
 
 
-# the following patch corrects extension conventions for osx's dynamic libs
-set make_patch      patch-build-Make.top.diff
 use_parallel_build  no
-build.target build
+build.target        build
 build.dir           ${workpath}/${name}-${version}/build
 
 destroot.dir        ${build.dir}
@@ -167,57 +165,60 @@
     # recursively remove directories
     ui_debug "reinplace for make to recursively remove directories on clean"
     reinplace "s|rm -f|rm -rf|g" ${workpath}/${name}-${version}/build/Makefile
+}
 
-    ui_debug "patch ${name}-${version}/build/Make.top to install dynamic libs"
-    system "cd ${worksrcpath}/build/ && \
-            patch -p0 < ${filespath}/${make_patch}"
+proc make_dylib { lib libs } {
+    global destroot prefix myarch
+    system "cd ${destroot}/${prefix}/lib && \
+            ( test ! -e ${lib}.a ||
+              ld -arch ${myarch} -dynamic -dylib -single_module -dead_strip \
+              -x -all_load -L. -L${prefix}/lib/gcc43 -ldylib1.o \
+              -dylib_install_name ${prefix}/lib/${lib}.dylib \
+              ${lib}.a -o ${lib}.dylib ${libs} && rm -f ${lib}.a)"
 }
 
-pre-destroot {
+
+post-destroot {
   # We have to manually create the dylib shared libs as the default build does not do this
+  global myarch
+
   if {[string equal "${os.arch}" "powerpc"]} {
     if {${my_arch} == "64" } {
       set myarch "ppc64"
     } else {
       set myarch "ppc"
     }
+  } else {
+    if {${my_arch} == "64" } {
+      set myarch "x86_64"
     } else {
-      if {${my_arch} == "64" } {
-        set myarch "x86_64"
-      } else {
-        set myarch "i386"
-      }
+      set myarch "i386"
     }
+  }
 
-  set ld "ld -arch ${myarch} -dynamic -dylib -single_module -dead_strip -x \
-          -all_load -L. -L${prefix}/lib/gcc43 -ldylib1.o -dylib_install_name"
+  set ncpu [exec sysctl -n hw.ncpu]
 
-  system "cd ${workpath}/${name}-${version}/build/lib && \
-          ${ld} ${prefix}/lib/libatlas.dylib libatlas.a -o libatlas.dylib \
-           -lSystem"
+  make_dylib libatlas { -lSystem }
 
-  system "cd ${workpath}/${name}-${version}/build/lib && \
-          ${ld} ${prefix}/lib/libptcblas.dylib libptcblas.a -o \
-           libptcblas.dylib -latlas \
-           -lSystem"
+  if {${ncpu} == "1" } {
+    # there are no threaded libraries (libpt*) on single-core machines
+    make_dylib libcblas   { -latlas -lSystem }
+    make_dylib libf77blas { -lgfortran -latlas -lSystem }
+  } else {
+    make_dylib libptcblas   { -latlas -lSystem }
+    make_dylib libptf77blas { -lgfortran -latlas -lSystem }
 
-  system "cd ${workpath}/${name}-${version}/build/lib && \
-          ${ld} ${prefix}/lib/libptf77blas.dylib \
-          libptf77blas.a -o libptf77blas.dylib \
-           -lgfortran -latlas -lSystem"
+    # we make soft links to the parallel built libs
+    system "cd ${destroot}${prefix}/lib && \
+            ln -s ./libptcblas.dylib libcblas.dylib && \
+            ln -s ./libptf77blas.dylib libf77blas.dylib"
 
-  system "cd ${workpath}/${name}-${version}/build/lib && \
-          ${ld} ${prefix}/lib/liblapack.dylib liblapack.a -o liblapack.dylib \
-           -lptf77blas -lgfortran -lptcblas -latlas -lgcc_s.1 -lSystem"
+    file delete ${destroot}/${prefix}/lib/libcblas.a
+    file delete ${destroot}/${prefix}/lib/libf77blas.a
+  }
 
+  make_dylib liblapack { -lf77blas -lcblas -latlas -lgfortran -lgcc_s.1 -lSystem }
 }
 
-post-destroot {
-  # we make soft links to the parallel built libs
-  system "cd ${destroot}${prefix}/lib && \
-          ln -sf ./libptcblas.dylib libcblas.dylib && \
-          ln -sf ./libptf77blas.dylib libf77blas.dylib"
-}
-
 livecheck.name      math-atlas
 livecheck.distname  Stable

Modified: trunk/dports/math/atlas/files/patch-build-Make.top.diff
===================================================================
--- trunk/dports/math/atlas/files/patch-build-Make.top.diff	2010-03-09 14:54:03 UTC (rev 64566)
+++ trunk/dports/math/atlas/files/patch-build-Make.top.diff	2010-03-09 15:14:13 UTC (rev 64567)
@@ -1,24 +0,0 @@
---- Make.top.old	2009-01-24 15:06:37.000000000 -0800
-+++ Make.top	2009-01-24 15:08:49.000000000 -0800
-@@ -289,14 +289,11 @@
- 	cp $(INCAdir)/* $(INSTdir)/atlas/.
- 	- chmod 0644 $(INSTdir)/atlas/*
- install_lib:
--	cp $(LIBdir)/libatlas.a $(INSTdir)/.
--	cp $(LIBdir)/libcblas.a $(INSTdir)/.
--	cp $(LIBdir)/liblapack.a $(INSTdir)/.
--	chmod 0644 $(INSTdir)/libatlas.a  $(INSTdir)/liblapack.a \
--                   $(INSTdir)/libcblas.a 
--	- cp $(LIBdir)/libf77blas.a $(INSTdir)/.
--	- chmod 0644 $(INSTdir)/libf77blas.a
--	- cp $(LIBdir)/libptcblas.a $(INSTdir)/.
--	- cp $(LIBdir)/libptf77blas.a $(INSTdir)/.
--	- chmod 0644 $(INSTdir)/libptcblas.a $(INSTdir)/libptf77blas.a
-+	cp $(LIBdir)/libatlas.dylib $(INSTdir)/.
-+	cp $(LIBdir)/libptcblas.dylib $(INSTdir)/.
-+	cp $(LIBdir)/liblapack.dylib $(INSTdir)/.
-+	chmod 0644 $(INSTdir)/libatlas.dylib  $(INSTdir)/liblapack.dylib \
-+                   $(INSTdir)/libptcblas.dylib
-+	- cp $(LIBdir)/libptf77blas.dylib $(INSTdir)/.
-+	- chmod 0644 $(INSTdir)/libptf77blas.dylib
- 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100309/fe0435b7/attachment.html>


More information about the macports-changes mailing list