--- /MacPorts/var/macports/sources/rsync.macports.org/release/ports/math/R/Portfile	2008-05-27 17:56:32.000000000 +0200
+++ Portfile	2008-06-26 18:41:23.000000000 +0200
@@ -3,11 +3,10 @@
 PortSystem 1.0
 
 name             R
-version          2.7.0
+version          2.7.1
 categories       math science
 maintainers      kjell.konis@epfl.ch
 platforms        darwin
-revision         1
 
 description      R is GNU S - an interpreted language for statistical computing
 
@@ -25,9 +24,9 @@
                  http://cran.hu.r-project.org/src/base/R-2/ \
                  http://cran.r-project.org/src/base/R-2/
 
-checksums        md5    9eaee3eceec1d5f72cea5640ca90768c \
-                 sha1   d0a3193e474696ad767845ef6b8ee1555a26b898 \
-                 rmd160 c3c9cf0c0a1eb6191492f1be19e277e8223a42c9
+checksums        md5    565b06a1f3f11020399934cc7b47a59d \
+                 sha1   cdf5f6f85463c7be007306add2f4ca7cf7babfb7 \
+                 rmd160 ac98e39d46ebc7581dd53da7f69a1e7abad269a4
 
 depends_lib      port:cairo \
                  port:expat \
@@ -48,18 +47,18 @@
                  port:zlib \
                  lib:libX11.6:XFree86
 
