updated versions to account for rrd cached fix
[rrdtool.git] / rrdtool.spec
index 97871d1..4206705 100644 (file)
@@ -1,19 +1,35 @@
+%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 with_ruby %{?_without_ruby: 0} %{?!_without_ruby: 1}
+%define php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4)
+%define svnrev r1190
+#define pretag 1.2.99908020600
+%define rrdcached_user rrdcached
+
 Summary: Round Robin Database Tool to store and display time-series data
 Name: rrdtool
-Version: 1.2.23
-Release: 3%{?dist}
-License: GPL
+Version: 1.4.0
+Release: 0.20%{?dist}
+License: GPLv2+ with exceptions
 Group: Applications/Databases
-URL: http://oss.oetiker.ch/%{name}/
-Source: http://oss.oetiker.ch/%{name}/pub/%{name}-%{version}.tar.gz
+URL: http://oss.oetiker.ch/rrdtool/
+#Source0: http://oss.oetiker.ch/%{name}/pub/%{name}-%{version}.tar.gz
+Source0: http://oss.oetiker.ch/rrdtool/pub/beta/%{name}-%{version}.tar.gz
+%if %{with_php}
+Source1: php4-%{svnrev}.tar.gz
+Patch1: rrdtool-1.3.0-beta4-fix-rrd_update-in-php-bindings.patch
+%endif
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: gcc-c++, openssl-devel
-BuildRequires: libpng-devel, zlib-devel, libart_lgpl-devel >= 2.0
-BuildRequires: freetype-devel, python-devel >= 2.3
-Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
-
-%{!?python_sitearch: %define python_sitearch %(%{__python} -c 'from distutils import sysconfig; print sysconfig.get_python_lib(1)')}
-%{!?python_version: %define python_version %(%{__python} -c 'import sys; print sys.version.split(" ")[0]')}
+Requires: dejavu-lgc-fonts
+BuildRequires: gcc-c++, openssl-devel, freetype-devel
+BuildRequires: libpng-devel, zlib-devel, intltool >= 0.35.0
+BuildRequires: cairo-devel >= 1.2, pango-devel >= 1.14
+BuildRequires: libtool, groff
+BuildRequires: gettext, libxml2-devel
+%if 0%{?fedora} >= 7
+BuildRequires: perl-ExtUtils-MakeMaker perl-devel
+%endif
 
 %description
 RRD is the Acronym for Round Robin Database. RRD is a system to store and
@@ -43,46 +59,153 @@ RRD is the Acronym for Round Robin Database. RRD is a system to store and
 display time-series data (i.e. network bandwidth, machine-room temperature,
 server load average). This package contains documentation on using RRD.
 
-%package -n perl-%{name}
+%package perl
 Summary: Perl RRDtool bindings
 Group: Development/Languages
 Requires: %{name} = %{version}-%{release}
-Obsoletes: %{name}-perl <= %{version}
-Provides: %{name}-perl = %{version}
+Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
+Obsoletes: perl-%{name} < %{version}-%{release}
+Provides: perl-%{name} = %{version}-%{release}
 
-%description -n perl-%{name}
+%description perl
 The Perl RRDtool bindings
 
-%package -n python-%{name}
+%if %{with_python}
+%{!?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")}
+
+%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}
 
-%description -n python-%{name}
+%description python
 Python RRDtool bindings.
