Hi.

I just discovered that the rrdtool source contained a php extension..., so I 
couldn't bare myself not to fix it :-)

Here's a spec file diff:

(sorry if it wraps...)

--- rrdtool.spec        2002-11-04 17:48:08.000000000 -0500
+++ rrdtool.spec.oden   2002-11-24 21:49:26.000000000 -0500
@@ -1,19 +1,27 @@
 %define major 0
 %define libname lib%name%major

+%{expand:%%define php_version %(php -v 2>/dev/null)}
+%define phpdir %{_libdir}/php
+%define phpsource /usr/src/php-devel
+
 Name:          rrdtool
 Summary:       RRDtool - round robin database
 Version:       1.0.39
-Release:       1mdk
+Release:       2mdk
 License:       GPL
 Group:                 Networking/Other
 Source:        
http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/pub/%{name}-%{version}.tar.bz2
 Patch:         rrdtool.doc.patch.bz2
 Patch1:                rrdtool-1.0.38-zlib-libpng.patch
+Patch2:                rrdtool-1.0.39-php-rrd.patch.bz2
 Buildroot:     %{_tmppath}rrdtool-root
 Url:           http://ee-staff.ethz.ch/~oetiker/webtools/rrdtool/
 Requires:      libpng >= 1.0.3, zlib >= 1.1.3
 BuildRequires:         libpng-devel >= 1.0.3, perl-devel libgd-devel, 
zlib-devel
+Prereq:                php-common = %{php_version}
+Requires:      php-common = %{php_version}
+BuildRequires:  php-devel = %{php_version}

 %description
 RRD is the Acronym for Round Robin Database. RRD is a system to store and
@@ -49,10 +57,23 @@
 display time-series data (i.e. network bandwidth, machine-room temperature,
 server load average). This package allow you to use directly this library.

+%package -n php-rrdtool
+Summary: A RRDTool exstension for PHP4
+Version: %{version}
+Release: %{release}
+Group: System/Servers
+Requires: %libname = %version
+Obsoletes: php-rrdtool
+Provides: php-rrdtool
+
+%description -n php-rrdtool
+A RRDTool exstension for PHP4
+
 %prep
 %setup -q
 %patch0 -p1 -b .doc
 %patch1 -p1 -b .systemlibs
+%patch2 -p1

 %build
 #CFLAGS="$RPM_OPT_FLAGS" LIBS="-lm -lz -lpng"
@@ -65,6 +86,11 @@
 find -type f | xargs /usr/bin/perl -pi -e 's|^#! @perl@|#!/usr/bin/perl|gi'
 find -name "*.pl" | xargs perl -pi -e 's;\015;;gi'

+# build the php-rrdtool php extension addon
+pushd contrib/php4
+    %{phpsource}/buildext rrdtool "rrdtool.c" "-L../../src/.libs -I../../src 
-lrrd" "-DHAVE_RRDTOOL -DCOMPILE_DL_RRDTOOL"
+popd
+
 %install
 rm -rf $RPM_BUILD_ROOT
 %makeinstall
@@ -91,6 +117,9 @@
 cp -a %{_tmppath}rrdtool-root/%{_prefix}/examples/* 
%{_tmppath}rrdtool-root/%{_docdir}/%{name}-%{version}
 cp -a %{_tmppath}rrdtool-root/%{_prefix}/contrib/* 
%{_tmppath}rrdtool-root/%{_docdir}/%{name}-%{version}

+install -d %{buildroot}%{phpdir}/extensions
+install -m755 contrib/php4/rrdtool.so %{buildroot}%{phpdir}/extensions/
+
 %clean
 rm -rf $RPM_BUILD_ROOT

@@ -119,7 +148,22 @@
 %attr(0644,root,root) %{_includedir}/*.h
 %_libdir/*.so

+%files -n php-rrdtool
+%defattr(-,root,root)
+%doc contrib/php4/USAGE
+%doc contrib/php4/README
+%doc contrib/php4/INSTALL
+%doc contrib/php4/examples/rrd_update.php
+%doc contrib/php4/examples/rrd_graph.php
+%doc contrib/php4/examples/rrd_create.php
+%doc contrib/php4/examples/rrd_fetch.php
+%doc contrib/php4/examples/rrd_last.php
+%{phpdir}/extensions/rrdtool.so
+
 %changelog
+* Sun Nov 24 2002 Oden Eriksson <[EMAIL PROTECTED]> 1.0.39-2mdk
+- added the php-rrd sub package and its P2
+
 * Mon Nov 04 2002 Lenny Cartier <[EMAIL PROTECTED]> 1.0.39-1mdk
 - 1.0.39

Well..., I don't know if this is the right way to do it, but hey, it's a 
start... Maybe J-M Dault can add "extension = rrdtool.so" to the php.ini 
file?

Here's the source rpm:  
http://d-srv.com/Cooker/SRPMS/rrdtool-1.0.39-2mdk.src.rpm

Chears.
-- 
Regards // Oden Eriksson, Deserve-IT Networks

Check the "Modules For Apache2" status page at: 
http://www.deserve-it.com/modules_for_apache2.html


Reply via email to