[52257] trunk/dports/math/atlas

jameskyle at macports.org jameskyle at macports.org
Fri Jun 12 22:10:02 PDT 2009


Revision: 52257
          http://trac.macports.org/changeset/52257
Author:   jameskyle at macports.org
Date:     2009-06-12 22:10:01 -0700 (Fri, 12 Jun 2009)
Log Message:
-----------
Upgrades atlas to 3.8.3
Added shared libraries (dylib's)
Compiles 32 bit libraries for macports compatibility
Upgrades lapack to 3.2.1
Proper platform specific optimized build as specified by the math-atlas project
Fixes misidentification of processor type on intel Core2 processors

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

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

Modified: trunk/dports/math/atlas/Portfile
===================================================================
--- trunk/dports/math/atlas/Portfile	2009-06-13 04:53:11 UTC (rev 52256)
+++ trunk/dports/math/atlas/Portfile	2009-06-13 05:10:01 UTC (rev 52257)
@@ -1,42 +1,80 @@
 # $Id$
 
-PortSystem         1.0
+PortSystem          1.0
 
-categories         math
-name               atlas
-version            3.8.2
+categories          math
+name                atlas
+version             3.8.3
 
 # additional versions
-set lapackversion  3.1.1
-set lapackname     lapack
-set atlasdist      ${name}${version}.tar.bz2
-set lapackdist     ${lapackname}-${lapackversion}.tgz
+set lapackversion   3.2.1
+set lapackname      lapack
+set atlasdist       ${name}${version}.tar.bz2
+set lapackdist      ${lapackname}.tgz
 
-maintainers        cornell.edu:ajb78
-platforms          darwin
+maintainers         cornell.edu:ajb78
+platforms           darwin
 
-description        Portable optimal linear algebra software
-long_description   The current version provides a complete BLAS and LAPACK API.\
-                   For many operations, ATLAS achieves performance on par with\
-                   machine-specific tuned libraries.
+description         Portable optimal linear algebra software
+long_description    The current version provides a complete BLAS and LAPACK API.\
+                    For many operations, ATLAS achieves performance on par with\
+                    machine-specific tuned libraries.
 
-homepage           http://math-atlas.sourceforge.net/
+homepage            http://math-atlas.sourceforge.net/
 
-master_sites       sourceforge:math-atlas/${name}${version}.tar.bz2:atlas\
-                   http://www.netlib.org/lapack:lapack
+master_sites        sourceforge:math-atlas/${name}${version}.tar.bz2:atlas \
+                    http://www.netlib.org/lapack:lapack
 
-distfiles          ${atlasdist}:atlas \
-                   ${lapackdist}:lapack
+distfiles           ${atlasdist}:atlas \
+                    ${lapackdist}:lapack
 
-checksums          ${atlasdist} \
-                   md5 dd888f5d066c1fafeaaf2ae6b37e0b85 \
-                   sha1 2d1f2f789f57c9e7e8957f275b67c33176a36e0c \
-                   rmd160 8160ccb3af7cd7365ba87c77d636fb68b24c62ae \
-                   ${lapackdist} \
-                   md5 00b21551a899bcfbaa7b8443e1faeef9 \
-                   sha1 be1a3d53d761935703a7be88c3dd1164daa79554 \
-                   rmd160 ba864e7a2b759ba1337ea9a452e12a7ab5494cdc
+checksums           atlas3.8.3.tar.bz2 \
+                    md5     6c13be94a87178e7582111c08e9503bc \
+                    sha1    c7546210df4796457d9e96a00444adc4c0f2e77f \
+                    rmd160  0425e630d9d0c5b7aae81427a41b7eaa18447e90 \
+                    lapack.tgz \
+                    md5     a3202a4f9e2f15ffd05d15dab4ac7857 \
+                    sha1    c75223fdef3258c461370af5d2b889d580d7f38a \
+                    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.dir           ${workpath}/${name}-${version}/build
+
+destroot.dir        ${build.dir}
+destroot.destdir    DESTDIR=${destroot}${prefix}
+depends_lib         port:gcc43 \
+                    port:bzip2 \
+                    port:gzip
+
+# Set fortran compiler flags
+set myf77           ${prefix}/bin/gfortran-mp-4.3
+
+configure.args      -C xc ${prefix}/bin/gcc-mp-4.3 \
+                    -C gc ${prefix}/bin/gcc-mp-4.3 \
+                    -C if ${myf77} \
+                    -C ic ${prefix}/bin/gcc-mp-4.3 \
+                    -C dm ${prefix}/bin/gcc-mp-4.3 \
+                    -C sm ${prefix}/bin/gcc-mp-4.3 \
+                    -C dk ${prefix}/bin/gcc-mp-4.3 \
+                    -C sk ${prefix}/bin/gcc-mp-4.3 \
+                    --cc=${prefix}/bin/gcc-mp-4.3 \
+                    -b 32 \
+                    -Fa alg -fPIC 
+                    
+configure.compiler macports-gcc-4.3
+
+        
+
+# we are configuring from the build directory
+configure.dir       ${workpath}/${name}-${version}/build
+configure.cmd       ../configure
+
+# change the default compilers to those of gcc43 and make into shared library
+
 extract {
     # extract atlas and move to a consistent working directory name
     system "cd ${workpath} && bunzip2 -dc ${distpath}/${atlasdist} | \
@@ -48,51 +86,91 @@
          gnutar --no-same-owner -xf -"
 }
 
-# Set fortran compiler flags
-set myf77     ${prefix}/bin/gfortran-mp-4.3
-set myfflags  "-fomit-frame-pointer -O3"
 
+
 pre-configure {
+    # Get some system specific variables for maximum optimization
+    set cpufreq [expr {[exec sysctl -n hw.cpufrequency]/1000000}]
+    ui_debug "Setting CPU Frequency for: ${cpufreq}"
+    configure.args-append -D c -DPentiumCPS=${cpufreq}
+
+    # first do a 'fake configure' of atlas so we get optimized lapack libraries
+    ui_debug "performing fake configure of atlas for optimized lapack"
+    # atlas docs: 3.1.2
+    set atlas_path ${workpath}/${name}-${version}
+    file mkdir ${workpath}/${name}-${version}/temp
+    ui_debug "Assembled Command: '${configure.cmd} ${configure.args}"
+    system "cd ${atlas_path}/temp && \
+            ${configure.cmd} ${configure.args}"
+    
+    # Get the F77FLAGS 
+    set atlas_f77    [join [lrange [split [exec grep "F77 = " $atlas_path/temp/Make.inc     ] =] 1 end] =]
+    ui_debug "Found atlas F77: ${atlas_f77}"
+    
+    set atlas_fflags [join [lrange [split [exec grep "F77FLAGS = " $atlas_path/temp/Make.inc] =] 1 end] =]
+    ui_debug "Found atlas F77FLAGS: ${atlas_fflags}"
+    # Remove the old test configure directory
+    system "rm -rf ${atlas_path}/temp"
+    
     # compile lapack
     system "cd ${workpath}/${lapackname}-${lapackversion} && \
             cp INSTALL/make.inc.gfortran make.inc"
-    reinplace "s|gfortran|${myf77}|" \
+    reinplace "s|gfortran|${atlas_f77}|" \
            ${workpath}/${lapackname}-${lapackversion}/make.inc
-    reinplace "s|OPTS     = -O2|OPTS = ${myfflags}|" \
+    reinplace "s|OPTS     = -O2|OPTS = ${atlas_fflags}|" \
            ${workpath}/${lapackname}-${lapackversion}/make.inc
+    
+    reinplace "s|NOOPT    = -O0|NOOPT = -O2 -m32|" \
+           ${workpath}/${lapackname}-${lapackversion}/make.inc
+
     reinplace "s|PLAT = _LINUX|PLAT = _darwin|" \
            ${workpath}/${lapackname}-${lapackversion}/make.inc
+    
+    reinplace "s|LOADOPTS =|LOADOPTS = ${atlas_fflags}|" \
+           ${workpath}/${lapackname}-${lapackversion}/make.inc
+    
     system "cd ${workpath}/${lapackname}-${lapackversion} && make lib"
 
     # create a build directory for atlas
     file mkdir ${workpath}/${name}-${version}/build
-}
 
-# we are configuring from the build directory
-configure.dir   ${workpath}/${name}-${version}/build
-configure.cmd   ../configure
 
-# change the default compilers to those of gcc43 and make into shared library
-configure.args  --with-netlib-lapack=${workpath}/${lapackname}-${lapackversion}/lapack_darwin.a \
-                -C xc ${prefix}/bin/gcc-mp-4.3 \
-                -C gc ${prefix}/bin/gcc-mp-4.3 \
-                -C if ${myf77}\
-                -F if '${myfflags}'\
-                -C ic ${prefix}/bin/gcc-mp-4.3 \
-                -C dm ${prefix}/bin/gcc-mp-4.3 \
-                -C sm ${prefix}/bin/gcc-mp-4.3 \
-                -C dk ${prefix}/bin/gcc-mp-4.3 \
-                -C sk ${prefix}/bin/gcc-mp-4.3
+    configure.args-append --with-netlib-lapack=${workpath}/${lapackname}-${lapackversion}/lapack_darwin.a 
+}
 
 post-configure {
     # recursively remove directories
     reinplace "s|rm -f|rm -rf|g" ${workpath}/${name}-${version}/build/Makefile
+
+    # patch ${name}-${version}/build/Make.top to install dynamic libs
+    system "cd ${worksrcpath}/build/ && \
+            patch -p0 < ${filespath}/${make_patch}"
 }
 
