From f034aed4663459166e06ccaa98de93c716be92f5 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Wed, 19 Feb 2025 16:48:26 +0100
Subject: fix build with GCC 15 using patch from 4.x

fix build with GCC 15 using patch from 4.x
---
 pecl_http-proto.patch | 36 ++++++++++++++++++++++++++++++++++++
 php-pecl-http.spec    | 37 ++++++++++++-------------------------
 2 files changed, 48 insertions(+), 25 deletions(-)
 create mode 100644 pecl_http-proto.patch

diff --git a/pecl_http-proto.patch b/pecl_http-proto.patch
new file mode 100644
index 0000000..bfdf11a
--- /dev/null
+++ b/pecl_http-proto.patch
@@ -0,0 +1,36 @@
+From aa9b18e49f2c4e9033e6f32bc6af9cb11c44d332 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Thu, 23 Jan 2025 07:41:55 +0100
+Subject: [PATCH] fix incompatible pointer type
+
+---
+ src/php_http_client_curl.h       | 2 +-
+ src/php_http_client_curl_event.c | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/php_http_client_curl.h b/src/php_http_client_curl.h
+index 61723b9b..42feff70 100644
+--- a/src/php_http_client_curl.h
++++ b/src/php_http_client_curl.h
+@@ -25,7 +25,7 @@ typedef struct php_http_client_curl_handle {
+ } php_http_client_curl_handle_t;
+ 
+ typedef struct php_http_client_curl_ops {
+-	void *(*init)();
++	void *(*init)(php_http_client_t *client, void *user_data);
+ 	void (*dtor)(void **ctx_ptr);
+ 	ZEND_RESULT_CODE (*once)(void *ctx);
+ 	ZEND_RESULT_CODE (*wait)(void *ctx, struct timeval *custom_timeout);
+diff --git a/src/php_http_client_curl_event.c b/src/php_http_client_curl_event.c
+index 2e663ed7..b532e11f 100644
+--- a/src/php_http_client_curl_event.c
++++ b/src/php_http_client_curl_event.c
+@@ -242,7 +242,7 @@ static ZEND_RESULT_CODE php_http_client_curl_event_exec(void *context)
+ 	return SUCCESS;
+ }
+ 
+-static void *php_http_client_curl_event_init(php_http_client_t *client)
++static void *php_http_client_curl_event_init(php_http_client_t *client, void *user_data)
+ {
+ 	php_http_client_curl_t *curl = client->ctx;
+ 	php_http_client_curl_event_context_t *ctx;
diff --git a/php-pecl-http.spec b/php-pecl-http.spec
index aff65c6..a90bd76 100644
--- a/php-pecl-http.spec
+++ b/php-pecl-http.spec
@@ -3,7 +3,7 @@
 #
 # Fedora spec file for php-pecl-http
 #
-# Copyright (c) 2012-2024 Remi Collet
+# Copyright (c) 2012-2025 Remi Collet
 # License: CC-BY-SA-4.0
 # http://creativecommons.org/licenses/by-sa/4.0/
 #
@@ -41,7 +41,7 @@ Version:        %{upstream_version}%{?upstream_prever:~%{upstream_prever}}
 Release:        0.7.%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
 Source0:        https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{pecl_name}-%{version}-%{gh_short}.tar.gz
 %else
-Release:        3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release:        4%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
 Source0:        https://pecl.php.net/get/%{proj_name}-%{upstream_version}%{?upstream_prever}.tgz
 %endif
 Summary:        Extended HTTP support
@@ -52,6 +52,9 @@ URL:            https://pecl.php.net/package/pecl_http
 # From http://www.php.net/manual/en/http.configuration.php
 Source1:        %{proj_name}.ini
 
+# For GCC 15
+Patch0:         %{proj_name}-proto.patch
+
 BuildRequires:  %{?dtsprefix}gcc
 BuildRequires:  %{?scl_prefix}php-devel >= 7.0
 BuildRequires:  %{?scl_prefix}php-devel <  8
@@ -78,7 +81,6 @@ Requires:       %{?scl_prefix}php-spl%{?_isa}
 Requires:       %{?scl_prefix}php-pecl(propro)%{?_isa} >= 1.0.0
 Requires:       %{?scl_prefix}php-pecl(raphf)%{?_isa}  >= 1.1.0
 Obsoletes:      %{?scl_prefix}php-pecl-http1 < 2
-%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
 
 Provides:       %{?scl_prefix}php-pecl(%{proj_name})         = %{version}
 Provides:       %{?scl_prefix}php-pecl(%{proj_name})%{?_isa} = %{version}
@@ -124,9 +126,11 @@ mv NTS/package.xml .
 mv %{proj_name}-%{upstream_version}%{?upstream_prever} NTS
 %endif
 
-%{?_licensedir:sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml}
+sed -e '/LICENSE/s/role="doc"/role="src"/' -i package.xml
 
 cd NTS
+%patch -P0 -p1 -b .proto
+
 extver=$(sed -n '/#define PHP_PECL_HTTP_VERSION/{s/.* "//;s/".*$//;p}' php_http.h)
 if test "x${extver}" != "x%{upstream_version}%{?upstream_prever}%{?gh_date:dev}"; then
    : Error: Upstream HTTP version is now ${extver}, expecting %{upstream_version}%{?upstream_prever}%{?gh_date:dev}.
@@ -270,28 +274,8 @@ NO_INTERACTION=1 \
 %endif
 
 
-%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} %{proj_name} >/dev/null || :
-fi
-%endif
-
-
 %files
-%{?_licensedir:%license NTS/LICENSE}
+%license NTS/LICENSE
 %doc %{pecl_docdir}/%{proj_name}
 %config(noreplace) %{php_inidir}/%{ini_name}
 %{php_extdir}/%{pecl_name}.so
@@ -313,6 +297,9 @@ fi
 
 
 %changelog
+* Wed Feb 19 2025 Remi Collet <remi@remirepo.net> - 3.3.0-4
+- fix build with GCC 15 using patch from 4.x
+
 * Fri Nov 29 2024 Remi Collet <remi@remirepo.net> - 3.3.0-3
 - drop BuildRequires pcre-devel
 
-- 
cgit