From 2a0aeeeaefc710331086238d6d6bed4281110e71 Mon Sep 17 00:00:00 2001 From: Jarod Wilson Date: Tue, 14 Nov 2006 18:38:35 +0000 Subject: [PATCH] - Conditionalize python, php and tcl bits (Resolves #203275) --- rrdtool.spec | 53 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 11 deletions(-) diff --git a/rrdtool.spec b/rrdtool.spec index eb1b55d..9c398ec 100644 --- a/rrdtool.spec +++ b/rrdtool.spec @@ -1,10 +1,13 @@ +%define with_python %{?_without_python: 0} %{?!_without_python: 1} +%define with_php %{?_without_php: 0} %{?!_without_php: 1} +%define with_tcl %{?_without_tcl: 0} %{?!_without_tcl: 1} %define php_rrd_svn 839 %define php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4) Summary: Round Robin Database Tool to store and display time-series data Name: rrdtool Version: 1.2.15 -Release: 5%{?dist} +Release: 6%{?dist} License: GPL Group: Applications/Databases URL: http://people.ee.ethz.ch/~oetiker/webtools/%{name}/ @@ -13,13 +16,8 @@ Source1: php4-svn%{php_rrd_svn}.tar.gz Patch0: rrdtool-1.2.13-php.patch Patch1: rrdtool-1.2.15-initrrdtool.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: gcc-c++, openssl-devel +BuildRequires: gcc-c++, openssl-devel, freetype-devel BuildRequires: libpng-devel, zlib-devel, libart_lgpl-devel >= 2.0 -BuildRequires: freetype-devel, python-devel >= 2.3 - -%{!?python_sitearch: %define python_sitearch %(%{__python} -c 'from distutils import sysconfig; print sysconfig.get_python_lib(1)')} -# eval to 2.3 if python isn't yet present, workaround for no python in fc4 minimal buildroot -%{!?python_version: %define python_version %(%{__python} -c 'import sys; print sys.version.split(" ")[0]' || echo "2.3")} %description RRD is the Acronym for Round Robin Database. RRD is a system to store and @@ -60,18 +58,24 @@ Provides: perl-%{name} = %{version}-%{release} %description perl The Perl RRDtool bindings +%if %{with_python} %package python Summary: Python RRDtool bindings Group: Development/Languages -BuildRequires: python +BuildRequires: python-devel >= 2.3 Requires: python >= %{python_version} Requires: %{name} = %{version}-%{release} Obsoletes: python-%{name} < %{version}-%{release} Provides: python-%{name} = %{version}-%{release} +%{!?python_sitearch: %define python_sitearch %(%{__python} -c 'from distutils import sysconfig; print sysconfig.get_python_lib(1)')} +# eval to 2.3 if python isn't yet present, workaround for no python in fc4 minimal buildroot +%{!?python_version: %define python_version %(%{__python} -c 'import sys; print sys.version.split(" ")[0]' || echo "2.3")} %description python Python RRDtool bindings. +%endif +%if %{with_php} %package php Summary: PHP RRDtool bindings Group: Development/Languages @@ -84,7 +88,9 @@ Provides: php-%{name} = %{version}-%{release} %description php The %{name}-php package includes a dynamic shared object (DSO) that adds RRDtool bindings to the PHP HTML-embedded scripting language. +%endif +%if %{with_tcl} %package tcl Summary: Tcl RRDtool bindings Group: Development/Languages @@ -96,12 +102,15 @@ Provides: tcl-%{name} = %{version}-%{release} %description tcl The %{name}-tcl package includes RRDtool bindings for Tcl. +%endif %prep %setup -q %setup -q -T -D -a 1 # Patch based on http://oss.oetiker.ch/rrdtool/pub/contrib/php_rrdtool.tgz +%if %{with_php} %patch0 -p0 -b .php +%endif %patch1 -p1 -b .initrrdtool # Fix to find correct python dir on lib64 @@ -115,11 +124,20 @@ The %{name}-tcl package includes RRDtool bindings for Tcl. %build %configure \ - --disable-static \ - --with-pic \ + --with-perl-options='INSTALLDIRS="vendor"' \ +%if %{with_tcl} --enable-tcl-site \ --with-tcllib=%{_libdir} \ - --with-perl-options='INSTALLDIRS="vendor"' +%else + --disable-tcl \ +%endif +%if %{with_python} + --enable-python \ +%else + --disable-python \ +%endif + --disable-static \ + --with-pic # Fix another rpath issue %{__perl} -pi.orig -e 's|-Wl,--rpath -Wl,\$rp||g' \ @@ -135,6 +153,7 @@ popd %{__make} %{?_smp_mflags} # Build the php module, the tmp install is required +%if %{with_php} %define rrdtmp %{_tmppath}/%{name}-%{version}-tmpinstall %{__make} install DESTDIR="%{rrdtmp}" pushd php4/ @@ -144,6 +163,7 @@ pushd php4/ %{__make} %{?_smp_mflags} popd %{__rm} -rf %{rrdtmp} +%endif # Fix @perl@ and @PERL@ find examples/ -type f \ @@ -156,6 +176,7 @@ rm -rf $RPM_BUILD_ROOT make DESTDIR="$RPM_BUILD_ROOT" install # Install the php module +%if %{with_php} %{__install} -D -m0755 php4/modules/rrdtool.so \ %{buildroot}%{php_extdir}/rrdtool.so # Clean up the examples for inclusion as docs @@ -166,6 +187,7 @@ make DESTDIR="$RPM_BUILD_ROOT" install ; Enable rrdtool extension module extension=rrdtool.so __EOF__ +%endif # Pesky RRDp.pm... %{__mv} $RPM_BUILD_ROOT%{perl_vendorarch}/../RRDp.pm $RPM_BUILD_ROOT%{perl_vendorarch}/ @@ -224,24 +246,33 @@ find examples/ -type f -exec chmod 0644 {} \; %{perl_vendorarch}/*.pm %attr(0755,root,root) %{perl_vendorarch}/auto/RRDs/ +%if %{with_python} %files python %defattr(-,root,root,-) %doc bindings/python/AUTHORS bindings/python/COPYING bindings/python/README %{python_sitearch}/rrdtoolmodule.so +%endif +%if %{with_php} %files php %defattr(-,root,root,0755) %doc php4/examples php4/README %config(noreplace) %{_sysconfdir}/php.d/rrdtool.ini %{php_extdir}/rrdtool.so +%endif +%if %{with_tcl} %files tcl %defattr(-,root,root,-) %doc bindings/tcl/README %{_libdir}/tclrrd*.so %{_libdir}/rrdtool/*.tcl +%endif %changelog +* Tue Nov 14 2006 Jarod Wilson 1.2.15-6 +- Conditionalize python, php and tcl bits (Resolves #203275) + * Wed Oct 25 2006 Jarod Wilson 1.2.15-5 - Add tcl sub-package (#203275)