-use_parallel_build  no
-build.target build
-build.dir    ${workpath}/${name}-${version}/build
+pre-destroot {
+  # We have to manually create the dylib shared libs as the default build does not do this
+  set ld "ld -dynamic -arch i386 -dylib -single_module -dead_strip -x \
+          -all_load -L. -L${prefix}/lib/gcc43 -ldylib1.o -dylib_install_name"
+  
+  system "cd ${workpath}/${name}-${version}/build/lib && \
+          ${ld} libatlas.dylib libatlas.a -o libatlas.dylib -lSystem"
+  
+  system "cd ${workpath}/${name}-${version}/build/lib && \
+          ${ld} libptcblas.dylib libptcblas.a -o libptcblas.dylib -latlas -lSystem"
+  
+  system "cd ${workpath}/${name}-${version}/build/lib && \
+          ${ld} libptf77blas.dylib libptf77blas.a -o libptf77blas.dylib -lgfortran \
+          -latlas -lSystem"
 
-destroot.dir ${build.dir}
-destroot.destdir DESTDIR=${destroot}${prefix}
-depends_lib  port:gcc43
+  system "cd ${workpath}/${name}-${version}/build/lib && \
+          ${ld} liblapack.dylib liblapack.a -o liblapack.dylib -lptf77blas \
+          -lgfortran -lptcblas -latlas -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"
+}

