Skip to content

Commit

Permalink
dev-php/pecl-geoip: Revbump for PHP 8 support
Browse files Browse the repository at this point in the history
Signed-off-by: Brian Evans <[email protected]>
  • Loading branch information
Brian Evans committed Dec 10, 2020
1 parent 8c4872c commit d6f189d
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 0 deletions.
93 changes: 93 additions & 0 deletions dev-php/pecl-geoip/files/php8-support-1.1.1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
--- a/geoip.c 2020/10/30 12:04:28 351081
+++ b/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
};
/* }}} */

25 changes: 25 additions & 0 deletions dev-php/pecl-geoip/pecl-geoip-1.1.1-r5.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

PHP_EXT_NAME="geoip"
DOCS="README ChangeLog"
USE_PHP="php7-2 php7-3 php7-4 php8-0"

inherit php-ext-pecl-r3

KEYWORDS="~amd64 ~x86"

DESCRIPTION="PHP extension to map IP address to geographic places"
LICENSE="PHP-3"
SLOT="0"
IUSE=""

DEPEND="dev-libs/geoip"
RDEPEND="${DEPEND}"

PATCHES=(
"${FILESDIR}/fix-failing-tests-1.1.1.patch"
"${FILESDIR}/php8-support-1.1.1.patch"
)

0 comments on commit d6f189d

Please sign in to comment.