summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2023-07-12 09:34:53 +0200
committerRemi Collet <remi@php.net>2023-07-12 09:34:53 +0200
commitd1cbd173944bbba55b92de019b01760746a67f78 (patch)
tree093377c6d0c99feef13304e2715bd012763ce395
parent9962481fc712894379c909cef442cbf917c148a2 (diff)
build out of sources tree
add upstream patch for PHP 8.3
-rw-r--r--0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch44
-rw-r--r--php-pecl-ds.spec62
2 files changed, 70 insertions, 36 deletions
diff --git a/0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch b/0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch
new file mode 100644
index 0000000..56f2bd9
--- /dev/null
+++ b/0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch
@@ -0,0 +1,44 @@
+From d6ad43ee713b4b57111462309358c97e0b43cab3 Mon Sep 17 00:00:00 2001
+From: Jan Ehrhardt <github@ehrhardt.nl>
+Date: Sun, 18 Jun 2023 01:48:54 +0200
+Subject: [PATCH] fast_add_function removed in PHP 8.3, use add_function
+
+---
+ src/common.h | 14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+diff --git a/src/common.h b/src/common.h
+index 5ff8cd4..509a6bb 100644
+--- a/src/common.h
++++ b/src/common.h
+@@ -84,6 +84,7 @@ do { \
+ /**
+ * Adds the given zval "val" to "sum".
+ */
++#if PHP_MAJOR_VERSION < 8 || PHP_MAJOR_VERSION == 8 && PHP_MINOR_VERSION < 3
+ #define DS_ADD_TO_SUM(val, sum) \
+ do { \
+ if (Z_TYPE_P(val) == IS_LONG || Z_TYPE_P(val) == IS_DOUBLE) { \
+@@ -95,6 +96,19 @@ do { \
+ fast_add_function(sum, sum, &_num); \
+ } \
+ } while (0)
++#else
++#define DS_ADD_TO_SUM(val, sum) \
++do { \
++ if (Z_TYPE_P(val) == IS_LONG || Z_TYPE_P(val) == IS_DOUBLE) { \
++ add_function(sum, sum, val); \
++ } else { \
++ zval _num; \
++ ZVAL_COPY(&_num, val); \
++ convert_scalar_to_number(&_num); \
++ add_function(sum, sum, &_num); \
++ } \
++} while (0)
++#endif
+
+ /**
+ * Used to replace a buffer with a new one.
+--
+2.41.0
+
diff --git a/php-pecl-ds.spec b/php-pecl-ds.spec
index 4c3e87d..ff20467 100644
--- a/php-pecl-ds.spec
+++ b/php-pecl-ds.spec
@@ -1,18 +1,14 @@
# remirepo spec file for php-pecl-ds
#
-# Copyright (c) 2016-2021 Remi Collet
-# License: CC-BY-SA
+# Copyright (c) 2016-2023 Remi Collet
+# License: CC-BY-SA-4.0
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
-# we don't want -z defs linker flag
-%undefine _strict_symbol_defs_build
-
%if 0%{?scl:1}
%scl_package php-pecl-ds
-%global sub_prefix %{scl_prefix}
# No phpunit in SCL
%bcond_with tests
%else
@@ -23,6 +19,8 @@
%global pecl_name ds
# After json
%global ini_name 40-%{pecl_name}.ini
+%global sources %{pecl_name}-%{version}
+%global _configure ../%{sources}/configure
# For test suite, see https://github.com/php-ds/tests/commits/master
%global gh_commit d4f0a9123a82764841d57aa59b2cf1172a413f1d
@@ -32,9 +30,9 @@
Summary: Data Structures for PHP
-Name: %{?sub_prefix}php-pecl-%{pecl_name}
+Name: %{?scl_prefix}php-pecl-%{pecl_name}
Version: 1.4.0
-Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
License: MIT
URL: https://pecl.php.net/package/%{pecl_name}
Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
@@ -42,6 +40,9 @@ Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
# in composer.json: "require-dev": { "php-ds/tests": "dev-master" }
Source1: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_project}-%{gh_short}.tar.gz
+# Upstream patch for 8.3
+Patch0: 0001-fast_add_function-removed-in-PHP-8.3-use-add_functio.patch
+
BuildRequires: make
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel >= 7.3
@@ -64,23 +65,6 @@ Provides: %{?scl_prefix}php-%{pecl_name} = %{version}
Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version}
Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version}
Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version}
-%if "%{?scl_prefix}" != "%{?sub_prefix}"
-Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release}
-Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release}
-%endif
-
-%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
-Obsoletes: php73-pecl-%{pecl_name} <= %{version}
-%if "%{php_version}" > "7.4"
-Obsoletes: php74-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "8.0"
-Obsoletes: php80-pecl-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "8.1"
-Obsoletes: php81-pecl-%{pecl_name} <= %{version}
-%endif
-%endif
%description
@@ -92,13 +76,14 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
%prep
%setup -q -c -a 1
-mv %{pecl_name}-%{version} NTS
mv %{gh_project}-%{gh_commit} tests
# Don't install/register tests, install examples as doc
%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml}
-cd NTS
+cd %{sources}
+%patch -P0 -p1 -b .up
+
# Sanity check, really often broken
extver=$(sed -n '/#define PHP_DS_VERSION/{s/.* "//;s/".*$//;p}' php_ds.h)
if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then
@@ -107,9 +92,9 @@ if test "x${extver}" != "x%{version}%{?prever:-%{prever}}"; then
fi
cd ..
+mkdir NTS
%if %{with_zts}
-# Duplicate source tree for NTS / ZTS build
-cp -pr NTS ZTS
+mkdir ZTS
%endif
# Create configuration file
@@ -130,14 +115,15 @@ peclbuild() {
make %{?_smp_mflags}
}
-cd NTS
-%{_bindir}/phpize
-peclbuild %{_bindir}/php-config
+cd %{sources}
+%{__phpize}
+
+cd ../NTS
+peclbuild %{__phpconfig}
%if %{with_zts}
cd ../ZTS
-%{_bindir}/zts-phpize
-peclbuild %{_bindir}/zts-php-config
+peclbuild %{__ztsphpconfig}
%endif
@@ -162,7 +148,7 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name}
# 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
@@ -220,7 +206,7 @@ fi
%files
-%{?_licensedir:%license NTS/LICENSE}
+%{?_licensedir:%license %{sources}/LICENSE}
%{!?_licensedir:%doc %{pecl_docdir}/%{pecl_name}}
%{pecl_xmldir}/%{name}.xml
@@ -234,6 +220,10 @@ fi
%changelog
+* Wed Jul 12 2023 Remi Collet <remi@remirepo.net> - 1.4.0-2
+- build out of sources tree
+- add upstream patch for PHP 8.3
+
* Tue Dec 14 2021 Remi Collet <remi@remirepo.net> - 1.4.0-1
- update to 1.4.0
- raise dependency on PHP 7.3