From dcdae14bd1d427de98816292af120148c05846e4 Mon Sep 17 00:00:00 2001 From: Martin Wilke Date: Tue, 2 Feb 2010 16:04:22 +0000 Subject: [PATCH] - Make math/libRmath to a slave port of math/R - Add an option to build libR into a static, rather than a shared library (requested by a few users) PR: 143076 Submitted by: Pedro F. Giffuni "b. f." (maintainer) Approved by: maintainer --- math/R/Makefile | 54 ++++++++++++++-- .../patch-src__nmath__standalone__test.c | 11 ++++ math/R/pkg-plist | 7 ++- math/libRmath/Makefile | 63 ++----------------- math/libRmath/distinfo | 3 - math/libRmath/pkg-plist | 4 ++ 6 files changed, 73 insertions(+), 69 deletions(-) create mode 100644 math/R/files/patch-src__nmath__standalone__test.c delete mode 100644 math/libRmath/distinfo create mode 100644 math/libRmath/pkg-plist diff --git a/math/R/Makefile b/math/R/Makefile index 75a98a2ebc78..5f5ff8c069fe 100644 --- a/math/R/Makefile +++ b/math/R/Makefile @@ -6,8 +6,13 @@ # $FreeBSD$ # +.if defined(LIBRMATH_SLAVEPORT) +PORTNAME= libRmath +.else PORTNAME= R +.endif PORTVERSION= 2.10.1 +PORTREVISION= 2 CATEGORIES= math lang MASTER_SITES= http://cran.r-project.org/src/base/R-2/ \ ftp://cran.r-project.org/pub/R/src/base/R-2/ \ @@ -27,10 +32,16 @@ MASTER_SITES= http://cran.r-project.org/src/base/R-2/ \ http://probability.ca/cran/src/base/R-2/ \ http://www.ibiblio.org/pub/languages/R/CRAN/src/base/R-2/ \ http://www.bioconductor.org/CRAN/src/base/R-2/ +DISTNAME= R-${PORTVERSION} MAINTAINER= bf1783@gmail.com +.if defined(LIBRMATH_SLAVEPORT) +COMMENT= The standalone math library from R +.else COMMENT= A language for statistical computing and graphics +.endif +.if !defined(LIBRMATH_SLAVEPORT) OPTIONS= ATLAS "Use ATLAS instead of BLAS/LAPACK" off \ GHOSTSCRIPT "Enable the [dev2]bitmap() graphics devices" on \ ICU "Improve collation in multibyte locales with ICU" on \ @@ -39,6 +50,7 @@ OPTIONS= ATLAS "Use ATLAS instead of BLAS/LAPACK" off \ NLS "Build with NLS support" on \ PCRE_PORT "Use PCRE port instead of bundled source" on \ PNG "Enable the png() graphics device" on \ + STATIC_LIBR "Build a static, rather than a shared, libR" off \ TCLTK "Use Tcl/Tk (for the tcltk package)" on \ THREADS "Build a multithreaded R" on \ X11 "Enable the X11() graphics device" on \ @@ -47,22 +59,29 @@ OPTIONS= ATLAS "Use ATLAS instead of BLAS/LAPACK" off \ PDF_MANUALS "Install PDF manuals (requires TeX)" off MAN1= R.1 Rscript.1 - +.endif # !LIBRMATH_SLAVEPORT USE_LDCONFIG= yes USE_FORTRAN= yes - +MAKE_JOBS_UNSAFE= yes +GNU_CONFIGURE= yes +.if defined(LIBRMATH_SLAVEPORT) +BUILD_WRKSRC= ${WRKSRC}/src/nmath/standalone +CONFIGURE_ARGS+=--with-readline=no --with-x=no --disable-nls --with-tcltk=no --with-cairo=no \ + --with-libpng=no --with-jpeglib=no --with-iconv=no --with-ICU=no --without-libintl-prefix +USE_PERL5_BUILD= yes +.else # LIBRMATH_SLAVEPORT INSTALL_TARGET= install install-libR ALL_TARGET= all -GNU_CONFIGURE= yes USE_ICONV= yes USE_PERL5= yes CONFIGURE_ENV= INSTALL_DATA="${INSTALL} ${COPY} ${_SHROWNGRP} -m 644" \ FCFLAGS="${FFLAGS}" TAR="${TAR}" -CONFIGURE_ARGS= --enable-R-shlib --with-system-bzlib --with-system-zlib \ - rdocdir=${DOCSDIR} +CONFIGURE_ARGS= --with-system-bzlib --with-system-zlib rdocdir=${DOCSDIR} +.endif # LIBRMATH_SLAVEPORT .include +.if !defined(LIBRMATH_SLAVEPORT) .if defined(WITH_ATLAS) LIB_DEPENDS+= atlas.2:${PORTSDIR}/math/atlas CONFIGURE_ARGS+=--with-blas="-lf77blas -latlas" @@ -120,6 +139,14 @@ LIB_DEPENDS+= png.5:${PORTSDIR}/graphics/png CONFIGURE_ARGS+=--with-libpng .endif +.if defined(WITH_STATIC_LIBR) +CONFIGURE_ARGS+=--enable-R-static-lib +PLIST_SUB+= STATIC_LIBR="" SHARED_LIBR="@comment " +.else +CONFIGURE_ARGS+=--enable-R-shlib +PLIST_SUB+= STATIC_LIBR="@comment " SHARED_LIBR="" +.endif + .if defined(WITHOUT_TCLTK) CONFIGURE_ARGS+=--without-tcltk PLIST_SUB+= TCLTK="@comment " @@ -170,6 +197,7 @@ INSTALL_TARGET+= install-pdf .else PLIST_SUB+= PDF_MANUAL="@comment " .endif +.endif # !LIBRMATH_SLAVEPORT post-patch: @${REINPLACE_CMD} -e 's|(libdir)/pkgconfig|(prefix)/libdata/pkgconfig|g' \ @@ -183,6 +211,7 @@ post-patch: ${WRKSRC}/config.site \ ${WRKSRC}/src/extra/tzone/tzfile.h \ ${WRKSRC}/src/scripts/javareconf +.if !defined(LIBRMATH_SLAVEPORT) .if defined(WITHOUT_NLS) @(cd ${WRKSRC}/src/library/Recommended; \ for tarfile in *.tgz *.tar.gz ; do \ @@ -198,8 +227,10 @@ check-all: build @(cd ${WRKSRC}; ${MAKE} check-all) post-install: +.if !defined(WITH_STATIC_LIBR) ${MV} ${PREFIX}/lib/libR.so ${PREFIX}/lib/libR.so.0 ${LN} -sf ${PREFIX}/lib/libR.so.0 ${PREFIX}/lib/libR.so +.endif .if defined(WITH_INFO_MANUALS) && !defined(NOPORTDOCS) @(cd ${WRKSRC}/doc/manual; \ for infofile in ${INFO}; do \ @@ -207,4 +238,17 @@ post-install: done) .endif +.else # !LIBRMATH_SLAVEPORT +do-install: + ${INSTALL_DATA} ${WRKSRC}/src/include/Rmath.h ${PREFIX}/include + ${INSTALL_DATA} ${BUILD_WRKSRC}/libRmath.a ${PREFIX}/lib + ${INSTALL_DATA} ${BUILD_WRKSRC}/libRmath.so ${PREFIX}/lib/libRmath.so.0 + (cd ${PREFIX}/lib; ${LN} -sf libRmath.so.0 libRmath.so) + +test: install + @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \ + ${MAKE_ARGS} test && ${BUILD_WRKSRC}/test) + +.endif # !LIBRMATH_SLAVEPORT + .include diff --git a/math/R/files/patch-src__nmath__standalone__test.c b/math/R/files/patch-src__nmath__standalone__test.c new file mode 100644 index 000000000000..c79bceebed0a --- /dev/null +++ b/math/R/files/patch-src__nmath__standalone__test.c @@ -0,0 +1,11 @@ +--- src/nmath/standalone/test.c.orig 2009-06-22 18:12:00.000000000 -0400 ++++ src/nmath/standalone/test.c 2009-06-22 18:12:34.000000000 -0400 +@@ -38,7 +38,7 @@ + qnorm(0.7, 0.0, 1.0, 0, 0); + printf("*** loaded '%s'\n", argv[0]); + set_seed(123, 456); +- N01_kind = AHRENS_DIETER; ++ N01type N01_kind = AHRENS_DIETER; + printf("one normal %f\n", norm_rand()); + set_seed(123, 456); + N01_kind = BOX_MULLER; diff --git a/math/R/pkg-plist b/math/R/pkg-plist index 3cfc9320042b..e7a9cdbfc905 100644 --- a/math/R/pkg-plist +++ b/math/R/pkg-plist @@ -99,7 +99,8 @@ lib/R/include/Rinternals.h lib/R/include/Rmath.h lib/R/include/Rversion.h lib/R/include/S.h -lib/R/lib/libR.so +%%STATIC_LIBR%%lib/R/lib/libR.a +%%SHARED_LIBR%%lib/R/lib/libR.so lib/R/library/KernSmooth/DESCRIPTION lib/R/library/KernSmooth/INDEX lib/R/library/KernSmooth/LICENCE @@ -1201,8 +1202,8 @@ lib/R/share/texmf/ts1aer.fd lib/R/share/texmf/ts1aett.fd lib/R/share/texmf/upquote.sty libdata/pkgconfig/libR.pc -lib/libR.so -lib/libR.so.0 +%%SHARED_LIBR%%lib/libR.so +%%SHARED_LIBR%%lib/libR.so.0 %%PORTDOCS%%%%DVI_MANUAL%%%%DOCSDIR%%/manual/R-FAQ.dvi %%DOCSDIR%%/manual/R-FAQ.html %%PORTDOCS%%%%PDF_MANUAL%%%%DOCSDIR%%/manual/R-FAQ.pdf diff --git a/math/libRmath/Makefile b/math/libRmath/Makefile index d42d2d3eaf21..96ffe6f2fef7 100644 --- a/math/libRmath/Makefile +++ b/math/libRmath/Makefile @@ -6,62 +6,9 @@ # $FreeBSD$ # -PORTNAME= libRmath -PORTVERSION= 2.9.1 -PORTREVISION= 1 -CATEGORIES= math -MASTER_SITES= http://cran.r-project.org/src/base/R-2/ \ - ftp://cran.r-project.org/pub/R/src/base/R-2/ \ - http://cran.at.r-project.org/src/base/R-2/ \ - http://cran.au.r-project.org/src/base/R-2/ \ - http://cran.br.r-project.org/src/base/R-2/ \ - http://cran.ch.r-project.org/src/base/R-2/ \ - http://cran.es.r-project.org/src/base/R-2/ \ - http://cran.dk.r-project.org/src/base/R-2/ \ - http://cran.hu.r-project.org/src/base/R-2/ \ - http://cran.uk.r-project.org/src/base/R-2/ \ - http://cran.us.r-project.org/src/base/R-2/ \ - http://cran.za.r-project.org/src/base/R-2/ \ - ftp://ftp.u-aizu.ac.jp/pub/lang/R/CRAN/src/base/R-2/ \ - http://lib.stat.cmu.edu/R/CRAN/src/base/R-2/ \ - http://cran.stat.ucla.edu/src/base/R-2/ \ - http://probability.ca/cran/src/base/R-2/ \ - http://www.ibiblio.org/pub/languages/R/CRAN/src/base/R-2/ \ - http://www.bioconductor.org/CRAN/src/base/R-2/ -DISTNAME= R-${PORTVERSION} +DESCR= ${.CURDIR}/pkg-descr +LIBRMATH_SLAVEPORT= yes +MASTERDIR= ${.CURDIR}/../R +PLIST= ${.CURDIR}/pkg-plist -MAINTAINER= bf1783@gmail.com -COMMENT= The standalone math library from R - -USE_PERL5_BUILD= yes -USE_FORTRAN= yes -GNU_CONFIGURE= yes -USE_LDCONFIG= yes -CONFIGURE_ARGS+=--with-readline=no --with-x=no --disable-mbcs --disable-nls --with-tcltk=no --with-cairo=no \ - --with-libpng=no --with-jpeglib=no --with-iconv=no --with-ICU=no --without-libintl-prefix -BUILD_WRKSRC= ${WRKSRC}/src/nmath/standalone -MAKE_JOBS_UNSAFE= yes - -PLIST_FILES= include/Rmath.h lib/libRmath.a lib/libRmath.so lib/libRmath.so.0 - -post-patch: - @${REINPLACE_CMD} -e 's|(libdir)/pkgconfig|(prefix)/libdata/pkgconfig|g' \ - ${WRKSRC}/src/nmath/standalone/Makefile.in - @${REINPLACE_CMD} -e "s|-lpthread|${PTHREAD_LIBS}|g" \ - ${WRKSRC}/configure - @${REINPLACE_CMD} -e "s|/usr/local|${LOCALBASE}|g" \ - ${WRKSRC}/configure \ - ${WRKSRC}/config.site - -do-install: - ${INSTALL_DATA} ${WRKSRC}/src/include/Rmath.h ${PREFIX}/include - ${INSTALL_DATA} ${BUILD_WRKSRC}/libRmath.a ${PREFIX}/lib - ${INSTALL_DATA} ${BUILD_WRKSRC}/libRmath.so \ - ${PREFIX}/lib/libRmath.so.0 - (cd ${PREFIX}/lib; ${LN} -sf libRmath.so.0 libRmath.so) - -test: install - @(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} ${MAKE} ${_MAKE_JOBS} \ - ${MAKE_ARGS} test && ${BUILD_WRKSRC}/test) - -.include +.include "${MASTERDIR}/Makefile" diff --git a/math/libRmath/distinfo b/math/libRmath/distinfo deleted file mode 100644 index ea725b670e38..000000000000 --- a/math/libRmath/distinfo +++ /dev/null @@ -1,3 +0,0 @@ -MD5 (R-2.9.1.tar.gz) = 54a79eebdf0cec3fd2c489fc94d99b00 -SHA256 (R-2.9.1.tar.gz) = ef981c88b1632bef3359bc3755eed7f7eb38b2fca37e0443e64eb95162d3985a -SIZE (R-2.9.1.tar.gz) = 18620921 diff --git a/math/libRmath/pkg-plist b/math/libRmath/pkg-plist new file mode 100644 index 000000000000..38c6b173fd71 --- /dev/null +++ b/math/libRmath/pkg-plist @@ -0,0 +1,4 @@ +include/Rmath.h +lib/libRmath.a +lib/libRmath.so +lib/libRmath.so.0