summaryrefslogtreecommitdiff
path: root/math/rpy
diff options
context:
space:
mode:
authorBrendan Fabeny <bf@FreeBSD.org>2013-05-28 15:15:05 +0000
committerBrendan Fabeny <bf@FreeBSD.org>2013-05-28 15:15:05 +0000
commite80e13199698384004812ef82084507a63c6db49 (patch)
tree415589d9c68c0b0770aa00cfd4495ce30df83a29 /math/rpy
parente84a004d0c124695b02bb3d3ffe2b62c2bbc29f8 (diff)
Notes
Diffstat (limited to 'math/rpy')
-rw-r--r--math/rpy/Makefile4
-rw-r--r--math/rpy/files/patch-rpy.py12
-rw-r--r--math/rpy/files/patch-rpy_tools.py32
-rw-r--r--math/rpy/files/patch-setup.py61
-rw-r--r--math/rpy/files/patch-src-RPy.h22
-rw-r--r--math/rpy/files/patch-src-io.c13
-rw-r--r--math/rpy/files/patch-src-rpymodule.c13
-rw-r--r--math/rpy/pkg-plist2
8 files changed, 141 insertions, 18 deletions
diff --git a/math/rpy/Makefile b/math/rpy/Makefile
index 2fb09b182c96..4f39edb33555 100644
--- a/math/rpy/Makefile
+++ b/math/rpy/Makefile
@@ -3,7 +3,7 @@
PORTNAME= rpy
PORTVERSION= 1.0.3
-PORTREVISION= 27
+PORTREVISION= 28
CATEGORIES= math
MASTER_SITES= SF
@@ -24,7 +24,7 @@ LDFLAGS+= -L${LOCALBASE}/lib/R/modules -L${LOCALBASE}/lib/R/lib
post-patch:
@${REINPLACE_CMD} -e 's,^statichere ,,' ${WRKSRC}/src/rpymodule.c
- @${REINPLACE_CMD} -e 's|%%LOCALBASE%%|${LOCALBASE}|g' ${WRKSRC}/setup.py
+ @${REINPLACE_CMD} -e 's|/usr/share|${LOCALBASE}/lib|' ${WRKSRC}/setup.py
pre-configure:
@(if [ ! -e ${LOCALBASE}/lib/R/lib/libR.so ] ; then \
diff --git a/math/rpy/files/patch-rpy.py b/math/rpy/files/patch-rpy.py
new file mode 100644
index 000000000000..32d3b25f1b8a
--- /dev/null
+++ b/math/rpy/files/patch-rpy.py
@@ -0,0 +1,12 @@
+--- rpy.py
++++ rpy.py
+@@ -139,6 +139,7 @@ if VERBOSE:
+
+ # Version
+ from rpy_version import rpy_version
++__version__ = rpy_version
+
+ # Symbolic names for conversion modes
+ TOP_CONVERSION = 4
+diff --git rpy_tools.py rpy_tools.py
+index f312201..6e83321 100644
diff --git a/math/rpy/files/patch-rpy_tools.py b/math/rpy/files/patch-rpy_tools.py
index 09f166003c77..3371df201690 100644
--- a/math/rpy/files/patch-rpy_tools.py
+++ b/math/rpy/files/patch-rpy_tools.py
@@ -1,13 +1,35 @@
---- rpy_tools.py.orig 2009-12-29 09:42:02.000000000 +0800
-+++ rpy_tools.py 2009-12-29 09:42:41.000000000 +0800
-@@ -97,8 +97,8 @@
+--- rpy_tools.py
++++ rpy_tools.py
+@@ -97,8 +97,7 @@ def get_R_VERSION(RHOME=None, force_exec=False):
if stat or len(output)<=0:
raise RuntimeError("Couldn't execute the R interpreter" +
" `%s'.\n" % rexec )
- # edd 05 Apr 2006 version = re.search("R +([0-9]\.[0-9]\.[0-9])", output)
- version = re.search(" +([0-9]\.[0-9]\.[0-9])", output)
-+ # edd 05 Apr 2006 version = re.search("R +([0-9]\.[0-9][0-9]\.[0-9])", output)
-+ version = re.search(" +([0-9]\.[0-9][0-9]\.[0-9])", output)
++ version = re.search(" +([0-9]+\.[0-9]+\.[0-9]+)", output)
if not version:
raise RuntimeError("Couldn't obtain version number from output\n"
"of `R --version'.\n")
+@@ -143,3 +142,20 @@ def get_PYTHON_DIR():
+ % PYTHON_DIR )
+
+ return PYTHON_DIR
++
++def get_R_LAPACK_LIB_FLAGS(RHOME=get_R_HOME()):
++ """
++ Determine the necessary link arguments for lapack
++ """
++ rexec = os.path.join(RHOME, 'bin', 'R')
++ stat, output = getstatusoutput('"%s" CMD config LAPACK_LIBS' % rexec )
++ if stat or len(output)<=0:
++ raise RuntimeError("Couldn't execute the R interpreter" +
++ " `%s'.\n" % rexec )
++
++ LAPACK_LIB_FLAGS = output.strip()
++ if not LAPACK_LIB_FLAGS:
++ raise RuntimeError("Couldn't obtain LAPACK_LIBS information from output\n"
++ "of `R CMD config LAPACK_LIBS'.\n")
++
++ return LAPACK_LIB_FLAGS
+diff --git setup.py setup.py
+index cf0fa2e..4a1f840 100644
diff --git a/math/rpy/files/patch-setup.py b/math/rpy/files/patch-setup.py
index 6cc97c1af08f..caeba282d087 100644
--- a/math/rpy/files/patch-setup.py
+++ b/math/rpy/files/patch-setup.py
@@ -1,13 +1,60 @@
---- setup.py.orig 2008-07-29 22:53:21.000000000 +0200
-+++ setup.py 2008-07-29 22:54:04.000000000 +0200
-@@ -159,8 +159,8 @@
- source_files = source_files + ["src/setenv.c"]
+--- setup.py
++++ setup.py
+@@ -30,13 +30,14 @@ can be used for each of these R versions.
+ See the files INSTALL.UNIX and INSTALL.WINDOWS for more details.
+ """
+
+-DEBUG=True
++DEBUG=False
+
+ import os, os.path, sys, shutil, re
+ from distutils.core import setup, Extension
+ from distutils.sysconfig import *
+ from distutils.errors import *
+ import rpy_tools
++
+ if sys.platform=="win32":
+ import rpy_wintools
+
+@@ -85,7 +86,7 @@ for RHOME in RHOMES:
+ get_config_vars()['OPT'] = '-g -Wall'
+ else:
+ # to avoid strict prototypes errors from R includes
+- get_config_vars()['OPT'] = '-DNDEBUG -g -O3 -Wall'
++ get_config_vars()['OPT'] = '-DNDEBUG -O3 -Wall'
+
+ # get the Python version
+ if sys.version[:3] >= '2.2':
+@@ -149,22 +150,21 @@ for RHOME in RHOMES:
+ library_dirs= r_libs
+ runtime_libs = r_libs
+ extra_compile_args=[]
+- elif sys.platform=='osf1V5':
+- include_dirs = [ os.path.join(RHOME.strip(), 'include'),
+- 'src' ]
+- libraries=['R','Rlapack']
+- library_dirs = r_libs
+- runtime_libs = r_libs
+- extra_compile_args=["-shared"]
+- source_files = source_files + ["src/setenv.c"]
++
else: # unix-like systems, this is known to work for Linux and Solaris
include_dirs = [ os.path.join(RHOME.strip(), 'include'),
-- 'src', '/usr/share/R/include' ]
+ 'src', '/usr/share/R/include' ]
- libraries=['R','Rlapack']
-+ 'src', '%%LOCALBASE%%/lib/R/include' ]
-+ libraries=['R','R']
++
library_dirs = r_libs
runtime_libs = r_libs
extra_compile_args=["-shared"]
+ source_files = source_files + ["src/setenv.c"]
++
++ libraries=['R']
++
++ # Ask R to tell us how to properly link against lapack
++ extra_compile_args += [ rpy_tools.get_R_LAPACK_LIB_FLAGS( RHOME ) ]
++
+
+ # Discover which array packages are present
+ try:
+diff --git src/RPy.h src/RPy.h
+index 04faf3d..614ae5a 100644
diff --git a/math/rpy/files/patch-src-RPy.h b/math/rpy/files/patch-src-RPy.h
index 333d43f91776..a795ee3d31c1 100644
--- a/math/rpy/files/patch-src-RPy.h
+++ b/math/rpy/files/patch-src-RPy.h
@@ -1,6 +1,20 @@
---- src/RPy.h.orig 2008-12-17 16:53:19.000000000 +0800
-+++ src/RPy.h 2008-12-17 16:53:35.000000000 +0800
-@@ -74,7 +74,7 @@
+--- src/RPy.h
++++ src/RPy.h
+@@ -52,6 +52,13 @@
+ #include <Rdefines.h>
+ #include <Rinternals.h>
+ #include <Rversion.h>
++
++#if (R_VERSION >= R_Version(2,4,0))
++#include <Rembedded.h>
++#endif
++
++
++
+ #undef _POSIX_C_SOURCE
+ #include <Python.h>
+ #include <R_ext/Rdynload.h>
+@@ -74,7 +81,7 @@
# endif
#endif /* _WIN32 */
@@ -9,3 +23,5 @@
/* Missing definitions from Rinterface.h or RStartup.h */
+diff --git src/io.c src/io.c
+index 6c7c31d..cb10259 100644
diff --git a/math/rpy/files/patch-src-io.c b/math/rpy/files/patch-src-io.c
new file mode 100644
index 000000000000..dc09967eb6a3
--- /dev/null
+++ b/math/rpy/files/patch-src-io.c
@@ -0,0 +1,13 @@
+--- src/io.c
++++ src/io.c
+@@ -130,7 +130,7 @@ RPy_ReadConsole(char *prompt,
+ PyErr_Clear();
+ return 0;
+ }
+- snprintf(buf, len, "%s", PyString_AsString(input_data));
++ snprintf( (char*) buf, len, "%s", PyString_AsString(input_data));
+ Py_DECREF(input_data);
+ return 1;
+ }
+diff --git src/rpymodule.c src/rpymodule.c
+index fe8b39f..fda1881 100644
diff --git a/math/rpy/files/patch-src-rpymodule.c b/math/rpy/files/patch-src-rpymodule.c
new file mode 100644
index 000000000000..09f47bfb3271
--- /dev/null
+++ b/math/rpy/files/patch-src-rpymodule.c
@@ -0,0 +1,13 @@
+--- src/rpymodule.c
++++ src/rpymodule.c
+@@ -1772,8 +1772,10 @@ start_events(void)
+
+ void r_finalize(void)
+ {
++#if (R_VERSION < R_Version(2,4,0))
+ unsigned char buf[1024];
+ char * tmpdir;
++#endif
+
+ R_dot_Last();
+ R_RunExitFinalizers();
diff --git a/math/rpy/pkg-plist b/math/rpy/pkg-plist
index 2e3ef74a3e8e..f3524efa7caf 100644
--- a/math/rpy/pkg-plist
+++ b/math/rpy/pkg-plist
@@ -1,4 +1,4 @@
-%%PYTHON_SITELIBDIR%%/_rpy2153.so
+%%PYTHON_SITELIBDIR%%/_rpy3001.so
%%PYTHON_SITELIBDIR%%/rpy.py
%%PYTHON_SITELIBDIR%%/rpy.pyc
%%PYTHON_SITELIBDIR%%/rpy.pyo