From 8cbd21ecee1febc6b8e17da3ce04b408e108fc94 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Fri, 11 Jun 2021 09:01:11 +0200
Subject: add upstream patch for PHP 8.1

---
 geoip-php8.patch    | 16 ++++++++++++--
 geoip-php81.patch   | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 php-pecl-geoip.spec | 20 +++++++++--------
 3 files changed, 88 insertions(+), 11 deletions(-)
 create mode 100644 geoip-php81.patch

diff --git a/geoip-php8.patch b/geoip-php8.patch
index 5de99f6..27e2eb2 100644
--- a/geoip-php8.patch
+++ b/geoip-php8.patch
@@ -1,5 +1,17 @@
---- pecl/geoip/trunk/geoip.c	2020/10/30 12:04:28	351081
-+++ pecl/geoip/trunk/geoip.c	2020/10/30 12:51:07	351082
+From 4f7c46c98eadc7bae9cc39c942ee626ecae7539e Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@php.net>
+Date: Fri, 30 Oct 2020 12:51:07 +0000
+Subject: [PATCH] add arginfo and fix build with PHP 8
+
+git-svn-id: http://svn.php.net/repository/pecl/geoip/trunk@351082 c90b9560-bf6c-de11-be94-00142212c4b1
+---
+ geoip.c | 67 +++++++++++++++++++++++++++++++++++++++++----------------
+ 1 file changed, 49 insertions(+), 18 deletions(-)
+
+diff --git a/geoip.c b/geoip.c
+index ff8ed30..3e41a9d 100644
+--- a/geoip.c
++++ b/geoip.c
 @@ -34,41 +34,72 @@
  #include "ext/standard/info.h"
  #include "php_geoip.h"
diff --git a/geoip-php81.patch b/geoip-php81.patch
new file mode 100644
index 0000000..18c4769
--- /dev/null
+++ b/geoip-php81.patch
@@ -0,0 +1,63 @@
+From e24c5e54098958a1acc65b8830bc245c7d0662e6 Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@php.net>
+Date: Fri, 11 Jun 2021 08:54:44 +0200
+Subject: [PATCH] don't test NULL raising deprecation in 8.1 (and will be
+ removed later)
+
+---
+ tests/014.phpt | 8 ++------
+ tests/016.phpt | 8 --------
+ 2 files changed, 2 insertions(+), 14 deletions(-)
+
+diff --git a/tests/014.phpt b/tests/014.phpt
+index 40f3ef8..93bc1f7 100644
+--- a/tests/014.phpt
++++ b/tests/014.phpt
+@@ -8,10 +8,9 @@ Checking timezone info with (some) empty fields
+ <?php
+ 
+ var_dump(geoip_time_zone_by_country_and_region('US','MA'));
+-var_dump(geoip_time_zone_by_country_and_region('US',NULL));
++var_dump(geoip_time_zone_by_country_and_region('US',''));
+ var_dump(geoip_time_zone_by_country_and_region('DE'));
+-var_dump(geoip_time_zone_by_country_and_region(NULL,''));
+-var_dump(geoip_time_zone_by_country_and_region(NULL,NULL));
++var_dump(geoip_time_zone_by_country_and_region('',''));
+ 
+ ?>
+ --EXPECTF--
+@@ -21,6 +20,3 @@ string(%d) "Europe/%s"
+ 
+ Warning: geoip_time_zone_by_country_and_region(): You need to specify at least the country code. in %s on line %d
+ bool(false)
+-
+-Warning: geoip_time_zone_by_country_and_region(): You need to specify at least the country code. in %s on line %d
+-bool(false)
+diff --git a/tests/016.phpt b/tests/016.phpt
+index 83c5250..9b2f056 100644
+--- a/tests/016.phpt
++++ b/tests/016.phpt
+@@ -8,10 +8,8 @@ Checking geoip_region_name_by_code with (some) empty fields
+ <?php
+ 
+ var_dump(geoip_region_name_by_code('CA',''));
+-var_dump(geoip_region_name_by_code('CA',NULL));
+ var_dump(geoip_region_name_by_code('CA',1));
+ var_dump(geoip_region_name_by_code('','QC'));
+-var_dump(geoip_region_name_by_code(NULL,'QC'));
+ var_dump(geoip_region_name_by_code(1,'QC'));
+ 
+ ?>
+@@ -19,12 +17,6 @@ var_dump(geoip_region_name_by_code(1,'QC'));
+ 
+ Warning: geoip_region_name_by_code(): You need to specify the country and region codes. in %s on line %d
+ bool(false)
+-
+-Warning: geoip_region_name_by_code(): You need to specify the country and region codes. in %s on line %d
+-bool(false)
+-bool(false)
+-
+-Warning: geoip_region_name_by_code(): You need to specify the country and region codes. in %s on line %d
+ bool(false)
+ 
+ Warning: geoip_region_name_by_code(): You need to specify the country and region codes. in %s on line %d
diff --git a/php-pecl-geoip.spec b/php-pecl-geoip.spec
index 4d1bb5a..651239e 100644
--- a/php-pecl-geoip.spec
+++ b/php-pecl-geoip.spec
@@ -24,16 +24,17 @@
 
 Name:           %{?sub_prefix}php-pecl-geoip
 Version:        1.1.1
-Release:        14%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release:        15%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
 Summary:        Extension to map IP addresses to geographic places
 License:        PHP
 URL:            https://pecl.php.net/package/%{pecl_name}
 Source0:        https://pecl.php.net/get/%{pecl_name}-%{version}.tgz
 
-# Upstream patch for PHP 8
-# https://svn.php.net/viewvc?view=revision&revision=351082
+# Upstream patches
 Patch0:         %{pecl_name}-php8.patch
+Patch1:         %{pecl_name}-php81.patch
 
+BuildRequires:  make
 BuildRequires:  %{?dtsprefix}gcc
 BuildRequires:  GeoIP-devel
 BuildRequires:  %{?scl_prefix}php-devel
@@ -86,12 +87,9 @@ Obsoletes:      php74-pecl-%{pecl_name} <= %{version}
 %if "%{php_version}" > "8.0"
 Obsoletes:      php80-pecl-%{pecl_name} <= %{version}
 %endif
+%if "%{php_version}" > "8.1"
+Obsoletes:      php81-pecl-%{pecl_name} <= %{version}
 %endif
-
-%if 0%{?fedora} < 20 && 0%{?rhel} < 7
-# Filter shared private
-%{?filter_provides_in: %filter_provides_in %{_libdir}/.*\.so$}
-%{?filter_setup}
 %endif
 
 
@@ -115,7 +113,8 @@ sed -e 's/role="test"/role="src"/' \
 mv %{pecl_name}-%{version} NTS
 
 cd NTS
-%patch0 -p3 -b .up
+%patch0 -p1 -b .php8
+%patch1 -p1 -b .php81
 
 extver=$(sed -n '/#define PHP_GEOIP_VERSION/{s/.* "//;s/".*$//;p}' php_geoip.h)
 if test "x${extver}" != "x%{version}"; then
@@ -234,6 +233,9 @@ fi
 
 
 %changelog
+* Fri Jun 11 2021 Remi Collet <remi@remirepo.net> - 1.1.1-15
+- add upstream patch for PHP 8.1
+
 * Fri Oct 30 2020 Remi Collet <remi@remirepo.net> - 1.1.1-14
 - add upstream patch for PHP 8
 
-- 
cgit