summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--excimer-php84.patch57
-rw-r--r--php-pecl-excimer.spec34
2 files changed, 68 insertions, 23 deletions
diff --git a/excimer-php84.patch b/excimer-php84.patch
new file mode 100644
index 0000000..abd0c9b
--- /dev/null
+++ b/excimer-php84.patch
@@ -0,0 +1,57 @@
+From e8acb2fbd51ac72c848207babd516cd421284461 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 12 Jul 2024 08:56:55 +0200
+Subject: [PATCH 1/2] Fix header path for 8.4
+
+---
+ excimer.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/excimer.c b/excimer.c
+index 8e5df91..46dbdef 100644
+--- a/excimer.c
++++ b/excimer.c
+@@ -23,7 +23,11 @@
+ #include "zend_exceptions.h"
+ #include "zend_interfaces.h"
+ #include "ext/spl/spl_exceptions.h"
++#if PHP_VERSION_ID < 80400
+ #include "ext/standard/php_mt_rand.h"
++#else
++#include "ext/random/php_random.h"
++#endif
+ #include "ext/standard/info.h"
+
+ #if PHP_VERSION_ID < 70200
+
+From 8e7113956de192b6107198a118f8024e89234144 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Fri, 12 Jul 2024 08:57:21 +0200
+Subject: [PATCH 2/2] simply using php_mt_rand_range
+
+---
+ excimer.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/excimer.c b/excimer.c
+index 46dbdef..aee441e 100644
+--- a/excimer.c
++++ b/excimer.c
+@@ -621,7 +621,7 @@ static zend_object *ExcimerProfiler_new(zend_class_entry *ce) /* {{{ */
+ profiler->event_type = EXCIMER_REAL;
+
+ // Stagger start time
+- initial = php_mt_rand() * EXCIMER_DEFAULT_PERIOD / UINT32_MAX;
++ initial = php_mt_rand_range(0, EXCIMER_DEFAULT_PERIOD);
+ excimer_set_timespec(&profiler->initial, initial);
+ excimer_set_timespec(&profiler->period, EXCIMER_DEFAULT_PERIOD);
+ log_obj->log.period = EXCIMER_DEFAULT_PERIOD * EXCIMER_BILLION;
+@@ -670,7 +670,7 @@ static PHP_METHOD(ExcimerProfiler, setPeriod)
+ ZEND_PARSE_PARAMETERS_END();
+
+ // Stagger start time
+- initial = php_mt_rand() * period / UINT32_MAX;
++ initial = php_mt_rand_range(0, period);
+
+ excimer_set_timespec(&profiler->period, period);
+ excimer_set_timespec(&profiler->initial, initial);
diff --git a/php-pecl-excimer.spec b/php-pecl-excimer.spec
index 208db5d..e7e7570 100644
--- a/php-pecl-excimer.spec
+++ b/php-pecl-excimer.spec
@@ -21,11 +21,13 @@
Summary: Interrupting timer and low-overhead sampling profiler
Name: %{?scl_prefix}php-pecl-%{pecl_name}
Version: 1.2.1
-Release: 1%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
+Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}
License: Apache-2.0
URL: https://pecl.php.net/package/%{pecl_name}
Source0: https://pecl.php.net/get/%{sources}.tgz
+Patch0: %{pecl_name}-php84.patch
+
BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7.1
@@ -53,10 +55,12 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
# Don't install/register tests
sed -e 's/role="test"/role="src"/' \
- %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \
+ -e '/LICENSE/s/role="doc"/role="src"/' \
-i package.xml
cd %{sources}
+%patch -P0 -p1
+
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_EXCIMER_VERSION/{s/.* "//;s/".*$//;p}' php_excimer.h)
if test "x${extver}" != "x%{version}"; then
@@ -128,26 +132,6 @@ do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i
done
-%if 0%{?fedora} < 24 && 0%{?rhel} < 8
-# when pear installed alone, after us
-%triggerin -- %{?scl_prefix}php-pear
-if [ -x %{__pecl} ] ; then
- %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
-fi
-
-# posttrans as pear can be installed after us
-%posttrans
-if [ -x %{__pecl} ] ; then
- %{pecl_install} %{pecl_xmldir}/%{name}.xml >/dev/null || :
-fi
-
-%postun
-if [ $1 -eq 0 -a -x %{__pecl} ] ; then
- %{pecl_uninstall} %{pecl_name} >/dev/null || :
-fi
-%endif
-
-
%check
cd %{sources}
# erratic results, randomly fails in mock
@@ -184,7 +168,7 @@ TEST_PHP_ARGS="-n -d extension=%{buildroot}/%{php_ztsextdir}/%{pecl_name}.so" \
%files
-%{?_licensedir:%license %{sources}/LICENSE}
+%license %{sources}/LICENSE
%doc %{pecl_docdir}/%{pecl_name}
%{pecl_xmldir}/%{name}.xml
@@ -198,6 +182,10 @@ TEST_PHP_ARGS="-n -d extension=%{buildroot}/%{php_ztsextdir}/%{pecl_name}.so" \
%changelog
+* Fri Jul 12 2024 Remi Collet <remi@remirepo.net> - 1.2.1-2
+- add patch for PHP 8.4 from
+ https://github.com/wikimedia/mediawiki-php-excimer/pull/8
+
* Thu Feb 29 2024 Remi Collet <remi@remirepo.net> - 1.2.1-1
- update to 1.2.1