From ac6c3fa875d5cef523bc40a029ce06eff09da4d6 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 30 Oct 2020 14:05:49 +0100 Subject: add upstream patch for PHP 8 --- .gitignore | 2 ++ PHPINFO | 9 ++++++ REFLECTION | 34 ++++++++++---------- geoip-php8.patch | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++ php-pecl-geoip.spec | 25 +++++++++----- 5 files changed, 138 insertions(+), 25 deletions(-) create mode 100644 PHPINFO create mode 100644 geoip-php8.patch diff --git a/.gitignore b/.gitignore index 1ab5c4f..01f0400 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ +clog package-*.xml *.tgz +*.tar.bz2 *.tar.gz *.tar.xz *.tar.xz.asc diff --git a/PHPINFO b/PHPINFO new file mode 100644 index 0000000..1910da2 --- /dev/null +++ b/PHPINFO @@ -0,0 +1,9 @@ + +geoip + +geoip support => enabled +geoip extension version => 1.1.1 +geoip library version => 1005000 + +Directive => Local Value => Master Value +geoip.custom_directory => no value => no value diff --git a/REFLECTION b/REFLECTION index 43b44aa..605e972 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #84 geoip version 1.1.1 ] { +Extension [ extension #117 geoip version 1.1.1 ] { - INI { Entry [ geoip.custom_directory ] @@ -7,22 +7,22 @@ Extension [ extension #84 geoip version 1.1.1 ] { } - Constants [16] { - Constant [ integer GEOIP_COUNTRY_EDITION ] { 1 } - Constant [ integer GEOIP_REGION_EDITION_REV0 ] { 7 } - Constant [ integer GEOIP_CITY_EDITION_REV0 ] { 6 } - Constant [ integer GEOIP_ORG_EDITION ] { 5 } - Constant [ integer GEOIP_ISP_EDITION ] { 4 } - Constant [ integer GEOIP_CITY_EDITION_REV1 ] { 2 } - Constant [ integer GEOIP_REGION_EDITION_REV1 ] { 3 } - Constant [ integer GEOIP_PROXY_EDITION ] { 8 } - Constant [ integer GEOIP_ASNUM_EDITION ] { 9 } - Constant [ integer GEOIP_NETSPEED_EDITION ] { 10 } - Constant [ integer GEOIP_DOMAIN_EDITION ] { 11 } - Constant [ integer GEOIP_NETSPEED_EDITION_REV1 ] { 32 } - Constant [ integer GEOIP_UNKNOWN_SPEED ] { 0 } - Constant [ integer GEOIP_DIALUP_SPEED ] { 1 } - Constant [ integer GEOIP_CABLEDSL_SPEED ] { 2 } - Constant [ integer GEOIP_CORPORATE_SPEED ] { 3 } + Constant [ int GEOIP_COUNTRY_EDITION ] { 1 } + Constant [ int GEOIP_REGION_EDITION_REV0 ] { 7 } + Constant [ int GEOIP_CITY_EDITION_REV0 ] { 6 } + Constant [ int GEOIP_ORG_EDITION ] { 5 } + Constant [ int GEOIP_ISP_EDITION ] { 4 } + Constant [ int GEOIP_CITY_EDITION_REV1 ] { 2 } + Constant [ int GEOIP_REGION_EDITION_REV1 ] { 3 } + Constant [ int GEOIP_PROXY_EDITION ] { 8 } + Constant [ int GEOIP_ASNUM_EDITION ] { 9 } + Constant [ int GEOIP_NETSPEED_EDITION ] { 10 } + Constant [ int GEOIP_DOMAIN_EDITION ] { 11 } + Constant [ int GEOIP_NETSPEED_EDITION_REV1 ] { 32 } + Constant [ int GEOIP_UNKNOWN_SPEED ] { 0 } + Constant [ int GEOIP_DIALUP_SPEED ] { 1 } + Constant [ int GEOIP_CABLEDSL_SPEED ] { 2 } + Constant [ int GEOIP_CORPORATE_SPEED ] { 3 } } - Functions { diff --git a/geoip-php8.patch b/geoip-php8.patch new file mode 100644 index 0000000..5de99f6 --- /dev/null +++ b/geoip-php8.patch @@ -0,0 +1,93 @@ +--- pecl/geoip/trunk/geoip.c 2020/10/30 12:04:28 351081 ++++ pecl/geoip/trunk/geoip.c 2020/10/30 12:51:07 351082 +@@ -34,41 +34,72 @@ + #include "ext/standard/info.h" + #include "php_geoip.h" + +- ++/* For PHP 8 */ ++#ifndef TSRMLS_CC ++#define TSRMLS_CC ++#endif + + ZEND_DECLARE_MODULE_GLOBALS(geoip) + ++ZEND_BEGIN_ARG_INFO_EX(arginfo_geoip_void, 0, 0, 0) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_geoip_database_opt, 0, 0, 0) ++ ZEND_ARG_INFO(0, database) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_geoip_database, 0, 0, 1) ++ ZEND_ARG_INFO(0, database) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_geoip_host, 0, 0, 1) ++ ZEND_ARG_INFO(0, host) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_geoip_region, 0, 0, 2) ++ ZEND_ARG_INFO(0, country_code) ++ ZEND_ARG_INFO(0, region_code) ++ZEND_END_ARG_INFO() ++ ++ZEND_BEGIN_ARG_INFO_EX(arginfo_geoip_directory, 0, 0, 1) ++ ZEND_ARG_INFO(0, directory) ++ZEND_END_ARG_INFO() ++ + static int le_geoip; + + /* {{{ */ + zend_function_entry geoip_functions[] = { +- PHP_FE(geoip_database_info, NULL) ++ PHP_FE(geoip_database_info, arginfo_geoip_database_opt) + #define GEOIPDEF(php_func, c_func, db_type) \ +- PHP_FE(php_func, NULL) ++ PHP_FE(php_func, arginfo_geoip_host) + #include "geoip.def" + #undef GEOIPDEF +- PHP_FE(geoip_continent_code_by_name, NULL) +- PHP_FE(geoip_org_by_name, NULL) +- PHP_FE(geoip_record_by_name, NULL) +- PHP_FE(geoip_id_by_name, NULL) +- PHP_FE(geoip_region_by_name, NULL) +- PHP_FE(geoip_isp_by_name, NULL) +- PHP_FE(geoip_db_avail, NULL) +- PHP_FE(geoip_db_get_all_info, NULL) +- PHP_FE(geoip_db_filename, NULL) ++ PHP_FE(geoip_continent_code_by_name, arginfo_geoip_host) ++ PHP_FE(geoip_org_by_name, arginfo_geoip_host) ++ PHP_FE(geoip_record_by_name, arginfo_geoip_host) ++ PHP_FE(geoip_id_by_name, arginfo_geoip_host) ++ PHP_FE(geoip_region_by_name, arginfo_geoip_host) ++ PHP_FE(geoip_isp_by_name, arginfo_geoip_host) ++ PHP_FE(geoip_db_avail, arginfo_geoip_database) ++ PHP_FE(geoip_db_get_all_info, arginfo_geoip_void) ++ PHP_FE(geoip_db_filename, arginfo_geoip_database) + #if LIBGEOIP_VERSION >= 1004001 +- PHP_FE(geoip_region_name_by_code, NULL) +- PHP_FE(geoip_time_zone_by_country_and_region, NULL) ++ PHP_FE(geoip_region_name_by_code, arginfo_geoip_region) ++ PHP_FE(geoip_time_zone_by_country_and_region, arginfo_geoip_region) + #endif + #ifdef HAVE_CUSTOM_DIRECTORY +- PHP_FE(geoip_setup_custom_directory, NULL) ++ PHP_FE(geoip_setup_custom_directory, arginfo_geoip_directory) + #endif +- PHP_FE(geoip_asnum_by_name, NULL) +- PHP_FE(geoip_domain_by_name, NULL) ++ PHP_FE(geoip_asnum_by_name, arginfo_geoip_host) ++ PHP_FE(geoip_domain_by_name, arginfo_geoip_host) + #if LIBGEOIP_VERSION >= 1004008 +- PHP_FE(geoip_netspeedcell_by_name, NULL) ++ PHP_FE(geoip_netspeedcell_by_name, arginfo_geoip_host) + #endif ++#ifdef PHP_FE_END ++ PHP_FE_END ++#else + {NULL, NULL, NULL} ++#endif + }; + /* }}} */ + diff --git a/php-pecl-geoip.spec b/php-pecl-geoip.spec index a30991a..4d1bb5a 100644 --- a/php-pecl-geoip.spec +++ b/php-pecl-geoip.spec @@ -13,7 +13,7 @@ %scl_package php-pecl-geoip %endif -%define pecl_name geoip +%global pecl_name geoip %global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} %if "%{php_version}" < "5.6" %global ini_name %{pecl_name}.ini @@ -24,11 +24,15 @@ Name: %{?sub_prefix}php-pecl-geoip Version: 1.1.1 -Release: 11%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +Release: 14%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} Summary: Extension to map IP addresses to geographic places License: PHP -URL: http://pecl.php.net/package/%{pecl_name} -Source0: http://pecl.php.net/get/%{pecl_name}-%{version}.tgz +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 +Patch0: %{pecl_name}-php8.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: GeoIP-devel @@ -48,12 +52,11 @@ Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{rele Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} %endif -%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} +%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} # Other third party repo stuff Obsoletes: php53-pecl-%{pecl_name} <= %{version} Obsoletes: php53u-pecl-%{pecl_name} <= %{version} Obsoletes: php54-pecl-%{pecl_name} <= %{version} -Obsoletes: php54w-pecl-%{pecl_name} <= %{version} %if "%{php_version}" > "5.5" Obsoletes: php55u-pecl-%{pecl_name} <= %{version} Obsoletes: php55w-pecl-%{pecl_name} <= %{version} @@ -76,11 +79,12 @@ Obsoletes: php72w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.3" Obsoletes: php73-pecl-%{pecl_name} <= %{version} -Obsoletes: php73w-pecl-%{pecl_name} <= %{version} %endif %if "%{php_version}" > "7.4" Obsoletes: php74-pecl-%{pecl_name} <= %{version} -Obsoletes: php74w-pecl-%{pecl_name} <= %{version} +%endif +%if "%{php_version}" > "8.0" +Obsoletes: php80-pecl-%{pecl_name} <= %{version} %endif %endif @@ -111,6 +115,8 @@ sed -e 's/role="test"/role="src"/' \ mv %{pecl_name}-%{version} NTS cd NTS +%patch0 -p3 -b .up + extver=$(sed -n '/#define PHP_GEOIP_VERSION/{s/.* "//;s/".*$//;p}' php_geoip.h) if test "x${extver}" != "x%{version}"; then : Error: Upstream version is ${extver}, expecting %{version}. @@ -228,6 +234,9 @@ fi %changelog +* Fri Oct 30 2020 Remi Collet - 1.1.1-14 +- add upstream patch for PHP 8 + * Tue Sep 03 2019 Remi Collet - 1.1.1-11 - rebuild for 7.4.0RC1 -- cgit