Hi ports@,

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. For example, I cannot
build the MaxMind::DB::Reader::XS Perl module because of this.

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.

Comments? OK?

Index: Makefile
===================================================================
RCS file: /cvs/ports/net/libmaxminddb/Makefile,v
retrieving revision 1.30
diff -u -p -r1.30 Makefile
--- Makefile    4 Jul 2018 20:07:17 -0000       1.30
+++ Makefile    10 Jul 2018 14:54:38 -0000
@@ -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/down
 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
Index: patches/patch-include_maxminddb_h
===================================================================
RCS file: patches/patch-include_maxminddb_h
diff -N patches/patch-include_maxminddb_h
--- patches/patch-include_maxminddb_h   23 Jan 2018 10:07:43 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -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. */
Index: patches/patch-src_maxminddb_c
===================================================================
RCS file: patches/patch-src_maxminddb_c
diff -N patches/patch-src_maxminddb_c
--- patches/patch-src_maxminddb_c       23 Jan 2018 10:07:43 -0000      1.3
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -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;

Reply via email to