[Rinside-commits] r131 - in pkg: . R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Mar 20 21:42:47 CET 2010


Author: edd
Date: 2010-03-20 21:42:47 +0100 (Sat, 20 Mar 2010)
New Revision: 131

Modified:
   pkg/DESCRIPTION
   pkg/R/RInsidePaths.R
   pkg/inst/ChangeLog
Log:
 o in RInsidePaths, update -L and -I flag generators to the current versions
   of Rcpp (yes, by copy and paste as backward as that is) establishing
   static linking as the default on both Windoze and OS X (as for Rcpp)
 o lower Depends: back down to Rcpp (>= 0.7.10) as we want to release with 
   this one sooner rather than later after yet another round of Rcpp releases


Modified: pkg/DESCRIPTION
===================================================================
--- pkg/DESCRIPTION	2010-03-20 19:48:02 UTC (rev 130)
+++ pkg/DESCRIPTION	2010-03-20 20:42:47 UTC (rev 131)
@@ -15,7 +15,7 @@
  Several examples are provided in the examples/ directory of
  the installed package, and Doxygen-generated documentation of
  the C++ classes is included as well.
-Depends: R (>= 2.10.0), Rcpp (>= 0.7.10.3)
+Depends: R (>= 2.10.0), Rcpp (>= 0.7.10)
 SystemRequirements: None
 URL: http://dirk.eddelbuettel.com/code/rinside.html
 License: GPL (>= 2)

Modified: pkg/R/RInsidePaths.R
===================================================================
--- pkg/R/RInsidePaths.R	2010-03-20 19:48:02 UTC (rev 130)
+++ pkg/R/RInsidePaths.R	2010-03-20 20:42:47 UTC (rev 131)
@@ -1,24 +1,81 @@
 
+## Use R's internal knowledge of path settings to find the lib/ directory
+## plus optinally an arch-specific directory on system building multi-arch
+RInsideLdPath <- function() {
+    if (nzchar(.Platform$r_arch)) {     ## eg amd64, ia64, mips
+        system.file("lib",.Platform$r_arch,package="RInside")
+    } else {
+        system.file("lib",package="RInside")
+    }
+}
+
+## Provide linker flags -- i.e. -L/path/to/libRInside -- as well as an
+## optional rpath call needed to tell the Linux dynamic linker about the
+## location.  This is not needed on OS X where we encode this as library
+## built time (see src/Makevars) or Windows where we use a static library
+## Updated Jan 2010:  We now default to static linking but allow the use
+##                    of rpath on Linux if static==FALSE has been chosen
+##                    Note that this is probably being called from LdFlags()
+RInsideLdFlags <- function(static=TRUE) {
+    rinsidedir <- RInsideLdPath()
+    if (static) {                               # static is default on Windows and OS X
+        flags <- paste(rinsidedir, "/libRInside.a", sep="")
+        if (.Platform$OS.type=="windows") {
+            flags <- shQuote(flags)
+        }
+    } else {					# else for dynamic linking
+        flags <- paste("-L", rinsidedir, " -lRInside", sep="") # baseline setting
+        if ((.Platform$OS.type == "unix") &&    # on Linux, we can use rpath to encode path
+            (length(grep("^linux",R.version$os)))) {
+            flags <- paste(flags, " -Wl,-rpath,", rinsidedir, sep="")
+        }
+    }
+    invisible(flags)
+}
+
+
+## Provide compiler flags -- i.e. -I/path/to/RInside.h
+RInsideCxxFlags <- function() {
+    path <- RInsideLdPath()
+    if (.Platform$OS.type=="windows") {
+        path <- shQuote(path)
+    }
+    paste("-I", path, sep="")
+}
+
+## Shorter names, and call cat() directly
+CxxFlags <- function() {
+    cat(RInsideCxxFlags())
+}
+
+## LdFlags defaults to static linking on the non-Linux platforms Windows and OS X
+LdFlags <- function(static=ifelse(length(grep("^linux",R.version$os))==0, TRUE, FALSE)) {
+    cat(RInsideLdFlags(static=static))
+}
+
+
+
+
 # ## Use R's internal knowledge of path settings to find the lib/ directory
 # ## plus optinally an arch-specific directory on system building multi-arch
 # RInsideLdPath <- function() {
 #     Rcpp:::packageLibPath( package = "RInside" )
 # }
 
-## Provide linker flags -- i.e. -L/path/to/libRInside -- as well as an                           
+## Provide linker flags -- i.e. -L/path/to/libRInside -- as well as an
 ## optional rpath call needed to tell the Linux dynamic linker about the
 ## location.  This is not needed on OS X where we encode this as library
 ## built time (see src/Makevars) or Windows where we use a static library
-RInsideLdFlags <- function(static=Rcpp:::staticLinking()) {
-    Rcpp:::packageLdFlags( "RInside", static )
-}
+# RInsideLdFlags <- function(static=Rcpp:::staticLinking()) {
+#    Rcpp:::packageLdFlags( "RInside", static )
+# }
 
 ## Provide compiler flags -- i.e. -I/path/to/RInside.h
-RInsideCxxFlags <- function() {
-	Rcpp:::includeFlag( package = "RInside" )
-}
+# RInsideCxxFlags <- function() {
+#	Rcpp:::includeFlag( package = "RInside" )
+# }
 
 ## Shorter names, and call cat() directly
-CxxFlags <- function() cat(RInsideCxxFlags())
-LdFlags <- function(static=Rcpp:::staticLinking()) cat(RInsideLdFlags(static))
+# CxxFlags <- function() cat(RInsideCxxFlags())
+# LdFlags <- function(static=Rcpp:::staticLinking()) cat(RInsideLdFlags(static))
 

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-03-20 19:48:02 UTC (rev 130)
+++ pkg/inst/ChangeLog	2010-03-20 20:42:47 UTC (rev 131)
@@ -1,5 +1,9 @@
 2010-03-20  Dirk Eddelbuettel  <edd at debian.org>
 
+	* R/RInsidePaths.R: Updated to current version of Rcpp's file (minus
+	  the cxx0x bits) in order to standardize linking options, with this
+	  we now default to static linking on OS X and Windows as Rcpp does.
+
 	* src/RInside.cpp: Use explicit std::string() constructors for all
 	  text arguments inside throw() calls (to satisfy the Windows compiler)
 



More information about the Rinside-commits mailing list