-variant gcc42 description {Build with gcc42 (default)} {
+variant gcc42 description {Build with gcc42} {
     configure.compiler macports-gcc-4.2
     depends_lib-append port:gcc42
 }
 
-variant gcc43 description {Build with gcc43} {
+variant gcc43 description {Build with gcc43 (default)} {
     configure.compiler macports-gcc-4.3
     depends_lib-append port:gcc43
 }
 
 if {![variant_isset gcc42] && ![variant_isset gcc43]} {
-    default_variants +gcc42
+    default_variants +gcc43
 }
 
 post-extract {
@@ -80,115 +79,21 @@
 destroot.destdir prefix=${destroot}${prefix}
 
 post-destroot {
-  reinplace "s|R_HOME_DIR=${destroot}|R_HOME_DIR=|" \
-    "${destroot}${prefix}/bin/R"
-  reinplace "s|R_HOME_DIR=${destroot}|R_HOME_DIR=|" \
-    "${destroot}${prefix}/lib/R/bin/R"
-  reinplace "s|R_SHARE_DIR=${destroot}|R_SHARE_DIR=|" \
-    "${destroot}${prefix}/bin/R"
-  reinplace "s|R_SHARE_DIR=${destroot}|R_SHARE_DIR=|" \
-    "${destroot}${prefix}/lib/R/bin/R"
-  reinplace "s|R_INCLUDE_DIR=${destroot}|R_INCLUDE_DIR=|" \
-    "${destroot}${prefix}/bin/R"
-  reinplace "s|R_INCLUDE_DIR=${destroot}|R_INCLUDE_DIR=|" \
-    "${destroot}${prefix}/lib/R/bin/R"
-  reinplace "s|R_DOC_DIR=${destroot}|R_DOC_DIR=|" \
-    "${destroot}${prefix}/bin/R"
-  reinplace "s|R_DOC_DIR=${destroot}|R_DOC_DIR=|" \
-    "${destroot}${prefix}/lib/R/bin/R"
+  foreach r { "/bin/R" "/lib/R/bin/R" } {
+    foreach dir { "R_HOME_DIR" "R_SHARE_DIR" "R_INCLUDE_DIR" "R_DOC_DIR" } {
+      reinplace "s|${dir}=${destroot}|${dir}=|" \
+        "${destroot}${prefix}${r}"
+    }
+  }
+
   system "install_name_tool -id ${prefix}/lib/R/lib/libR.dylib \
     ${destroot}${prefix}/lib/R/lib/libR.dylib"
-  system "install_name_tool -id ${prefix}/lib/R/modules/R_X11.so \
-    ${destroot}${prefix}/lib/R/modules/R_X11.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/modules/R_X11.so"
-  system "install_name_tool -id ${prefix}/lib/R/modules/internet.so \
-    ${destroot}${prefix}/lib/R/modules/internet.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/modules/internet.so"
-  system "install_name_tool -id ${prefix}/lib/R/modules/lapack.so \
-    ${destroot}${prefix}/lib/R/modules/lapack.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/modules/lapack.so"
-  system "install_name_tool -id ${prefix}/lib/R/modules/vfonts.so \
-    ${destroot}${prefix}/lib/R/modules/vfonts.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/modules/vfonts.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/tools/libs/tools.so \
-    ${destroot}${prefix}/lib/R/library/tools/libs/tools.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/tools/libs/tools.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/spatial/libs/spatial.so \
-    ${destroot}${prefix}/lib/R/library/spatial/libs/spatial.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/spatial/libs/spatial.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/class/libs/class.so \
-    ${destroot}${prefix}/lib/R/library/class/libs/class.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/class/libs/class.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/lattice/libs/lattice.so \
-    ${destroot}${prefix}/lib/R/library/lattice/libs/lattice.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/lattice/libs/lattice.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/tcltk/libs/tcltk.so \
-    ${destroot}${prefix}/lib/R/library/tcltk/libs/tcltk.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/tcltk/libs/tcltk.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/survival/libs/survival.so \
-    ${destroot}${prefix}/lib/R/library/survival/libs/survival.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/survival/libs/survival.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/stats/libs/stats.so \
-    ${destroot}${prefix}/lib/R/library/stats/libs/stats.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/stats/libs/stats.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/KernSmooth/libs/KernSmooth.so \
-    ${destroot}${prefix}/lib/R/library/KernSmooth/libs/KernSmooth.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/KernSmooth/libs/KernSmooth.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/mgcv/libs/mgcv.so \
-    ${destroot}${prefix}/lib/R/library/mgcv/libs/mgcv.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/mgcv/libs/mgcv.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/methods/libs/methods.so \
-    ${destroot}${prefix}/lib/R/library/methods/libs/methods.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/methods/libs/methods.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/nlme/libs/nlme.so \
-    ${destroot}${prefix}/lib/R/library/nlme/libs/nlme.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/nlme/libs/nlme.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/grDevices/libs/grDevices.so \
-    ${destroot}${prefix}/lib/R/library/grDevices/libs/grDevices.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/grDevices/libs/grDevices.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/foreign/libs/foreign.so \
-    ${destroot}${prefix}/lib/R/library/foreign/libs/foreign.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/foreign/libs/foreign.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/MASS/libs/MASS.so \
-    ${destroot}${prefix}/lib/R/library/MASS/libs/MASS.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/MASS/libs/MASS.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/nnet/libs/nnet.so \
-    ${destroot}${prefix}/lib/R/library/nnet/libs/nnet.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/nnet/libs/nnet.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/grid/libs/grid.so \
-    ${destroot}${prefix}/lib/R/library/grid/libs/grid.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/grid/libs/grid.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/rpart/libs/rpart.so \
-    ${destroot}${prefix}/lib/R/library/rpart/libs/rpart.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/rpart/libs/rpart.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/splines/libs/splines.so \
-    ${destroot}${prefix}/lib/R/library/splines/libs/splines.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/splines/libs/splines.so"
-  system "install_name_tool -id ${prefix}/lib/R/library/cluster/libs/cluster.so \
-    ${destroot}${prefix}/lib/R/library/cluster/libs/cluster.so"
-  system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib \
-    ${destroot}${prefix}/lib/R/library/cluster/libs/cluster.so"
+
+  foreach so [ exec find ${destroot}${prefix}/lib/R -name "\*.so" ] {
+    regsub ":$" ${so} "" destroot_so_path
+    regsub ${destroot} ${destroot_so_path} "" so_path
+    system "install_name_tool -id ${so_path} ${destroot_so_path}"
+    system "install_name_tool -change libR.dylib ${prefix}/lib/R/lib/libR.dylib ${destroot_so_path}"
+  }
 }
 