+%endif
+
+%ifarch ppc64
+# php bits busted on ppc64 at the moment
+%define with_php 0
+%endif
+
+%if %{with_php}
+%package php
+Summary: PHP RRDtool bindings
+Group: Development/Languages
+BuildRequires: php-devel >= 4.0
+Requires: php >= 4.0
+Requires: %{name} = %{version}-%{release}
+%if 0%{?php_zend_api}
+Requires: php(zend-abi) = %{php_zend_api}
+Requires: php(api) = %{php_core_api}
+%else
+Requires: php-api = %{php_apiver}
+%endif
+Obsoletes: php-%{name} < %{version}-%{release}
+Provides: php-%{name} = %{version}-%{release}
+Provides: php-pecl(rrdtool)
+
+%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
+BuildRequires: tcl-devel >= 8.0
+Requires: tcl >= 8.0
+Requires: %{name} = %{version}-%{release}
+Obsoletes: tcl-%{name} < %{version}-%{release}
+Provides: tcl-%{name} = %{version}-%{release}
+
+%description tcl
+The %{name}-tcl package includes RRDtool bindings for Tcl.
+%endif
+
+%if %{with_ruby}
+%{!?ruby_sitearch: %define ruby_sitearch %(ruby -rrbconfig -e 'puts Config::CONFIG["sitearchdir"]')}
+
+%package ruby
+Summary: Ruby RRDtool bindings
+Group: Development/Languages
+BuildRequires: ruby, ruby-devel
+Requires: ruby(abi) = 1.8
+Requires: %{name} = %{version}-%{release}
+
+%description ruby
+The %{name}-ruby package includes RRDtool bindings for Ruby.
+%endif
+
+%package cached
+Summary: Data caching daemon for RRDtool
+Group: Applications/Databases
+Requires: %{name} = %{version}-%{release}
+
+%description cached
+rrdcached is a daemon that receives updates to existing RRD files,
+accumulates them and, if enough have been received or a defined time has
+passed, writes the updates to the RRD file.  The daemon was written with
+big setups in mind which usually runs into I/O related problems.  This
+daemon was written to alleviate these problems.
 
 %prep
-%setup
+%if %{with_php}
+%setup -q -n %{name}-%{version} -a 1
+%patch1 -p1
+%else
+%setup -q -n %{name}-%{version}
+%endif
 
 # Fix to find correct python dir on lib64
 %{__perl} -pi -e 's|get_python_lib\(0,0,prefix|get_python_lib\(1,0,prefix|g' \
     configure
 
-# Shouldn't be necessary when using --libdir, but
-# introduces hardcoded rpaths where it shouldn't,
-# if not done...
-%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' \
-    configure Makefile.in
+# Most edits shouldn't be necessary when using --libdir, but
+# w/o, some introduce hardcoded rpaths where they shouldn't
+%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' configure Makefile.in*
+%if %{with_php}
+%{__perl} -pi.orig -e 's|/lib\b|/%{_lib}|g' php4/configure php4/ltconfig*
+%endif
+
+# Perl 5.10 seems to not like long version strings, hack around it
+%{__perl} -pi.orig -e 's|1.299907080300|1.29990708|' \
+    bindings/perl-shared/RRDs.pm bindings/perl-piped/RRDp.pm
+
+#
+# fix config files for php4 bindings
+# workaround needed due to https://bugzilla.redhat.com/show_bug.cgi?id=211069
+%if %{with_php}
+cp -p /usr/lib/rpm/config.{guess,sub} php4/
+%endif
+
 
 %build
 %configure \
-    --program-prefix="%{?_program_prefix}" \
-    --libdir=%{_libdir} \
+    CFLAGS="-g -O0" \
+    --with-perl-options='INSTALLDIRS="vendor"' \
+%if %{with_tcl}
+    --enable-tcl-site \
+    --with-tcllib=%{_libdir} \
+%else
+    --disable-tcl \
+%endif
+%if %{with_python}
+    --enable-python \
+%else
+    --disable-python \
+%endif
+%if %{with_ruby}
+    --enable-ruby \
+%endif
     --disable-static \
-    --with-pic \
-    --with-perl-options='INSTALLDIRS="vendor"'
+    --with-pic
 
 # Fix another rpath issue
 %{__perl} -pi.orig -e 's|-Wl,--rpath -Wl,\$rp||g' \
@@ -95,7 +218,22 @@ pushd bindings/perl-piped/
 %{__perl} -pi.orig -e 's|/lib/perl|/%{_lib}/perl|g' Makefile
 popd
 
