From 0e56f892ce7c3835d969479a6924a4f79204fc56 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 18 Nov 2020 14:48:26 +0100 Subject: add patch to improve configure output from https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/13 add patch for ip2location_bin_version in 8.3.1 from https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/15 --- 13.patch | 89 ++++++++++++++++++++++++++++++++++++++ 15.patch | 106 ++++++++++++++++++++++++++++++++++++++++++++++ PHPINFO | 2 +- REFLECTION | 7 ++- php-pecl-ip2location.spec | 16 ++++++- 5 files changed, 216 insertions(+), 4 deletions(-) create mode 100644 13.patch create mode 100644 15.patch diff --git a/13.patch b/13.patch new file mode 100644 index 0000000..8f04772 --- /dev/null +++ b/13.patch @@ -0,0 +1,89 @@ +From f3169d68045c7d1db9606856261774b459c0912a Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 8 Oct 2020 09:02:28 +0200 +Subject: [PATCH 1/2] always display where header is found + +--- + config.m4 | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/config.m4 b/config.m4 +index b8041bc..89d9eaa 100644 +--- a/config.m4 ++++ b/config.m4 +@@ -11,14 +11,13 @@ if test "$PHP_IP2LOCATION" != "no"; then + # --with-ip2location -> check with-path + SEARCH_PATH="/usr/local /usr /opt/local" + SEARCH_FOR="/include/IP2Location.h" ++ AC_MSG_CHECKING([for ip2location files in default path]) + if test -r $PHP_IP2LOCATION/$SEARCH_FOR; then + IP2LOCATION_DIR=$PHP_IP2LOCATION + else # search default path list +- AC_MSG_CHECKING([for ip2location files in default path]) + for i in $SEARCH_PATH ; do + if test -r $i/$SEARCH_FOR; then + IP2LOCATION_DIR=$i +- AC_MSG_RESULT([found in $i]) + fi + done + fi +@@ -26,6 +25,8 @@ if test "$PHP_IP2LOCATION" != "no"; then + if test -z "$IP2LOCATION_DIR"; then + AC_MSG_RESULT([not found]) + AC_MSG_ERROR([Please reinstall the ip2location C library]) ++ else ++ AC_MSG_RESULT([found in $IP2LOCATION_DIR]) + fi + + # --with-ip2location -> add include path + +From 174847db69b9806cf501038814fc8ff852845ff7 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Thu, 8 Oct 2020 09:02:51 +0200 +Subject: [PATCH 2/2] don't track build artefacts + +--- + .gitignore | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + create mode 100644 .gitignore + +diff --git a/.gitignore b/.gitignore +new file mode 100644 +index 0000000..aa304ab +--- /dev/null ++++ b/.gitignore +@@ -0,0 +1,34 @@ ++*.lo ++.deps ++.libs/ ++.*.swp ++Makefile ++Makefile.fragments ++Makefile.global ++Makefile.objects ++acinclude.m4 ++aclocal.m4 ++autom4te.cache/ ++build/ ++config.guess ++config.h ++config.h.in ++config.h.in~ ++config.log ++config.nice ++config.status ++config.sub ++configure ++configure.in ++configure.ac ++data/.libs/ ++install-sh ++libtool ++ltmain.sh ++ltmain.sh.backup ++missing ++mkinstalldirs ++modules/ ++run-tests.php ++run-tests.sh ++*.la diff --git a/15.patch b/15.patch new file mode 100644 index 0000000..ca21ec9 --- /dev/null +++ b/15.patch @@ -0,0 +1,106 @@ +From 8a24f22087beca64a579fb4685f7ead92ccb535f Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 30 Oct 2020 10:05:59 +0100 +Subject: [PATCH] add ip2location_bin_version from library version 8.3.0 + +--- + ip2location.c | 30 ++++++++++++++++++++++++++++-- + php_ip2location.h | 3 +++ + tests/file.phpt | 2 ++ + 3 files changed, 33 insertions(+), 2 deletions(-) + +diff --git a/ip2location.c b/ip2location.c +index 198410a..e849e52 100644 +--- a/ip2location.c ++++ b/ip2location.c +@@ -76,6 +76,9 @@ static zend_function_entry ip2location_functions_entry[] = { + PHP_FE(ip2location_get_all, ip2location_ip_address) + PHP_FE(ip2location_close, ip2location_void) + PHP_FE(ip2location_delete_shm, ip2location_void) ++#if API_VERSION_NUMERIC >= 80300 ++ PHP_FE(ip2location_bin_version, ip2location_void) ++#endif + #ifdef PHP_FE_END + PHP_FE_END + #else +@@ -805,7 +808,7 @@ PHP_FUNCTION(ip2location_get_all) + * Returns the record information */ + PHP_FUNCTION(ip2location_close) + { +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") != SUCCESS) { ++ if (zend_parse_parameters_none() != SUCCESS) { + return; + } + if (IP2LOCATION_G(ip2location_ptr)) { +@@ -819,7 +822,7 @@ PHP_FUNCTION(ip2location_close) + * Returns nothing */ + PHP_FUNCTION(ip2location_delete_shm) + { +- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "") != SUCCESS) { ++ if (zend_parse_parameters_none() != SUCCESS) { + return; + } + #if API_VERSION_NUMERIC >= 80100 +@@ -830,6 +833,29 @@ PHP_FUNCTION(ip2location_delete_shm) + } + /* }}} */ + ++#if API_VERSION_NUMERIC >= 80300 ++/* {{{ ip2location_open_mem() ++ * Returns the version */ ++PHP_FUNCTION(ip2location_bin_version) ++{ ++ char *version; ++ ++ if (zend_parse_parameters_none() != SUCCESS) { ++ return; ++ } ++ ++ PHP_IP2LOCATION_DB_CHECK; ++ version = IP2Location_bin_version(IP2LOCATION_G(ip2location_ptr)); ++ ++#if PHP_MAJOR_VERSION >= 7 ++ RETVAL_STRING(version); ++#else ++ RETVAL_STRING(version, 1); ++#endif ++} ++/* }}} */ ++#endif ++ + /* + * Local variables: + * tab-width: 4 +diff --git a/php_ip2location.h b/php_ip2location.h +index f055009..37ec987 100644 +--- a/php_ip2location.h ++++ b/php_ip2location.h +@@ -64,6 +64,9 @@ PHP_FUNCTION(ip2location_get_usagetype); + PHP_FUNCTION(ip2location_get_all); + PHP_FUNCTION(ip2location_close); + PHP_FUNCTION(ip2location_delete_shm); ++#if API_VERSION_NUMERIC >= 80300 ++PHP_FUNCTION(ip2location_bin_version); ++#endif + + ZEND_BEGIN_MODULE_GLOBALS(ip2location) + IP2Location *ip2location_ptr; +diff --git a/tests/file.phpt b/tests/file.phpt +index 6b6bc4c..6c9a4f5 100644 +--- a/tests/file.phpt ++++ b/tests/file.phpt +@@ -11,6 +11,7 @@ var_dump(ip2location_open(__DIR__ . '/IP-COUNTRY-SAMPLE.BIN')); + var_dump(ip2location_open_mem(IP2LOCATION_FILE_IO)); + var_dump(ip2location_get_country_short('25.5.10.2')); + var_dump(ip2location_get_country_long('25.5.10.2')); ++var_dump(ip2location_bin_version()); + var_dump(ip2location_close()); + ?> + Done +@@ -19,5 +20,6 @@ bool(true) + bool(true) + string(2) "UK" + string(14) "UNITED KINGDOM" ++string(9) "2013-4-11" + NULL + Done diff --git a/PHPINFO b/PHPINFO index c31a827..13ef579 100644 --- a/PHPINFO +++ b/PHPINFO @@ -3,4 +3,4 @@ ip2location ip2location support => enabled extension version => 8.0.1 -library version => 8.2.0 +library version => 8.3.1 diff --git a/REFLECTION b/REFLECTION index 5cf839f..6b1b69e 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #116 ip2location version 8.0.1 ] { +Extension [ extension #78 ip2location version 8.0.1 ] { - Constants [4] { Constant [ int IP2LOCATION_FILE_IO ] { 0 } @@ -153,6 +153,11 @@ Extension [ extension #116 ip2location version 8.0.1 ] { } Function [ function ip2location_delete_shm ] { + - Parameters [0] { + } + } + Function [ function ip2location_bin_version ] { + - Parameters [0] { } } diff --git a/php-pecl-ip2location.spec b/php-pecl-ip2location.spec index 6a229bd..4a93acd 100644 --- a/php-pecl-ip2location.spec +++ b/php-pecl-ip2location.spec @@ -26,7 +26,7 @@ Summary: Get geo location information of an IP address Name: %{?sub_prefix}php-pecl-%{pecl_name} License: PHP Version: %{upstream_version}%{?upstream_prever:~%{upstream_prever}} -Release: 10%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +Release: 11%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} URL: https://pecl.php.net/package/%{pecl_name} Source0: https://pecl.php.net/get/%{pecl_name}-%{upstream_version}%{?upstream_prever}.tgz @@ -42,6 +42,10 @@ Patch3: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Loc Patch4: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Location-PECL-Extension/pull/11.patch # https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/12 - library 8.1.4 Patch5: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Location-PECL-Extension/pull/12.patch +# https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/13 - config +Patch6: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Location-PECL-Extension/pull/13.patch +# https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/15 - ip2location_bin_version +Patch7: https://patch-diff.githubusercontent.com/raw/chrislim2888/IP2Location-PECL-Extension/pull/15.patch BuildRequires: %{?dtsprefix}gcc BuildRequires: %{?scl_prefix}php-pear @@ -104,7 +108,7 @@ sed -e 's/role="test"/role="src"/' \ -i package.xml cd NTS -sed -e "s/\r//" -i LICENSE CREDITS README +sed -e "s/\r//" -i LICENSE CREDITS README *.c *.h chmod -x *.c *.h LICENSE CREDITS README : Patches @@ -116,6 +120,8 @@ sed -e "s/\r//" -i *.c config.m4 %patch3 -p1 -b .pr10 %patch4 -p1 -b .pr11 %patch5 -p1 -b .pr12 +%patch6 -p1 -b .pr13 +%patch7 -p1 -b .pr15 # Check version extver=$(sed -n '/#define PHP_IP2LOCATION_VERSION/{s/.* "//;s/".*$//;p}' php_ip2location.h) @@ -237,6 +243,12 @@ fi %changelog +* Wed Nov 18 2020 Remi Collet - 8.0.1-11 +- add patch to improve configure output from + https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/13 +- add patch for ip2location_bin_version in 8.3.1 from + https://github.com/chrislim2888/IP2Location-PECL-Extension/pull/15 + * Sat Oct 17 2020 Remi Collet - 8.0.1-10 - rebuild against library 8.2.0 in Fedora/EPEL -- cgit