From 166ec60a68f84e1b48fbf5e20aaf90b4baabce03 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 29 Jan 2024 14:15:13 +0100 Subject: [PATCH] fix incompatible pointer types using patch from https://github.com/php/pecl-processing-rrd/pull/4 build out of sources tree --- php-pecl-rrd.spec | 63 ++++++++++++++++++++++++++++------------------- rrd-build.patch | 31 +++++++++++++++++++++++ 2 files changed, 69 insertions(+), 25 deletions(-) create mode 100644 rrd-build.patch diff --git a/php-pecl-rrd.spec b/php-pecl-rrd.spec index e54b6aa..0949d8c 100644 --- a/php-pecl-rrd.spec +++ b/php-pecl-rrd.spec @@ -1,6 +1,6 @@ # remirepo/fedora spec file for php-pecl-rrd # -# Copyright (c) 2011-2023 Remi Collet +# Copyright (c) 2011-2024 Remi Collet # License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -10,9 +10,11 @@ # we don't want -z defs linker flag %undefine _strict_symbol_defs_build -%global with_zts 0%{?__ztsphp:1} -%global pecl_name rrd -%global ini_name 40-%{pecl_name}.ini +%global with_zts 0%{?__ztsphp:1} +%global pecl_name rrd +%global ini_name 40-%{pecl_name}.ini +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure Summary: PHP Bindings for rrdtool Name: php-pecl-rrd @@ -21,7 +23,9 @@ Release: 12%{?dist} License: BSD-2-Clause URL: https://pecl.php.net/package/rrd -Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Source0: https://pecl.php.net/get/%{sources}.tgz + +Patch0: %{pecl_name}-build.patch BuildRequires: make BuildRequires: gcc @@ -48,14 +52,14 @@ system for time series data. %prep %setup -c -q -mv %{pecl_name}-%{version} NTS - # Don't install/register tests sed -e 's/role="test"/role="src"/' \ -e '/LICENSE/s/role="doc"/role="src"/' \ -i package.xml -cd NTS +cd %{sources} +%patch -P0 -p1 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_RRD_VERSION/{s/.* "//;s/".*$//;p}' php_rrd.h) if test "x${extver}" != "x%{version}%{?prever}"; then @@ -69,21 +73,23 @@ cat > %{ini_name} << 'EOF' extension=%{pecl_name}.so EOF +mkdir NTS %if %{with_zts} -cp -r NTS ZTS +mkdir ZTS %endif %build -cd NTS -%{_bindir}/phpize -%configure --with-php-config=%{_bindir}/php-config +cd %{sources} +%{__phpize} + +cd ../NTS +%configure --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize -%configure --with-php-config=%{_bindir}/zts-php-config +%configure --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -104,24 +110,25 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} # Test & Documentation for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done %check %if %{with_zts} %{__ztsphp} --no-php-ini \ - --define extension=ZTS/modules/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' %endif -cd NTS %{__php} --no-php-ini \ - --define extension=modules/%{pecl_name}.so \ - --modules | grep %{pecl_name} + --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' # See https://bugzilla.redhat.com/1224530 - segfault on ARM %ifnarch %{arm} s390x +cd %{sources} + if pkg-config librrd --atleast-version=1.5.0 then : ignore test failed with rrdtool > 1.5 @@ -133,19 +140,20 @@ then rm tests/rrd_{012,017}.phpt fi +cp ../NTS/tests/data/Makefile tests/data +cp ../NTS/tests/rrdtool-bin.inc tests make -C tests/data clean make -C tests/data all -TEST_PHP_EXECUTABLE=%{_bindir}/php \ -TEST_PHP_ARGS="-n -d extension_dir= -d extension=$PWD/modules/%{pecl_name}.so" \ -NO_INTERACTION=1 \ +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=%{buildroot}%{php_extdir}/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{_bindir}/php -n run-tests.php --show-diff +%{__php} -n run-tests.php -q --show-diff %endif %files -%license NTS/LICENSE +%license %{sources}/LICENSE %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml @@ -159,6 +167,11 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Mon Jan 29 2024 Remi Collet - 2.0.3-12 +- fix incompatible pointer types using patch from + https://github.com/php/pecl-processing-rrd/pull/4 +- build out of sources tree + * Thu Jan 25 2024 Fedora Release Engineering - 2.0.3-12 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild diff --git a/rrd-build.patch b/rrd-build.patch new file mode 100644 index 0000000..d19d96f --- /dev/null +++ b/rrd-build.patch @@ -0,0 +1,31 @@ +From 7d36350f6398a2c4504c87db7128ef3ce47145d3 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 29 Jan 2024 14:12:23 +0100 +Subject: [PATCH] Fix incompatible pointer types + +--- + rrd.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/rrd.c b/rrd.c +index 526f094..ab19b41 100644 +--- a/rrd.c ++++ b/rrd.c +@@ -55,7 +55,7 @@ PHP_FUNCTION(rrd_fetch) + rrd_args *argv; + /* returned values if rrd_fetch doesn't fail */ + time_t start, end; +- zend_ulong step, ++ unsigned long step, + ds_cnt; /* count of data sources */ + char **ds_namv; /* list of data source names */ + rrd_value_t *ds_data; /* all data from all sources */ +@@ -396,7 +396,7 @@ PHP_FUNCTION(rrd_xport) + /* return values from rrd_xport */ + int xxsize; + time_t start, end, time_index; +- zend_ulong step, outvar_count; ++ unsigned long step, outvar_count; + char **legend_v; + rrd_value_t *data, *data_ptr; + zval zv_data;