-%{__make} %{?_smp_mflags}
+#{__make} %{?_smp_mflags}
+make
+
+# Build the php module, the tmp install is required
+%if %{with_php}
+%define rrdtmp %{_tmppath}/%{name}-%{version}-tmpinstall
+%{__make} install DESTDIR="%{rrdtmp}"
+pushd php4/
+%configure \
+    --with-rrdtool="%{rrdtmp}%{_prefix}" \
+    --disable-static
+#{__make} %{?_smp_mflags}
+make
+popd
+%{__rm} -rf %{rrdtmp}
+%endif
 
 # Fix @perl@ and @PERL@
 find examples/ -type f \
@@ -107,9 +245,26 @@ find examples/ -name "*.pl" \
 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
+%{__rm} -rf php4/examples/.svn
+# Put the php config bit into place
+%{__mkdir_p} %{buildroot}%{_sysconfdir}/php.d
+%{__cat} << __EOF__ > %{buildroot}%{_sysconfdir}/php.d/rrdtool.ini
+; 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}/
 
+# Dunno why this is getting installed here...
+%{__rm} -f $RPM_BUILD_ROOT%{perl_vendorarch}/../leaktest.pl
+
 # We only want .txt and .html files for the main documentation
 %{__mkdir_p} doc2/html doc2/txt
 %{__cp} -a doc/*.txt doc2/txt/
@@ -126,50 +281,269 @@ make DESTDIR="$RPM_BUILD_ROOT" install
 find examples/ -type f -exec chmod 0644 {} \;
 
 # Clean up the buildroot
-%{__rm} -rf $RPM_BUILD_ROOT%{_datadir}/doc/%{name}-%{version}/{txt,html}/ \
+%{__rm} -rf $RPM_BUILD_ROOT%{_docdir}/%{name}-* \
        $RPM_BUILD_ROOT%{perl_vendorarch}/ntmake.pl \
        $RPM_BUILD_ROOT%{perl_archlib}/perllocal.pod \
         $RPM_BUILD_ROOT%{_datadir}/%{name}/examples \
         $RPM_BUILD_ROOT%{perl_vendorarch}/auto/*/{.packlist,*.bs}
 
+# Set up rrdcached
+%__install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/default
+%__install -d -m 0755 $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d
+%__install -m 0644 etc/rrdcached-default $RPM_BUILD_ROOT/%{_sysconfdir}/default/rrdcached
+%__install -m 0755 etc/rrdcached-init $RPM_BUILD_ROOT/%{_sysconfdir}/rc.d/init.d/rrdcached
+%__install -d -m 0755 -o nobody -g nobody $RPM_BUILD_ROOT/%{_localstatedir}/run/rrdcached
+
 %clean
 %{__rm} -rf $RPM_BUILD_ROOT
 
+%pre cached
+/usr/sbin/groupadd %rrdcached_user &>/dev/null ||:
+/usr/sbin/useradd -s /sbin/nologin -g %rrdcached_user -c %rrdcached_user -d %{_localstatedir}/run/rrdcached  %rrdcached_user &>/dev/null || :
+
 %post -p /sbin/ldconfig
 
+%post cached
+/sbin/chkconfig --add rrdcached
+/sbin/service rrdcached start
+
+%preun cached
+/sbin/service rrdcached stop
+
 %postun -p /sbin/ldconfig
 
+%postun cached
+/sbin/chkconfig --del rrdcached
+test "$1" != 0 || /usr/sbin/userdel %rrdcached_user &>/dev/null || :
+#test "$1" != 0 || /usr/sbin/groupdel %rrdcached_user &>/dev/null || :
+
 %files
