From f1b9d27ac8ad937241a6d41e448e032875587bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaroslav=20=C5=A0karvada?= Date: Mon, 9 Jan 2012 10:38:28 +0100 Subject: [PATCH] build with php 5.4 add minimal load test for PHP extension add provides filters --- rrdtool-1.4.4-php54.patch | 100 ++++++++++++++++++++++++++++++++++++++ rrdtool.spec | 30 +++++++++++- 2 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 rrdtool-1.4.4-php54.patch diff --git a/rrdtool-1.4.4-php54.patch b/rrdtool-1.4.4-php54.patch new file mode 100644 index 0000000..bf92011 --- /dev/null +++ b/rrdtool-1.4.4-php54.patch @@ -0,0 +1,100 @@ +diff -up rrdtool-1.4.4/php4/rrdtool.c.php54 rrdtool-1.4.4/php4/rrdtool.c +--- rrdtool-1.4.4/php4/rrdtool.c.php54 2011-12-29 08:57:00.790784347 +0100 ++++ rrdtool-1.4.4/php4/rrdtool.c 2011-12-29 09:00:55.960794927 +0100 +@@ -39,7 +39,7 @@ + ZEND_DECLARE_MODULE_GLOBALS(rrdtool) + */ + +-function_entry rrdtool_functions[] = { ++zend_function_entry rrdtool_functions[] = { + PHP_FE(rrd_graph, NULL) + PHP_FE(rrd_fetch, NULL) + PHP_FE(rrd_error, NULL) +@@ -119,8 +119,8 @@ PHP_MINFO_FUNCTION(rrdtool) + Creates a graph based on options passed via an array */ + PHP_FUNCTION(rrd_graph) + { +- pval *file, *args, *p_argc; +- pval *entry; ++ zval *file, *args, *p_argc; ++ zval *entry; + zval *p_calcpr; + HashTable *args_arr; + int i, xsize, ysize, argc; +@@ -155,7 +155,7 @@ PHP_FUNCTION(rrd_graph) + + for (i = 3; i < argc; i++) + { +- pval **dataptr; ++ zval **dataptr; + + if ( zend_hash_get_current_data(args_arr, (void *) &dataptr) == FAILURE ) + continue; +@@ -216,9 +216,8 @@ PHP_FUNCTION(rrd_graph) + Fetch info from an RRD file */ + PHP_FUNCTION(rrd_fetch) + { +- pval *file, *args, *p_argc; +- pval *entry; +- pval *p_start, *p_end, *p_step, *p_ds_cnt; ++ zval *file, *args, *p_argc; ++ zval *entry; + HashTable *args_arr; + zval *p_ds_namv, *p_data; + int i, j, argc; +@@ -254,7 +253,7 @@ PHP_FUNCTION(rrd_fetch) + + for (i = 3; i < argc; i++) + { +- pval **dataptr; ++ zval **dataptr; + + if ( zend_hash_get_current_data(args_arr, (void *) &dataptr) == FAILURE ) + continue; +@@ -361,7 +360,7 @@ PHP_FUNCTION(rrd_clear_error) + Update an RRD file with values specified */ + PHP_FUNCTION(rrd_update) + { +- pval *file, *opt; ++ zval *file, *opt; + char **argv; + + if ( rrd_test_error() ) +@@ -404,7 +403,7 @@ PHP_FUNCTION(rrd_update) + Gets last update time of an RRD file */ + PHP_FUNCTION(rrd_last) + { +- pval *file; ++ zval *file; + unsigned long retval; + + char **argv = (char **) emalloc(3 * sizeof(char *)); +@@ -439,8 +438,8 @@ PHP_FUNCTION(rrd_last) + Create an RRD file with the options passed (passed via array) */ + PHP_FUNCTION(rrd_create) + { +- pval *file, *args, *p_argc; +- pval *entry; ++ zval *file, *args, *p_argc; ++ zval *entry; + char **argv; + HashTable *args_arr; + int argc, i; +@@ -449,7 +448,7 @@ PHP_FUNCTION(rrd_create) + rrd_clear_error(); + + if ( ZEND_NUM_ARGS() == 3 && +- getParameters(ht, 3, &file, &args, &p_argc) == SUCCESS ) ++ zend_get_parameters(ht, 3, &file, &args, &p_argc) == SUCCESS ) + { + if ( args->type != IS_ARRAY ) + { +@@ -473,7 +472,7 @@ PHP_FUNCTION(rrd_create) + + for (i = 3; i < argc; i++) + { +- pval **dataptr; ++ zval **dataptr; + + if ( zend_hash_get_current_data(args_arr, (void *) &dataptr) == FAILURE ) + continue; diff --git a/rrdtool.spec b/rrdtool.spec index b53f712..93daf3e 100644 --- a/rrdtool.spec +++ b/rrdtool.spec @@ -7,10 +7,18 @@ %define svnrev r1190 #define pretag 1.2.99908020600 +# Private libraries are not be exposed globally by RPM +# RPM 4.8 +%{?filter_provides_in: %filter_provides_in %{php_extdir}/.*\.so$} +%{?filter_setup} +# RPM 4.9 +%global __provides_exclude_from %{?__provides_exclude_from:%__provides_exclude_from|}%{php_extdir}/.*\\.so$ + + Summary: Round Robin Database Tool to store and display time-series data Name: rrdtool Version: 1.4.4 -Release: 7%{?dist} +Release: 8%{?dist} License: GPLv2+ with exceptions Group: Applications/Databases URL: http://oss.oetiker.ch/rrdtool/ @@ -18,6 +26,8 @@ Source0: http://oss.oetiker.ch/%{name}/pub/%{name}-%{version}.tar.gz Source1: php4-%{svnrev}.tar.gz # Fix tcl-site configure option (upstream ticket #281) Patch0: rrdtool-1.4.4-fix-tcl-site-option.patch +Patch1: rrdtool-1.4.4-php54.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Requires: dejavu-sans-mono-fonts, dejavu-lgc-sans-mono-fonts BuildRequires: gcc-c++, openssl-devel, freetype-devel @@ -155,6 +165,9 @@ The %{name}-lua package includes RRDtool bindings for Lua. %prep %setup -q -n %{name}-%{version} %{?with_php: -a 1} %patch0 -p1 -b .fix-tcl-site-option +%if %{with_php} +%patch1 -p1 -b .php54 +%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' \ @@ -281,6 +294,16 @@ find examples/ -type f -exec chmod 0644 {} \; $RPM_BUILD_ROOT%{_datadir}/%{name}/examples \ $RPM_BUILD_ROOT%{perl_vendorarch}/auto/*/{.packlist,*.bs} +%check +# minimal load test for the PHP extension +%if %{with_php} +LD_LIBRARY_PATH=%{buildroot}%{_libdir} php -n \ + -d extension_dir=%{buildroot}%{php_extdir} \ + -d extension=rrdtool.so -m \ + | grep rrdtool +%endif + + %clean %{__rm} -rf $RPM_BUILD_ROOT @@ -353,6 +376,11 @@ find examples/ -type f -exec chmod 0644 {} \; %endif %changelog +* Thu Dec 29 2011 Remi Collet - 1.4.4-8 +- build with php 5.4 +- add minimal load test for PHP extension +- add provides filters + * Tue Dec 06 2011 Adam Jackson - 1.4.4-7 - Rebuild for new libpng