The combination of -fms-extensions -std=c99 means libmaxminddb couldn't

be built with base GCC, so the library and headers were patched. This
worked when the only consumer was the mmdblookup bundled tool. However,
this is causing issues with new consumers.

Instead of patching all consumers, stop modifying the library and header
file, and switch to using COMPILER directives instead, as it builds fine
with base-clang and ports-gcc.

OK jca@
This commit is contained in:
fcambus 2018-07-11 19:06:32 +00:00
parent ff5926da9e
commit 52494b979f
3 changed files with 5 additions and 48 deletions

View File

@ -1,4 +1,4 @@
# $OpenBSD: Makefile,v 1.30 2018/07/04 20:07:17 fcambus Exp $
# $OpenBSD: Makefile,v 1.31 2018/07/11 19:06:32 fcambus Exp $
COMMENT-main = library for MaxMind GeoIP2/GeoLite2 IP geolocation databases
COMMENT-db = GeoIP2 GeoLite2 database: IPv4/v6 address to country
@ -9,6 +9,7 @@ V = 1.3.2
D = 20180704
DISTNAME = libmaxminddb-${V}
PKGNAME-main = libmaxminddb-${V}
REVISION-main = 0
PKGNAME-db = geolite2-country-${D}
PKGNAME-city = geolite2-city-${D}
PKGNAME-asn = geolite2-asn-${D}
@ -33,6 +34,9 @@ MASTER_SITES = ${HOMEPAGE}/releases/download/${V}/
MASTER_SITES0 = https://www.distfiles.pl/
MULTI_PACKAGES = -main -db -city -asn
COMPILER = base-clang ports-gcc
RUN_DEPENDS-main = net/libmaxminddb,-db
TEST_DEPENDS = devel/p5-IPC-Run3

View File

@ -1,24 +0,0 @@
$OpenBSD: patch-include_maxminddb_h,v 1.2 2018/01/23 10:07:43 fcambus Exp $
Index: include/maxminddb.h
--- include/maxminddb.h.orig
+++ include/maxminddb.h
@@ -123,7 +123,17 @@ typedef struct MMDB_entry_data_s {
#endif
bool boolean;
float float_value;
- };
+ } u;
+#define pointer u.pointer
+#define utf8_string u.utf8_string
+#define double_value u.double_value
+#define uint16 u.uint16
+#define uint32 u.uint32
+#define int32 u.int32
+#define uint64 u.uint64
+#define uint128 u.uint128
+#define boolean u.boolean
+#define float_value u.float_value
/* This is a 0 if a given entry cannot be found. This can only happen
* when a call to MMDB_(v)get_value() asks for hash keys or array
* indices that don't exist. */

View File

@ -1,23 +0,0 @@
$OpenBSD: patch-src_maxminddb_c,v 1.3 2018/01/23 10:07:43 fcambus Exp $
Index: src/maxminddb.c
--- src/maxminddb.c.orig
+++ src/maxminddb.c
@@ -1600,7 +1600,7 @@ LOCAL int decode_one(MMDB_s *mmdb, uint32_t offset,
free(string);
#endif
} else if (type == MMDB_DATA_TYPE_BYTES) {
- entry_data->bytes = &mem[offset];
+ entry_data->u.bytes = &mem[offset];
entry_data->data_size = size;
}
@@ -2035,7 +2035,7 @@ LOCAL MMDB_entry_data_list_s *dump_entry_data_list(
case MMDB_DATA_TYPE_BYTES:
{
char *hex_string =
- bytes_to_hex((uint8_t *)entry_data_list->entry_data.bytes,
+ bytes_to_hex((uint8_t *)entry_data_list->entry_data.u.bytes,
entry_data_list->entry_data.data_size);
if (NULL == hex_string) {
*status = MMDB_OUT_OF_MEMORY_ERROR;