fix off by 1 error
[rrdtool.git] / rrdtool.spec
index 36f6638..4e67a2b 100644 (file)
@@ -2,27 +2,30 @@
 %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 with_lua %{?_without_lua: 0} %{?!_without_lua: 1}
 %define php_extdir %(php-config --extension-dir 2>/dev/null || echo %{_libdir}/php4)
 %define svnrev r1190
-%define pre rc9
 #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.3
-Release: 0.20%{?pre:.%{pre}}%{?dist}
+Version: 1.4.999
+Release: 1%{?dist}
 License: GPLv2+ with exceptions
 Group: Applications/Databases
 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}%{pre}.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)
 Requires: dejavu-lgc-fonts
 BuildRequires: gcc-c++, openssl-devel, freetype-devel
 BuildRequires: libpng-devel, zlib-devel, intltool >= 0.35.0
-BuildRequires: cairo-devel >= 1.4.6, pango-devel >= 1.17
+BuildRequires: cairo-devel >= 1.2, pango-devel >= 1.14
 BuildRequires: libtool, groff
 BuildRequires: gettext, libxml2-devel
 %if 0%{?fedora} >= 7
@@ -57,6 +60,9 @@ 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.
 
+%define perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
+%define perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
+
 %package perl
 Summary: Perl RRDtool bindings
 Group: Development/Languages
@@ -141,10 +147,38 @@ Requires: %{name} = %{version}-%{release}
 The %{name}-ruby package includes RRDtool bindings for Ruby.
 %endif
 
+%if %{with_lua}
+%{!?lua_version: %define lua_version %(lua -v 2>&1 | cut -f2 -d' ' | cut -f1,2 -d '.')}
+
+%package lua
+Summary: Lua RRDtool bindings
+Group: Development/Languages
+BuildRequires: lua-devel
+Requires: lua
+Requires: %{name} = %{version}-%{release}
+
+%description lua
+The %{name}-lua package includes RRDtool bindings for Lua.
+%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 -q -n %{name}-%{version}%{pre} %{?with_php: -a 1}
 %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
@@ -153,8 +187,10 @@ The %{name}-ruby package includes RRDtool bindings for Ruby.
 
 # 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 php4/configure php4/ltconfig*
+%{__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|' \
@@ -163,10 +199,14 @@ The %{name}-ruby package includes RRDtool bindings for Ruby.
 #
 # 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 \
+    CFLAGS="-g -O0" \
     --with-perl-options='INSTALLDIRS="vendor"' \
 %if %{with_tcl}
     --enable-tcl-site \
@@ -181,7 +221,15 @@ cp -p /usr/lib/rpm/config.{guess,sub} php4/
 %endif
 %if %{with_ruby}
     --enable-ruby \
+%else
+    --disable-ruby \
+%endif
+%if %{with_lua}
+    --enable-lua \
+%else
+    --disable-lua \
 %endif
+    --enable-perl-site-install \
     --disable-static \
     --with-pic
 
@@ -189,13 +237,6 @@ cp -p /usr/lib/rpm/config.{guess,sub} php4/
 %{__perl} -pi.orig -e 's|-Wl,--rpath -Wl,\$rp||g' \
     bindings/perl-shared/Makefile.PL
 
-# Force RRDp bits where we want 'em, not sure yet why the
-# --with-perl-options and --libdir don't take
-pushd bindings/perl-piped/
-%{__perl} Makefile.PL INSTALLDIRS=vendor
-%{__perl} -pi.orig -e 's|/lib/perl|/%{_lib}/perl|g' Makefile
-popd
-
 #{__make} %{?_smp_mflags}
 make
 
@@ -237,9 +278,6 @@ 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
 
@@ -265,25 +303,51 @@ find examples/ -type f -exec chmod 0644 {} \;
         $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.*
 %{_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,-)
@@ -296,13 +360,13 @@ find examples/ -type f -exec chmod 0644 {} \;
 %{_mandir}/man3/*
 %{perl_vendorarch}/*.pm
 %attr(0755,root,root) %{perl_vendorarch}/auto/RRDs/
+%{perl_vendorlib}/*.pm
 
 %if %{with_python}
 %files python
 %defattr(-,root,root,-)
 %doc bindings/python/AUTHORS bindings/python/COPYING bindings/python/README
-%{python_sitearch}/rrdtoolmodule.so
-%{python_sitearch}/py_rrdtool-*.egg-info
+%{python_sitearch}/*
 %endif
 
 %if %{with_php}
@@ -328,7 +392,32 @@ find examples/ -type f -exec chmod 0644 {} \;
 %{ruby_sitearch}/RRD.so
 %endif
 
+%if %{with_lua}
+%files lua
+%defattr(-,root,root,-)
+%{_libdir}/lua/%{lua_version}/rrd.*
+%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
+* Tue Jan 25 2011 Bernard Li <bernard@vanhpc.org>
+- Reset Release to 1
+- Add -lua subpackage
+- Fix -perl subpackage so it includes the correct Perl package paths
+
+* 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