Added: trunk/dports/math/atlas/files/Portfile
===================================================================
--- trunk/dports/math/atlas/files/Portfile	                        (rev 0)
+++ trunk/dports/math/atlas/files/Portfile	2009-06-13 05:10:01 UTC (rev 52257)
@@ -0,0 +1,176 @@
+# $Id$
+
+PortSystem          1.0
+
+categories          math
+name                atlas
+version             3.8.3
+
+# additional versions
+set lapackversion   3.2.1
+set lapackname      lapack
+set atlasdist       ${name}${version}.tar.bz2
+set lapackdist      ${lapackname}.tgz
+
+maintainers         cornell.edu:ajb78
+platforms           darwin
+
+description         Portable optimal linear algebra software
+long_description    The current version provides a complete BLAS and LAPACK API.\
+                    For many operations, ATLAS achieves performance on par with\
+                    machine-specific tuned libraries.
+
+homepage            http://math-atlas.sourceforge.net/
+
+master_sites        sourceforge:math-atlas/${name}${version}.tar.bz2:atlas \
+                    http://www.netlib.org/lapack:lapack
+
+distfiles           ${atlasdist}:atlas \
+                    ${lapackdist}:lapack
+
+checksums           atlas3.8.3.tar.bz2 \
+                    md5     6c13be94a87178e7582111c08e9503bc \
+                    sha1    c7546210df4796457d9e96a00444adc4c0f2e77f \
+                    rmd160  0425e630d9d0c5b7aae81427a41b7eaa18447e90 \
+                    lapack.tgz \
+                    md5     a3202a4f9e2f15ffd05d15dab4ac7857 \
+                    sha1    c75223fdef3258c461370af5d2b889d580d7f38a \
+                    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.dir           ${workpath}/${name}-${version}/build
+
+destroot.dir        ${build.dir}
+destroot.destdir    DESTDIR=${destroot}${prefix}
+depends_lib         port:gcc43 \
+                    port:bzip2 \
+                    port:gzip
+
+# Set fortran compiler flags
+set myf77           ${prefix}/bin/gfortran-mp-4.3
+
+configure.args      -C xc ${prefix}/bin/gcc-mp-4.3 \
+                    -C gc ${prefix}/bin/gcc-mp-4.3 \
+                    -C if ${myf77} \
+                    -C ic ${prefix}/bin/gcc-mp-4.3 \
+                    -C dm ${prefix}/bin/gcc-mp-4.3 \
+                    -C sm ${prefix}/bin/gcc-mp-4.3 \
+                    -C dk ${prefix}/bin/gcc-mp-4.3 \
+                    -C sk ${prefix}/bin/gcc-mp-4.3 \
+                    --cc=${prefix}/bin/gcc-mp-4.3 \
+                    -b 32 \
+                    -Fa alg -fPIC 
+                    
+configure.compiler macports-gcc-4.3
+
+        
+
+# we are configuring from the build directory
+configure.dir       ${workpath}/${name}-${version}/build
+configure.cmd       ../configure
+
+# change the default compilers to those of gcc43 and make into shared library
+
+extract {
+    # extract atlas and move to a consistent working directory name
+    system "cd ${workpath} && bunzip2 -dc ${distpath}/${atlasdist} | \
+         gnutar --no-same-owner -xf -"
+    system "mv ${workpath}/ATLAS ${workpath}/${name}-${version}"
+
+    # extract lapack
+    system "cd ${workpath} && gunzip -dc ${distpath}/${lapackdist} | \
+         gnutar --no-same-owner -xf -"
+}
+
+
+
+pre-configure {
+    # Get some system specific variables for maximum optimization
+    set cpufreq [expr {[exec sysctl -n hw.cpufrequency]/1000000}]
+    ui_debug "Setting CPU Frequency for: ${cpufreq}"
+    configure.args-append -D c -DPentiumCPS=${cpufreq}
+
+    # first do a 'fake configure' of atlas so we get optimized lapack libraries
+    ui_debug "performing fake configure of atlas for optimized lapack"
+    # atlas docs: 3.1.2
+    set atlas_path ${workpath}/${name}-${version}
+    file mkdir ${workpath}/${name}-${version}/temp
+    ui_debug "Assembled Command: '${configure.cmd} ${configure.args}"
+    system "cd ${atlas_path}/temp && \
+            ${configure.cmd} ${configure.args}"
+    
+    # Get the F77FLAGS 
+    set atlas_f77    [join [lrange [split [exec grep "F77 = " $atlas_path/temp/Make.inc     ] =] 1 end] =]
+    ui_debug "Found atlas F77: ${atlas_f77}"
+    
+    set atlas_fflags [join [lrange [split [exec grep "F77FLAGS = " $atlas_path/temp/Make.inc] =] 1 end] =]
+    ui_debug "Found atlas F77FLAGS: ${atlas_fflags}"
+    # Remove the old test configure directory
+    system "rm -rf ${atlas_path}/temp"
+    
+    # compile lapack
+    system "cd ${workpath}/${lapackname}-${lapackversion} && \
+            cp INSTALL/make.inc.gfortran make.inc"
+    reinplace "s|gfortran|${atlas_f77}|" \
+           ${workpath}/${lapackname}-${lapackversion}/make.inc
+    reinplace "s|OPTS     = -O2|OPTS = ${atlas_fflags}|" \
+           ${workpath}/${lapackname}-${lapackversion}/make.inc
+    
+    reinplace "s|NOOPT    = -O0|NOOPT = -O2 -m32|" \
+           ${workpath}/${lapackname}-${lapackversion}/make.inc
+
+    reinplace "s|PLAT = _LINUX|PLAT = _darwin|" \
+           ${workpath}/${lapackname}-${lapackversion}/make.inc
+    
+    reinplace "s|LOADOPTS =|LOADOPTS = ${atlas_fflags}|" \
+           ${workpath}/${lapackname}-${lapackversion}/make.inc
+    
+    system "cd ${workpath}/${lapackname}-${lapackversion} && make lib"
+
+    # create a build directory for atlas
+    file mkdir ${workpath}/${name}-${version}/build
+
+
+    configure.args-append --with-netlib-lapack=${workpath}/${lapackname}-${lapackversion}/lapack_darwin.a 
+}
+
+post-configure {
+    # recursively remove directories
+    reinplace "s|rm -f|rm -rf|g" ${workpath}/${name}-${version}/build/Makefile
+
+    # patch ${name}-${version}/build/Make.top to install dynamic libs
+    system "cd ${worksrcpath}/build/ && \
+            patch -p0 < ${filespath}/${make_patch}"
+}
+
+pre-destroot {
+  # We have to manually create the dylib shared libs as the default build does not do this
+  set ld "ld -dynamic -arch i386 -dylib -single_module -dead_strip -x \
+          -all_load -L. -L${prefix}/lib/gcc43 -ldylib1.o -dylib_install_name"
+  
+  system "cd ${workpath}/${name}-${version}/build/lib && \
+          ${ld} libatlas.dylib libatlas.a -o libatlas.dylib -lSystem"
+  
+  system "cd ${workpath}/${name}-${version}/build/lib && \
+          ${ld} libptcblas.dylib libptcblas.a -o libptcblas.dylib -latlas -lSystem"
+  
+  system "cd ${workpath}/${name}-${version}/build/lib && \
+          ${ld} libptf77blas.dylib libptf77blas.a -o libptf77blas.dylib -lgfortran \
+          -latlas -lSystem"
+
+  system "cd ${workpath}/${name}-${version}/build/lib && \
+          ${ld} liblapack.dylib liblapack.a -o liblapack.dylib -lptf77blas \
+          -lgfortran -lptcblas -latlas -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"
+}


Property changes on: trunk/dports/math/atlas/files/Portfile
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Added: trunk/dports/math/atlas/files/patch-build-Make.top.diff
===================================================================
--- trunk/dports/math/atlas/files/patch-build-Make.top.diff	                        (rev 0)
+++ trunk/dports/math/atlas/files/patch-build-Make.top.diff	2009-06-13 05:10:01 UTC (rev 52257)
@@ -0,0 +1,24 @@
+--- 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/20090612/2c476d80/attachment-0001.html>


More information about the macports-changes mailing list