+%defattr(-,root,root,-)
 %{_bindir}/*
+%exclude %{_bindir}/rrdcached
 %{_libdir}/*.so.*
-%{_libdir}/rrdtool/*
-%{_datadir}/%{name}/fonts/*
+%{_datadir}/%{name}
 %{_mandir}/man1/*
+%exclude %{_mandir}/man1/rrdcached*
 
 %files devel
 %defattr(-,root,root,-)
 %{_includedir}/*.h
 %exclude %{_libdir}/*.la
 %{_libdir}/*.so
+%{_libdir}/pkgconfig/librrd.pc
 
 %files doc
 %defattr(-,root,root,-)
-%doc CHANGES CONTRIBUTORS COPYING COPYRIGHT README TODO NEWS THREADS doc2/html doc2/txt
-%doc examples
+%doc CONTRIBUTORS COPYING COPYRIGHT README TODO NEWS THREADS
+%doc examples doc2/html doc2/txt
 
-%files -n perl-%{name}
+%files perl
 %defattr(-,root,root,-)
 %doc doc3/html
 %{_mandir}/man3/*
 %{perl_vendorarch}/*.pm
-%attr(0755,root,root) %{perl_vendorarch}/auto/RRDs/*
+%attr(0755,root,root) %{perl_vendorarch}/auto/RRDs/
 
-%files -n python-%{name}
+%if %{with_python}
+%files python
 %defattr(-,root,root,-)
 %doc bindings/python/AUTHORS bindings/python/COPYING bindings/python/README
-%{python_sitearch}/rrdtoolmodule.so
+%{python_sitearch}/*
+%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
+
+%if %{with_ruby}
+%files ruby
+%defattr(-,root,root,-)
+%doc bindings/ruby/README
+%{ruby_sitearch}/RRD.so
+%endif
+
+%files cached
+%{_bindir}/rrdcached
+%config %{_sysconfdir}/default/*
+%config %{_sysconfdir}/rc.d/init.d/*
+%{_mandir}/man1/rrdcached*
+%attr(0775 %rrdcached_user %rrdcached_user) %dir %{_localstatedir}/run/rrdcached
 
 %changelog
+* Wed Oct 08 2008 Bernard Li <bernard@vanhpc.org>
+- Split rrdcached related files to -cached subpackage
+- Create rrdcached user and make rrdcached related files owned by it
+
+* Tue Oct 07 2008 Bernard Li <bernard@vanhpc.org>
+- Include librrd.pc file in -devel package
+
+* Sun Jun 08 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.20.rc9
+- Update to rrdtool 1.3 rc9
+- Minor spec tweaks to permit building on older EL
+
+* Wed Jun 04 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.19.rc7
+- Update to rrdtool 1.3 rc7
+
+* Tue May 27 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.18.rc6
+- Update to rrdtool 1.3 rc6
+
+* Wed May 21 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.17.rc4
+- Bump version and rebuild
+
+* Wed May 21 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.16.rc4
+- Fix php bindings compile on x86_64
+
+* Mon May 19 2008 Chris Ricker <kaboom@oobleck.net> 1.3-0.15.rc4
+- Update to rrdtool 1.3 rc4
+
+* Tue May 13 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.15.rc1
+- Update to rrdtool 1.3 rc1
+- Fix versioning in changelog entries, had an extra 0 in there...
+- Drop cairo and python patches, they're in 1.3 rc1
+- Add Requires: gettext and libxml2-devel for new translations
+
+* Wed Apr 30 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.14.beta4
+- Drop some conditional flags, they're not working at the moment...
+
+* Wed Apr 30 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.13.beta4
+- Fix problem with cairo_save/cairo_restore (#444827)
+
+* Wed Apr 23 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.12.beta4
+- Fix python bindings rrdtool info implementation (#435468)
+
+* Tue Apr 08 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.11.beta4
+- Work around apparent version string length issue w/perl 5.10 (#441359)
+
+* Sat Apr 05 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.10.beta4
+- Fix use of rrd_update in php bindings (#437558)
+
+* Mon Mar  3 2008 Tom "spot" Callaway <tcallawa@redhat.com> 1.3-0.9.beta4
+- rebuild for new perl (again)
+
+* Wed Feb 13 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.8.beta4
+- Update to rrdtool 1.3 beta4
+
+* Tue Feb 05 2008 Tom "spot" Callaway <tcallawa@redhat.com> 1.3-0.7.beta3
+- rebuild for new perl (and fix license tag)
+
+* Mon Feb 04 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.6.beta3
+- Plug memory leak (#430879)
+
+* Mon Jan 07 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.5.beta3
+- Fix right-aligned text alignment and scaling (Resolves: #427609)
+
+* Wed Jan 02 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.4.beta3
+- Add newly built python egg to %%files
+
+* Wed Jan 02 2008 Jarod Wilson <jwilson@redhat.com> 1.3-0.3.beta3
+- Update to rrdtool 1.3 beta3
+- Return properly from errors in RRDp.pm (Resolves: #427040)
+- Requires: dejavu-lgc-fonts (Resolves: #426935)
+
+* Thu Dec 06 2007 Jarod Wilson <jwilson@redhat.com> 1.3-0.2.beta2
+- Update to rrdtool 1.3 beta2
+
+* Wed Aug 08 2007 Jarod Wilson <jwilson@redhat.com> 1.3-0.1.beta1
+- Update to rrdtool 1.3 beta1
+
+* Tue Jul 10 2007 Jarod Wilson <jwilson@redhat.com> 1.2.999-0.3.r1144
+- Update to latest rrdtool pre-1.3 svn snapshot (svn r1144)
+- Add php abi check (Resolves: #247339)
+
+* Fri Jun 15 2007 Jarod Wilson <jwilson@redhat.com> 1.2.999-0.2.r1127
+- Fix up BuildRequires
+
+* Fri Jun 15 2007 Jarod Wilson <jwilson@redhat.com> 1.2.999-0.1.r1127
+- Update to rrdtool pre-1.3 svn snapshot (svn r1127)
+
+* Mon May 21 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-5
+- BR: ruby so %%ruby_sitearch gets set
+
+* Mon May 21 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-4
+- Build ruby bindings
+
+* Thu May 03 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-3
+- Disable php bits on ppc64 for now, they fail to build
+
+* Thu May 03 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-2
+- Add BR: perl-devel for Fedora 7 and later
+
+* Tue May 01 2007 Jarod Wilson <jwilson@redhat.com> 1.2.23-1
+- New upstream release
+
+* Tue May 01 2007 Jarod Wilson <jwilson@redhat.com> 1.2.21-1
+- New upstream release
+
+* Wed Apr 25 2007 Jarod Wilson <jwilson@redhat.com> 1.2.19-2
+- Define %%python_version *before* its needed (#237826)
+
+* Mon Apr 09 2007 Jarod Wilson <jwilson@redhat.com> 1.2.19-1
+- New upstream release
+
+* Tue Jan 23 2007 Jarod Wilson <jwilson@redhat.com> 1.2.18-1
+- New upstream release
+
+* Mon Jan 22 2007 Jarod Wilson <jwilson@redhat.com> 1.2.17-1
+- New upstream release
+
+* Tue Jan 02 2007 Jarod Wilson <jwilson@redhat.com> 1.2.15-9
+- Fix crash with long error strings (upstream
+  changesets 929 and 935)
+
+* Thu Dec 14 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-8
+- Fix for log grid memory leak (#201241)
+
+* Tue Dec 12 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-7
+- Rebuild for python 2.5
+
+* Tue Nov 14 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-6
+- Conditionalize python, php and tcl bits (Resolves #203275)
+
+* Wed Oct 25 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-5
+- Add tcl sub-package (#203275)
+
+* Tue Sep 05 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-4
+- Rebuild for new glibc
+
+* Wed Aug 02 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-3
+- One more addition to initrrdtool patch, to fully revert
+  and correct upstream changeset 839
+- Fix for no python in minimal fc4 buildroots
+
+* Tue Aug  1 2006 Mihai Ibanescu <misa@redhat.com> 1.2.15-2
+- Fixed rrdtool-python to import the module properly (patch
+  rrdtool-1.2.15-initrrdtool.patch)
+
+* Mon Jul 17 2006 Jarod Wilson <jwilson@redhat.com> 1.2.15-1
+- Update to 1.2.15
+- Minor spec cleanups
+
+* Sat Jun 24 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-7
+- Fix up Obsoletes
+
+* Mon Jun 19 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-6
+- Flip perl, php and python sub-package names around to 
+  conform with general practices
+
+* Sat Jun 10 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-5
+- Minor fixes to make package own created directories
+
+* Wed Jun 07 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-4
+- Add php bits back into the mix
+
 * Mon Jun 05 2006 Jarod Wilson <jwilson@redhat.com> 1.2.13-3
 - Merge spec fixes from bz 185909