This diff builds the R libraries (and also executables, but that is not important) with RPATH in the ELF header. The libraries are installed in /usr/local/lib/R/lib, which isn't in the default ld.so path. libR links to libRblas in that directory. The result of this is that if anything wants to link to libR, it must modify the ld.so search path. You can't just have the library that wants to link to libR use RPATH, since libR links to libRblas.
By setting RPATH for libR and the other R shared libraries, you can then link other libraries to them using RPATH without modifying the ld.so search path. This is especially helpful if the library you want to link to libR is a plugin for another program which is loaded via dlopen. Tested on i386, also compiles on amd64. Thoughts/OKs? Jeremy Index: Makefile =================================================================== RCS file: /cvs/ports/math/R/Makefile,v retrieving revision 1.51 diff -u -p -r1.51 Makefile --- Makefile 21 Sep 2012 08:10:44 -0000 1.51 +++ Makefile 9 Oct 2012 20:27:13 -0000 @@ -4,7 +4,7 @@ SHARED_ONLY= Yes COMMENT= powerful math/statistics/graphics language DISTNAME= R-2.15.1 -REVISION= 3 +REVISION= 4 SHARED_LIBS= R 0.0 \ Rlapack 30.0 \ @@ -84,6 +84,7 @@ CONFIGURE_ARGS= ${CONFIGURE_SHARED} \ --with-tk-config=${MODTK_CONFIG} CONFIGURE_ENV= FFLAGS="${FFLAGS}" \ + LDFLAGS="-L${PREFIX}/lib -Wl,-R${PREFIX}/lib/R/lib" \ ac_cv_path_TAR="${LOCALBASE}/bin/gtar" MAKE_FLAGS= INSTALL_DATA='install -c -m 644' \