add support for using system tre on f21+, el7+

This commit is contained in:
Tom Callaway 2014-02-07 15:57:15 -05:00
parent 086df36f1c
commit 1a814660a9
2 changed files with 141 additions and 1 deletions

112
R-3.0.2-system-tre.patch Normal file
View File

@ -0,0 +1,112 @@
diff -up R-3.0.2/configure.ac.system-tre R-3.0.2/configure.ac
--- R-3.0.2/configure.ac.system-tre 2014-02-04 18:14:04.233778538 -0500
+++ R-3.0.2/configure.ac 2014-02-04 18:14:52.635733566 -0500
@@ -420,6 +420,10 @@ AC_ARG_WITH([system-pcre],
[AS_HELP_STRING([--with-system-pcre],[use system PCRE library (if available) @<:@no@:>@])],
[R_ARG_USE_SYSTEM(pcre)],
[use_system_pcre=no])
+AC_ARG_WITH([system-tre],
+[AS_HELP_STRING([--with-system-tre],[use system tre library (if available) @<:@no@:>@])],
+[R_ARG_USE_SYSTEM(tre)],
+[use_system_tre=no])
AC_ARG_WITH([system-xz],
[AS_HELP_STRING([--with-system-xz],[use system xz (lzma) library (if available) @<:@yes@:>@])],
[R_ARG_USE_SYSTEM(xz)],
@@ -2221,6 +2225,9 @@ R_LZMA
## PCRE headers and libraries.
R_PCRE
+## tre headers and libraries.
+R_TRE
+
## POSIX times.
R_SYS_POSIX_LEAPSECONDS
diff -up R-3.0.2/m4/R.m4.system-tre R-3.0.2/m4/R.m4
--- R-3.0.2/m4/R.m4.system-tre 2014-02-04 18:15:08.196719109 -0500
+++ R-3.0.2/m4/R.m4 2014-02-04 18:27:32.854028384 -0500
@@ -3150,6 +3150,26 @@ fi
AM_CONDITIONAL(BUILD_BZLIB, [test "x${have_bzlib}" = xno])
])# R_BZLIB
+## R_TRE
+## -------
+## Try finding tre library and headers.
+## We check that both are installed,
+AC_DEFUN([R_TRE],
+[if test "x${use_system_tre}" = xyes; then
+ AC_CHECK_LIB(tre, tre_regncompb, [have_tre=yes], [have_tre=no])
+ if test "${have_tre}" = yes; then
+ AC_CHECK_HEADERS(tre/tre.h, [have_tre=yes], [have_tre=no])
+ fi
+if test "x${have_tre}" = xyes; then
+ AC_DEFINE(HAVE_TRE, 1, [Define if your system has tre.])
+ LIBS="-ltre ${LIBS}"
+fi
+else
+ have_tre="no"
+fi
+AM_CONDITIONAL(BUILD_TRE, [test x${have_tre} != xyes])
+])# R_TRE
+
## R_LZMA
## -------
## Try finding liblzma library and headers.
diff -up R-3.0.2/src/extra/Makefile.in.system-tre R-3.0.2/src/extra/Makefile.in
--- R-3.0.2/src/extra/Makefile.in.system-tre 2014-02-04 18:31:50.263790068 -0500
+++ R-3.0.2/src/extra/Makefile.in 2014-02-04 18:32:11.792770146 -0500
@@ -22,7 +22,7 @@ LIBPCRE =@BUILD_PCRE_TRUE@ make.pcre
LIBZ =@BUILD_ZLIB_TRUE@ make.zlib
LIBXDR =@BUILD_XDR_TRUE@ make.xdr
LIBINTL =@BUILD_LIBINTL_TRUE@ make.intl
-LIBTRE = make.tre
+LIBTRE =@BUILD_TRE_TRUE@ make.tre
LIBXZ =@BUILD_XZ_TRUE@ make.xz
EXTRAS = $(RBLAS) $(LIBBZ2) $(LIBPCRE) $(LIBZ) $(LIBXDR) $(LIBINTL) $(LIBTRE) $(LIBXZ)
diff -up R-3.0.2/src/extra/tre/Makefile.in.system-tre R-3.0.2/src/extra/tre/Makefile.in
--- R-3.0.2/src/extra/tre/Makefile.in.system-tre 2014-02-04 18:29:54.812896929 -0500
+++ R-3.0.2/src/extra/tre/Makefile.in 2014-02-04 18:31:15.046822660 -0500
@@ -33,7 +33,7 @@ libtre_a_SOURCES = $(SOURCES)
libtre_a_OBJECTS = $(OBJECTS)
-all: R
+all: @BUILD_TRE_TRUE@ R
Makefile: $(srcdir)/Makefile.in \
$(top_builddir)/config.status \
@@ -44,9 +44,9 @@ Makedeps: Makefile $(DEPENDS)
@cat $(DEPENDS) >> Makefile
@touch $@
-R: Makefile
- @$(MAKE) Makedeps
- @$(MAKE) $(noinst_LIBRARIES)
+R: Makefile @BUILD_TRE_TRUE@
+ @BUILD_TRE_TRUE@ @$(MAKE) Makedeps
+ @BUILD_TRE_TRUE@ @$(MAKE) $(noinst_LIBRARIES)
libtre.a: $(libtre_a_OBJECTS)
rm -f $@
diff -up R-3.0.2/src/main/Makefile.in.system-tre R-3.0.2/src/main/Makefile.in
--- R-3.0.2/src/main/Makefile.in.system-tre 2014-02-04 18:28:02.924000533 -0500
+++ R-3.0.2/src/main/Makefile.in 2014-02-04 18:29:06.677941495 -0500
@@ -69,7 +69,7 @@ DISTFILES = Makefile.in Makefile.win \
ZLIB_CPPFLAGS = @BUILD_ZLIB_TRUE@ -I$(top_srcdir)/src/extra/zlib
BZLIB_CPPFLAGS = @BUILD_BZLIB_TRUE@ -I$(top_srcdir)/src/extra/bzip2
PCRE_CPPFLAGS = @BUILD_PCRE_TRUE@ -I$(top_srcdir)/src/extra/pcre
-TRE_CPPFLAGS = -I$(top_srcdir)/src/extra
+TRE_CPPFLAGS = @BUILD_TRE_TRUE@ -I$(top_srcdir)/src/extra
XDR_CPPFLAGS = @BUILD_XDR_TRUE@ -I$(top_srcdir)/src/extra/xdr
@BUILD_XDR_FALSE@XDR_CPPFLAGS = @TIRPC_CPPFLAGS@
XZ_CPPFLAGS = @BUILD_XZ_TRUE@ -I$(top_srcdir)/src/extra/xz/api
@@ -84,7 +84,7 @@ ALL_CPPFLAGS = $(ZLIB_CPPFLAGS) $(BZLIB_
R_ZLIBS = @BUILD_ZLIB_TRUE@ ../extra/zlib/libz.a
R_BZLIBS = @BUILD_BZLIB_TRUE@ ../extra/bzip2/libbz2.a
R_PCRE = @BUILD_PCRE_TRUE@ ../extra/pcre/libpcre.a
-R_TRE = ../extra/tre/libtre.a
+R_TRE = @BUILD_TRE_TRUE@ ../extra/tre/libtre.a
R_XDR = @BUILD_XDR_TRUE@ ../extra/xdr/libxdr.a
R_XZ = @BUILD_XZ_TRUE@ ../extra/xz/liblzma.a
R_LIBINTL = @BUILD_LIBINTL_TRUE@ ../extra/intl/libintl.a

30
R.spec
View File

@ -7,6 +7,16 @@
# Assume not modern. Override if needed.
%global modern 0
%global system_tre 0
# We need to use system tre on F21+/RHEL7
%if 0%{?fedora} >= 21
%global system_tre 1
%endif
%if 0%{?rhel} >= 7
%global system_tre 1
%endif
%if 0%{?fedora}
%global modern 1
%endif
@ -17,7 +27,7 @@
Name: R
Version: 3.0.2
Release: 4%{?dist}
Release: 5%{?dist}
Summary: A language for data analysis and graphics
URL: http://www.r-project.org
Source0: ftp://cran.r-project.org/pub/R/src/base/R-3/R-%{version}.tar.gz
@ -25,6 +35,7 @@ Source1: macros.R
Source2: R-make-search-index.sh
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=679180
Patch0: R-3.0.1-arm-compile-fix.patch
Patch1: R-3.0.2-system-tre.patch
License: GPLv2+
Group: Applications/Engineering
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -38,6 +49,10 @@ BuildRequires: java
%else
BuildRequires: java-1.4.2-gcj-compat
%endif
%if %{system_tre}
BuildRequires: tre-devel
BuildRequires: autoconf, automake, libtool
%endif
BuildRequires: lapack-devel
BuildRequires: libSM-devel, libX11-devel, libICE-devel, libXt-devel
BuildRequires: bzip2-devel, libXmu-devel, cairo-devel, libtiff-devel
@ -243,6 +258,9 @@ from the R project. This package provides the static libRmath library.
%prep
%setup -q
%patch0 -p1 -b .armfix
%if %{system_tre}
%patch1 -p1 -b .system-tre
%endif
# Filter false positive provides.
cat <<EOF > %{name}-prov
@ -262,6 +280,10 @@ EOF
%define __perl_requires %{_builddir}/R-%{version}/%{name}-req
chmod +x %{__perl_requires}
%if %{system_tre}
autoreconf -ifv -I m4
%endif
%build
# Add PATHS to Renviron for R_LIBS_SITE
echo 'R_LIBS_SITE=${R_LIBS_SITE-'"'/usr/local/lib/R/site-library:/usr/local/lib/R/library:%{_libdir}/R/library:%{_datadir}/R/library'"'}' >> etc/Renviron.in
@ -303,6 +325,9 @@ esac
export FCFLAGS="%{optflags}"
( %configure \
%if %{system_tre}
--with-system-tre \
%endif
--with-system-zlib --with-system-bzlib --with-system-pcre \
--with-lapack \
--with-blas \
@ -819,6 +844,9 @@ R CMD javareconf \
%postun -n libRmath -p /sbin/ldconfig
%changelog
* Fri Feb 7 2014 Tom Callaway <spot@fedoraproject.org> - 3.0.2-5
- add support for system tre (f21+, rhel 7+)
* Fri Feb 7 2014 Orion Poplawski <orion@cora.nwra.com> - 3.0.2-4
- Use BR java