--- /MacPorts/var/macports/sources/rsync.macports.org/release/tarballs/ports/math/R-framework/Portfile	2012-10-02 20:31:19.000000000 -0700
+++ Portfile	2012-10-26 09:17:08.000000000 -0700
@@ -1,15 +1,14 @@
-# $Id: Portfile 98344 2012-10-03 03:05:15Z ryandesign@macports.org $
+# $Id: Portfile 98006 2012-09-21 21:18:53Z adfernandes@macports.org $
 
 PortSystem 1.0
 
 set major 2
 set minor 15
-set point 1
+set point 2
 
 name                        R-framework
 conflicts                   R
 version                     ${major}.${minor}.${point}
-revision                    4
 categories                  math science
 maintainers                 me.com:kjell.konis
 license                     {GPL-2 GPL-3}
@@ -35,8 +34,8 @@
 distname                    R-${version}
 dist_subdir                 R
 
-checksums                   rmd160  84a010906424f3e84b84a71236424a8f2bf1df08 \
-                            sha256  96e4baea9dc7653b9160d7f2e1d321d0f252fee37ceb4273d4c94f0d4d815485
+checksums                   rmd160  ca20ed9d794df53906802eee2ca32e634f8e8708 \
+                            sha256  292837ae259b7668509b8a5d4ec8be0aa50c327cfe7a534bac419b4ca766d66d
 
 depends_build               port:pkgconfig
 
@@ -60,8 +59,6 @@
                             --enable-R-shlib \
                             --enable-BLAS-shlib \
                             --enable-openmp \
-                            --with-blas="-framework vecLib" \
-                            --with-lapack="-framework vecLib" \
                             --with-readline \
                             --with-aqua \
                             --without-tcltk \
@@ -84,7 +81,21 @@
     configure.args-append   --with-cairo
 }
 
-variant debug description {Build with debug symbols} {
+variant accelerate conflicts atlas builtin_lapack description {build using the BLAS and Lapack in Apple's Accelerate framework} {
+    configure.args-append   --with-blas="-framework vecLib" \
+                            --with-lapack="-framework vecLib"
+}
+
+variant atlas conflicts accelerate builtin_lapack description {build using the BLAS and Lapack provided by the atlas port} {
+    #more in post-destroot phase
+    configure.args-append   --without-blas --without-lapack
+}
+
+variant builtin_lapack conflicts accelerate atlas description {build using reference BLAS and Lapack} {
+    configure.args-append   --without-blas --without-lapack
+}
+
+variant debug description {build with debug symbols} {
     configure.optflags-append -g
 }
 
@@ -150,6 +161,10 @@
 
 default_variants +cairo +recommended +tcltk +x11
 
+if {![variant_isset accelerate] && ![variant_isset atlas] && ![variant_isset builtin_lapack]} {
+    default_variants-append +accelerate
+}
+
 if {![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc47] && ![variant_isset llvm_gcc42]} {
     default_variants-append +llvm_gcc42
 }
@@ -204,8 +219,18 @@
         ${destroot}${resources}/bin/exec/${build_arch}/R"
 
     ln -s ${build_arch}/libR.dylib ${destroot}${resources}/lib/libR.dylib
-    ln -s ${build_arch}/libRblas.dylib ${destroot}${resources}/lib/libRblas.dylib
-    ln -s ${build_arch}/libRlapack.dylib ${destroot}${resources}/lib/libRlapack.dylib
+
+    if {[variant_isset atlas]} {
+        file delete ${destroot}${resources}/lib/${build_arch}/libRblas.dylib
+        file delete ${destroot}${resources}/lib/${build_arch}/libRlapack.dylib
+        ln -s ${prefix}/lib/libtatlas.dylib ${destroot}${resources}/lib/${build_arch}/libRblas.dylib
+        ln -s ${prefix}/lib/libtatlas.dylib ${destroot}${resources}/lib/${build_arch}/libRlapack.dylib
+        ln -s ${prefix}/lib/libtatlas.dylib ${destroot}${resources}/lib/libRblas.dylib
+        ln -s ${prefix}/lib/libtatlas.dylib ${destroot}${resources}/lib/libRlapack.dylib
+    } else {
+        ln -s ${build_arch}/libRblas.dylib ${destroot}${resources}/lib/libRblas.dylib
+        ln -s ${build_arch}/libRlapack.dylib ${destroot}${resources}/lib/libRlapack.dylib
+    }
 
     ln -s ${resources}/bin/R ${destroot}${prefix}/bin/R
     ln -s ${resources}/bin/Rscript ${destroot}${prefix}/bin/Rscript
@@ -217,21 +242,3 @@
 
 
 
-# Hopefully can get rid of this soon
-
-platform darwin 12 {
-    configure.args-delete --with-blas="-framework vecLib" --with-lapack="-framework vecLib"
-    configure.args-append --without-blas --without-lapack
-    pre-configure {
-        ui_msg "Temporary Mountain Lion issue: using builtin lapack"
-    }
-}
-
-if {[variant_isset gcc45] || [variant_isset gcc46]} {
-    if {${os.platform} == "darwin" && ${os.major} == 12} {
-        ui_error "This version of the R-framework port does not compile with gcc45 or gcc46 on Mountain Lion"
-        return -code error "incompatible variant"
-    }
-}
-
-
