From 122edc9ae0bfe968947801e1ff5c931bbf52c5c8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 21 Nov 2018 07:25:25 +0100 Subject: update to 1.4.0 open https://github.com/maxmind/MaxMind-DB-Reader-php/issues/79 to report test failure on 32-bit --- 4b3e00c2b4f33124dbc2cf94f472c66d5c44b4cc.patch | 29 ------------ 73320ff0c35fe102944eae1fb4ed36bfb7d63b18.patch | 49 --------------------- PHPINFO | 2 +- REFLECTION | 2 +- c8bf723822ef48f722b78cff240e886cb5907edd.patch | 61 -------------------------- composer.json | 34 ++++++++++++++ d4d7845adb0b08d294a9255d9254b5f5cc6aba80.patch | 50 --------------------- php-maxminddb.spec | 36 +++++++++------ 8 files changed, 58 insertions(+), 205 deletions(-) delete mode 100644 4b3e00c2b4f33124dbc2cf94f472c66d5c44b4cc.patch delete mode 100644 73320ff0c35fe102944eae1fb4ed36bfb7d63b18.patch delete mode 100644 c8bf723822ef48f722b78cff240e886cb5907edd.patch create mode 100644 composer.json delete mode 100644 d4d7845adb0b08d294a9255d9254b5f5cc6aba80.patch diff --git a/4b3e00c2b4f33124dbc2cf94f472c66d5c44b4cc.patch b/4b3e00c2b4f33124dbc2cf94f472c66d5c44b4cc.patch deleted file mode 100644 index bf199f8..0000000 --- a/4b3e00c2b4f33124dbc2cf94f472c66d5c44b4cc.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 4b3e00c2b4f33124dbc2cf94f472c66d5c44b4cc Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 7 Nov 2018 18:01:38 +0100 -Subject: [PATCH] fux typo + raise minimal version to 1.0.0 - ---- - ext/config.m4 | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/ext/config.m4 b/ext/config.m4 -index efddab5..675e00c 100644 ---- a/ext/config.m4 -+++ b/ext/config.m4 -@@ -12,13 +12,13 @@ if test $PHP_MAXMINDDB != "no"; then - AC_MSG_CHECKING(for libmaxminddb) - if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmaxminddb; then - dnl retrieve build options from pkg-config -- if $PKG_CONFIG libzip --atleast-version 0; then -+ if $PKG_CONFIG libmaxminddb --atleast-version 1.0.0; then - LIBMAXMINDDB_INC=`$PKG_CONFIG libmaxminddb --cflags` - LIBMAXMINDDB_LIB=`$PKG_CONFIG libmaxminddb --libs` - LIBMAXMINDDB_VER=`$PKG_CONFIG libmaxminddb --modversion` - AC_MSG_RESULT(found version $LIBMAXMINDDB_VER) - else -- AC_MSG_ERROR(system libmaxminddb must be upgraded to version >= 0) -+ AC_MSG_ERROR(system libmaxminddb must be upgraded to version >= 1.0.0) - fi - PHP_EVAL_LIBLINE($LIBMAXMINDDB_LIB, MAXMINDDB_SHARED_LIBADD) - PHP_EVAL_INCLINE($LIBMAXMINDDB_INC) diff --git a/73320ff0c35fe102944eae1fb4ed36bfb7d63b18.patch b/73320ff0c35fe102944eae1fb4ed36bfb7d63b18.patch deleted file mode 100644 index 8bb6a66..0000000 --- a/73320ff0c35fe102944eae1fb4ed36bfb7d63b18.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 73320ff0c35fe102944eae1fb4ed36bfb7d63b18 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 7 Nov 2018 14:18:00 +0100 -Subject: [PATCH] add MINFO method, and display both extension and library - versions - ---- - ext/maxminddb.c | 14 +++++++++++++- - 1 file changed, 13 insertions(+), 1 deletion(-) - -diff --git a/ext/maxminddb.c b/ext/maxminddb.c -index c0177df..6fd758f 100644 ---- a/ext/maxminddb.c -+++ b/ext/maxminddb.c -@@ -20,6 +20,7 @@ - #include - #include - #include "Zend/zend_exceptions.h" -+#include "ext/standard/info.h" - #include - - #ifdef ZTS -@@ -546,6 +547,17 @@ PHP_MINIT_FUNCTION(maxminddb){ - return SUCCESS; - } - -+static PHP_MINFO_FUNCTION(maxminddb) -+{ -+ php_info_print_table_start(); -+ -+ php_info_print_table_row(2, "MaxMind DB Reader", "enabled"); -+ php_info_print_table_row(2, "maxminddb extension version", PHP_MAXMINDDB_VERSION); -+ php_info_print_table_row(2, "libmaxminddb library version", MMDB_lib_version()); -+ -+ php_info_print_table_end(); -+} -+ - zend_module_entry maxminddb_module_entry = { - STANDARD_MODULE_HEADER, - PHP_MAXMINDDB_EXTNAME, -@@ -554,7 +566,7 @@ zend_module_entry maxminddb_module_entry = { - NULL, - NULL, - NULL, -- NULL, -+ PHP_MINFO(maxminddb), - PHP_MAXMINDDB_VERSION, - STANDARD_MODULE_PROPERTIES - }; diff --git a/PHPINFO b/PHPINFO index d47b009..80ee149 100644 --- a/PHPINFO +++ b/PHPINFO @@ -2,5 +2,5 @@ maxminddb MaxMind DB Reader => enabled -maxminddb extension version => 1.3.0 +maxminddb extension version => 1.4.0 libmaxminddb library version => 1.2.0 diff --git a/REFLECTION b/REFLECTION index 502a5c1..ca5dbd7 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #113 maxminddb version 1.3.0 ] { +Extension [ extension #115 maxminddb version 1.4.0 ] { - Classes [1] { Class [ class MaxMind\Db\Reader ] { diff --git a/c8bf723822ef48f722b78cff240e886cb5907edd.patch b/c8bf723822ef48f722b78cff240e886cb5907edd.patch deleted file mode 100644 index 37efc3c..0000000 --- a/c8bf723822ef48f722b78cff240e886cb5907edd.patch +++ /dev/null @@ -1,61 +0,0 @@ -From c8bf723822ef48f722b78cff240e886cb5907edd Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 7 Nov 2018 14:28:11 +0100 -Subject: [PATCH] add missing arginfo - ---- - ext/maxminddb.c | 19 +++++++++++++++---- - 1 file changed, 15 insertions(+), 4 deletions(-) - -diff --git a/ext/maxminddb.c b/ext/maxminddb.c -index c0177df..428ec65 100644 ---- a/ext/maxminddb.c -+++ b/ext/maxminddb.c -@@ -115,6 +115,10 @@ static inline maxminddb_obj *php_maxminddb_fetch_object(zend_object *obj TSRMLS_ - #endif - } - -+ZEND_BEGIN_ARG_INFO_EX(arginfo_maxmindbreader_construct, 0, 0, 1) -+ ZEND_ARG_INFO(0, db_file) -+ZEND_END_ARG_INFO() -+ - PHP_METHOD(MaxMind_Db_Reader, __construct){ - char *db_file = NULL; - strsize_t name_len; -@@ -150,6 +154,10 @@ PHP_METHOD(MaxMind_Db_Reader, __construct){ - mmdb_obj->mmdb = mmdb; - } - -+ZEND_BEGIN_ARG_INFO_EX(arginfo_maxmindbreader_get, 0, 0, 1) -+ ZEND_ARG_INFO(0, ip_address) -+ZEND_END_ARG_INFO() -+ - PHP_METHOD(MaxMind_Db_Reader, get){ - char *ip_address = NULL; - strsize_t name_len; -@@ -225,6 +233,9 @@ PHP_METHOD(MaxMind_Db_Reader, get){ - MMDB_free_entry_data_list(entry_data_list); - } - -+ZEND_BEGIN_ARG_INFO_EX(arginfo_maxmindbreader_void, 0, 0, 0) -+ZEND_END_ARG_INFO() -+ - PHP_METHOD(MaxMind_Db_Reader, metadata){ - if (ZEND_NUM_ARGS() != 0) { - THROW_EXCEPTION("InvalidArgumentException", -@@ -520,11 +531,11 @@ static zend_object_value maxminddb_create_handler( - - /* *INDENT-OFF* */ - static zend_function_entry maxminddb_methods[] = { -- PHP_ME(MaxMind_Db_Reader, __construct, NULL, -+ PHP_ME(MaxMind_Db_Reader, __construct, arginfo_maxmindbreader_construct, - ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) -- PHP_ME(MaxMind_Db_Reader, close, NULL, ZEND_ACC_PUBLIC) -- PHP_ME(MaxMind_Db_Reader, get, NULL, ZEND_ACC_PUBLIC) -- PHP_ME(MaxMind_Db_Reader, metadata, NULL, ZEND_ACC_PUBLIC) -+ PHP_ME(MaxMind_Db_Reader, close, arginfo_maxmindbreader_void, ZEND_ACC_PUBLIC) -+ PHP_ME(MaxMind_Db_Reader, get, arginfo_maxmindbreader_get, ZEND_ACC_PUBLIC) -+ PHP_ME(MaxMind_Db_Reader, metadata, arginfo_maxmindbreader_void, ZEND_ACC_PUBLIC) - { NULL, NULL, NULL } - }; - /* *INDENT-ON* */ diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..dce4428 --- /dev/null +++ b/composer.json @@ -0,0 +1,34 @@ +{ + "name": "maxmind-db/reader", + "description": "MaxMind DB Reader API", + "keywords": ["database", "geoip", "geoip2", "geolocation", "maxmind"], + "homepage": "https://github.com/maxmind/MaxMind-DB-Reader-php", + "type": "library", + "license": "Apache-2.0", + "authors": [ + { + "name": "Gregory J. Oschwald", + "email": "goschwald@maxmind.com", + "homepage": "http://www.maxmind.com/" + } + ], + "require": { + "php": ">=5.4" + }, + "suggest": { + "ext-bcmath": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder", + "ext-gmp": "bcmath or gmp is required for decoding larger integers with the pure PHP decoder", + "ext-maxminddb": "A C-based database decoder that provides significantly faster lookups" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "2.*", + "phpunit/phpunit": "4.* || 5.*", + "satooshi/php-coveralls": "1.0.*", + "squizlabs/php_codesniffer": "3.*" + }, + "autoload": { + "psr-4": { + "MaxMind\\Db\\": "src/MaxMind/Db" + } + } +} diff --git a/d4d7845adb0b08d294a9255d9254b5f5cc6aba80.patch b/d4d7845adb0b08d294a9255d9254b5f5cc6aba80.patch deleted file mode 100644 index d45ff8d..0000000 --- a/d4d7845adb0b08d294a9255d9254b5f5cc6aba80.patch +++ /dev/null @@ -1,50 +0,0 @@ -From d4d7845adb0b08d294a9255d9254b5f5cc6aba80 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Wed, 7 Nov 2018 14:05:06 +0100 -Subject: [PATCH] retrieve build options from pkg-config - ---- - ext/config.m4 | 25 +++++++++++++++++++++++-- - 1 file changed, 23 insertions(+), 2 deletions(-) - -diff --git a/ext/config.m4 b/ext/config.m4 -index a08bb2c..efddab5 100644 ---- a/ext/config.m4 -+++ b/ext/config.m4 -@@ -6,13 +6,34 @@ PHP_ARG_ENABLE(maxminddb-debug, for MaxMind DB debug support, - [ --enable-maxminddb-debug Enable enable MaxMind DB deubg support], no, no) - - if test $PHP_MAXMINDDB != "no"; then -- PHP_CHECK_LIBRARY(maxminddb, MMDB_open) -+ -+ AC_PATH_PROG(PKG_CONFIG, pkg-config, no) -+ -+ AC_MSG_CHECKING(for libmaxminddb) -+ if test -x "$PKG_CONFIG" && $PKG_CONFIG --exists libmaxminddb; then -+ dnl retrieve build options from pkg-config -+ if $PKG_CONFIG libzip --atleast-version 0; then -+ LIBMAXMINDDB_INC=`$PKG_CONFIG libmaxminddb --cflags` -+ LIBMAXMINDDB_LIB=`$PKG_CONFIG libmaxminddb --libs` -+ LIBMAXMINDDB_VER=`$PKG_CONFIG libmaxminddb --modversion` -+ AC_MSG_RESULT(found version $LIBMAXMINDDB_VER) -+ else -+ AC_MSG_ERROR(system libmaxminddb must be upgraded to version >= 0) -+ fi -+ PHP_EVAL_LIBLINE($LIBMAXMINDDB_LIB, MAXMINDDB_SHARED_LIBADD) -+ PHP_EVAL_INCLINE($LIBMAXMINDDB_INC) -+ else -+ AC_MSG_RESULT(pkg-config information missing) -+ AC_MSG_WARN(will use libmaxmxinddb from compiler default path) -+ -+ PHP_CHECK_LIBRARY(maxminddb, MMDB_open) -+ PHP_ADD_LIBRARY(maxminddb, 1, MAXMINDDB_SHARED_LIBADD) -+ fi - - if test $PHP_MAXMINDDB_DEBUG != "no"; then - CFLAGS="$CFLAGS -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -Werror" - fi - -- PHP_ADD_LIBRARY(maxminddb, 1, MAXMINDDB_SHARED_LIBADD) - PHP_SUBST(MAXMINDDB_SHARED_LIBADD) - - PHP_NEW_EXTENSION(maxminddb, maxminddb.c, $ext_shared) diff --git a/php-maxminddb.spec b/php-maxminddb.spec index a9c229f..74b2892 100644 --- a/php-maxminddb.spec +++ b/php-maxminddb.spec @@ -22,7 +22,7 @@ %endif -%global gh_commit e042b4f8a2dff41e19019faf16427178b07fbd58 +%global gh_commit 2f1086e38939e808cc23b17daa469da094af9125 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner maxmind %global gh_project MaxMind-DB-Reader-php @@ -35,8 +35,8 @@ Summary: MaxMind DB Reader extension Name: %{?sub_prefix}php-maxminddb -Version: 1.3.0 -%global rpmrel 3 +Version: 1.4.0 +%global rpmrel 1 Release: %{rpmrel}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} License: ASL 2.0 URL: https://github.com/%{gh_owner}/%{gh_project} @@ -44,12 +44,6 @@ URL: https://github.com/%{gh_owner}/%{gh_project} Source0: %{pkg_name}-%{version}-%{gh_short}.tgz Source1: makesrc.sh -# Upstream patches -Patch0: https://github.com/maxmind/MaxMind-DB-Reader-php/commit/d4d7845adb0b08d294a9255d9254b5f5cc6aba80.patch -Patch1: https://github.com/maxmind/MaxMind-DB-Reader-php/commit/73320ff0c35fe102944eae1fb4ed36bfb7d63b18.patch -Patch2: https://github.com/maxmind/MaxMind-DB-Reader-php/commit/c8bf723822ef48f722b78cff240e886cb5907edd.patch -Patch3: https://github.com/maxmind/MaxMind-DB-Reader-php/commit/4b3e00c2b4f33124dbc2cf94f472c66d5c44b4cc.patch - BuildRequires: %{?scl_prefix}php-devel BuildRequires: pkgconfig(libmaxminddb) >= 1.0.0 @@ -99,6 +93,8 @@ IP address subnets (IPv4 or IPv6). This optional PHP C Extension is a drop-in replacement for MaxMind\Db\Reader. +Databases are available in geolite2-country and geolite2-city packages. + Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')%{?scl: as Software Collection (%{scl} by %{?scl_vendor}%{!?scl_vendor:rh})}. @@ -145,17 +141,17 @@ MaxMind DB Reader PHP API. MaxMind DB is a binary file format that stores data indexed by IP address subnets (IPv4 or IPv6). +Databases are available in geolite2-country and geolite2-city packages. + +The extension available in php-maxminddb package allow better +performance. + Autoloader: %{_datadir}/php/MaxMind/Db/Reader/autoload.php %endif %prep %setup -q -n %{gh_project}-%{gh_commit} -%patch0 -p1 -b up0 -%patch1 -p1 -b up1 -%patch2 -p1 -b up2 -%patch3 -p1 -b up3 - %if %{with_lib} %{_bindir}/phpab \ --template fedora \ @@ -273,6 +269,13 @@ for cmd in php php56 php70 php71 php72 php73; do %endif fi done + +: Upstream test suite for the library with the extension +php --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ + %{_bindir}/phpunit \ + --bootstrap %{buildroot}%{_datadir}/php/MaxMind/Db/Reader/autoload.php \ + --filter '^((?!(testDecoder)).)*$' \ + --verbose || ret=1 %endif exit $ret @@ -302,6 +305,11 @@ exit $ret %changelog +* Wed Nov 21 2018 Remi Collet - 1.4.0-1 +- update to 1.4.0 +- open https://github.com/maxmind/MaxMind-DB-Reader-php/issues/79 + to report test failure on 32-bit + * Wed Nov 14 2018 Remi Collet - 1.3.0-3 - add php-maxmind-db-reader sub-package providing the library - open https://github.com/maxmind/MaxMind-DB-Reader-php/issues/77 -- cgit