[PATCH] net/libmaxminddb
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 --- Makefile4 Jul 2018 20:07:17 - 1.30 +++ Makefile10 Jul 2018 14:54:38 - @@ -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 - 1.2 +++ /dev/null 1 Jan 1970 00:00:00 - @@ -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 - 1.3 +++ /dev/null 1 Jan 1970 00:00:00 - @@ -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;
[PATCH] net/libmaxminddb
Hi ports@, Here is a diff to update a few things in the net/libmaxminddb port: - Update the geolite2 maintainer target to cope with new upstream packaging scheme, and also fetch the ASN database - Add a subpackage for the ASN database - Update GeoLite2 databases to latest version Comments? OK? Index: Makefile === RCS file: /cvs/ports/net/libmaxminddb/Makefile,v retrieving revision 1.13 diff -u -p -r1.13 Makefile --- Makefile4 Jun 2017 10:57:59 - 1.13 +++ Makefile8 Jun 2017 14:01:11 - @@ -3,16 +3,18 @@ COMMENT-main = library for MaxMind GeoIP2/GeoLite2 IP geolocation databases COMMENT-db = GeoIP2 GeoLite2 database: IPv4/v6 address to country COMMENT-city = GeoIP2 GeoLite2 database: IPv4/v6 address to city +COMMENT-asn = GeoIP2 GeoLite2 database: IPv4/v6 address to AS number V =1.2.1 -D =20170503 +D =20170608 DISTNAME = libmaxminddb-${V} PKGNAME-main = libmaxminddb-${V} PKGNAME-db = geolite2-country-${D} PKGNAME-city = geolite2-city-${D} +PKGNAME-asn = geolite2-asn-${D} DISTFILES =${DISTNAME}${EXTRACT_SUFX} \ geolite2-data-$D.tar.xz:0 -REVISION = 0 +REVISION-main =0 SHARED_LIBS += maxminddb 0.0 # 0.7 @@ -31,7 +33,7 @@ WANTLIB-main += c m MASTER_SITES = ${HOMEPAGE}/releases/download/${V}/ MASTER_SITES0 =https://www.distfiles.pl/ -MULTI_PACKAGES = -main -db -city +MULTI_PACKAGES = -main -db -city -asn RUN_DEPENDS-main = net/libmaxminddb,-db TEST_DEPENDS = devel/p5-IPC-Run3 @@ -56,13 +58,16 @@ geolite2: echo "see https://www.maxmind.com and https://dev.maxmind.com/geoip/geoip2/geolite2/."; >> README; \ echo "Distributed under Creative Commons Attribution-ShareAlike 4.0 International License." >> README; \ echo "Created at `date -z UTC` and intended for OS packaging purposes." >> README; \ - ftp https://geolite.maxmind.com/download/geoip/database/GeoLite2-{Country,City}.{md5,mmdb.gz}; \ - gunzip *gz; \ - for file in GeoLite2-Country GeoLite2-City; do \ - if [ "`md5 -q $$file.mmdb`" != "`cat $$file.md5`" ]; then \ - echo "ERROR: $$file.mmdb is corrupt"; \ + ftp https://geolite.maxmind.com/download/geoip/database/GeoLite2-{Country,City,ASN}.{tar.gz,tar.gz.md5}; \ + for file in GeoLite2-Country GeoLite2-City GeoLite2-ASN; do \ + if [ "`md5 -q $$file.tar.gz`" != "`cat $$file.tar.gz.md5`" ]; then \ + echo "ERROR: $$file.tar.gz is corrupt"; \ exit; \ fi; \ + tar xfz $$file.tar.gz; \ + done; \ + for file in `find * -type f | grep mmdb`; do \ + mv $$file .; \ done; \ cd ..; \ tar cf - data/README data/*.mmdb | xz -T 0 > $$distfile; \ Index: distinfo === RCS file: /cvs/ports/net/libmaxminddb/distinfo,v retrieving revision 1.12 diff -u -p -r1.12 distinfo --- distinfo16 May 2017 08:11:27 - 1.12 +++ distinfo8 Jun 2017 14:01:11 - @@ -1,4 +1,4 @@ -SHA256 (geolite2-data-20170503.tar.xz) = Jvi75Q7dMcYsPCzWAPQtCi03uNEEqfw8h2W5x9XCy00= +SHA256 (geolite2-data-20170608.tar.xz) = Nz8oqVqK92lZCeXP1dG2L1QoJwi6DJ8V53A4+MZciSw= SHA256 (libmaxminddb-1.2.1.tar.gz) = n6KzNByciBF/WEVN+y3RBJFaM32TyKmnNZMaY7N/e/o= -SIZE (geolite2-data-20170503.tar.xz) = 17390448 +SIZE (geolite2-data-20170608.tar.xz) = 19503060 SIZE (libmaxminddb-1.2.1.tar.gz) = 614448 Index: pkg/DESCR-asn === RCS file: pkg/DESCR-asn diff -N pkg/DESCR-asn --- /dev/null 1 Jan 1970 00:00:00 - +++ pkg/DESCR-asn 8 Jun 2017 14:01:11 - @@ -0,0 +1,5 @@ +This package contains a snapshot of the free GeoLite2 ASN database +under CC BY-SA 4.0 license. + +"This product includes GeoLite2 data created by MaxMind, available from +http://www.maxmind.com."; Index: pkg/PLIST-asn === RCS file: pkg/PLIST-asn diff -N pkg/PLIST-asn --- /dev/null 1 Jan 1970 00:00:00 - +++ pkg/PLIST-asn 8 Jun 2017 14:01:11 - @@ -0,0 +1,5 @@ +@comment $OpenBSD$ +share/examples/libmaxminddb/ +@sample ${LOCALSTATEDIR}/db/GeoIP/ +share/examples/libmaxminddb/GeoLite2-ASN.mmdb +@sample ${LOCALSTATEDIR}/db/GeoIP/GeoLite2-ASN.mmdb
Re: [PATCH] net/libmaxminddb
On Tue, Jul 10 2018, Frederic Cambus wrote: > 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? Looks like a better solution, ok jca@ -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE
Re: [PATCH] net/libmaxminddb
On Thu, Jun 08, 2017 at 11:19:36PM +0200, Frederic Cambus wrote: > Here is a diff to update a few things in the net/libmaxminddb port: > > - Update the geolite2 maintainer target to cope with new upstream > packaging scheme, and also fetch the ASN database > - Add a subpackage for the ASN database > - Update GeoLite2 databases to latest version > > Comments? OK? Ping. Anyone willing to test this?
Re: [PATCH] net/libmaxminddb
On 2017/06/08 23:19, Frederic Cambus wrote: > Here is a diff to update a few things in the net/libmaxminddb port: > > - Update the geolite2 maintainer target to cope with new upstream > packaging scheme, and also fetch the ASN database > - Add a subpackage for the ASN database > - Update GeoLite2 databases to latest version OK but I have some nitpicking comments inline :) > Index: Makefile > === > RCS file: /cvs/ports/net/libmaxminddb/Makefile,v > retrieving revision 1.13 > diff -u -p -r1.13 Makefile > --- Makefile 4 Jun 2017 10:57:59 - 1.13 > +++ Makefile 8 Jun 2017 14:01:11 - > @@ -3,16 +3,18 @@ > COMMENT-main = library for MaxMind GeoIP2/GeoLite2 IP geolocation > databases > COMMENT-db = GeoIP2 GeoLite2 database: IPv4/v6 address to country > COMMENT-city = GeoIP2 GeoLite2 database: IPv4/v6 address to city > +COMMENT-asn =GeoIP2 GeoLite2 database: IPv4/v6 address to AS number > > V = 1.2.1 > -D = 20170503 > +D = 20170608 > DISTNAME = libmaxminddb-${V} > PKGNAME-main = libmaxminddb-${V} > PKGNAME-db = geolite2-country-${D} > PKGNAME-city = geolite2-city-${D} > +PKGNAME-asn =geolite2-asn-${D} > DISTFILES = ${DISTNAME}${EXTRACT_SUFX} \ > geolite2-data-$D.tar.xz:0 > -REVISION = 0 > +REVISION-main = 0 > > SHARED_LIBS += maxminddb 0.0 # 0.7 > > @@ -31,7 +33,7 @@ WANTLIB-main += c m > MASTER_SITES = ${HOMEPAGE}/releases/download/${V}/ > MASTER_SITES0 = https://www.distfiles.pl/ > > -MULTI_PACKAGES = -main -db -city > +MULTI_PACKAGES = -main -db -city -asn > RUN_DEPENDS-main = net/libmaxminddb,-db > > TEST_DEPENDS = devel/p5-IPC-Run3 > @@ -56,13 +58,16 @@ geolite2: > echo "see https://www.maxmind.com and > https://dev.maxmind.com/geoip/geoip2/geolite2/."; >> README; \ > echo "Distributed under Creative Commons Attribution-ShareAlike 4.0 > International License." >> README; \ > echo "Created at `date -z UTC` and intended for OS packaging purposes." > >> README; \ > - ftp > https://geolite.maxmind.com/download/geoip/database/GeoLite2-{Country,City}.{md5,mmdb.gz}; > \ > - gunzip *gz; \ > - for file in GeoLite2-Country GeoLite2-City; do \ > - if [ "`md5 -q $$file.mmdb`" != "`cat $$file.md5`" ]; then \ > - echo "ERROR: $$file.mmdb is corrupt"; \ > + ftp > https://geolite.maxmind.com/download/geoip/database/GeoLite2-{Country,City,ASN}.{tar.gz,tar.gz.md5}; > \ A quick glance at this makes it look like you fetch .tar.gz twice, so I'd slightly prefer GeoLite2-{Country,City,ASN}.tar.gz{,.md5} > + for file in GeoLite2-Country GeoLite2-City GeoLite2-ASN; do \ > + if [ "`md5 -q $$file.tar.gz`" != "`cat $$file.tar.gz.md5`" ]; > then \ > + echo "ERROR: $$file.tar.gz is corrupt"; \ > exit; \ > fi; \ > + tar xfz $$file.tar.gz; \ > + done; \ > + for file in `find * -type f | grep mmdb`; do \ > + mv $$file .; \ > done; \ could just do "mv */*mmdb ." and save some execs.