Import geo/libpostal.

C library for parsing/normalizing street addresses around the world, powered
by statistical NLP and open geo data.

This library helps convert the free-form addresses that humans use into clean
normalized forms suitable for machine comparison and full-text indexing.

OK rsadowski@
This commit is contained in:
fcambus 2018-08-06 09:15:11 +00:00
parent d0673a0a70
commit f09cb96600
8 changed files with 128 additions and 0 deletions

41
geo/libpostal/Makefile Normal file
View File

@ -0,0 +1,41 @@
# $OpenBSD: Makefile,v 1.1.1.1 2018/08/06 09:15:11 fcambus Exp $
COMMENT = library for parsing/normalizing street addresses
GH_ACCOUNT = openvenues
GH_PROJECT = libpostal
GH_TAGNAME = v1.0.0
SHARED_LIBS += postal 0.0 # 1.0
CATEGORIES = geo
MAINTAINER = Frederic Cambus <fcambus@openbsd.org>
# MIT
PERMIT_PACKAGE_CDROM = Yes
WANTLIB += c m
AUTOMAKE_VERSION = 1.15
AUTOCONF_VERSION = 2.69
BUILD_DEPENDS = ${MODGNU_AUTOCONF_DEPENDS} \
${MODGNU_AUTOMAKE_DEPENDS} \
devel/libtool
CONFIGURE_STYLE = gnu
CONFIGURE_ARGS = --datadir=${LOCALSTATEDIR}/db --disable-data-download
NO_TEST = Yes
pre-configure:
cd ${WRKSRC} && ${SETENV} AUTOCONF_VERSION=${AUTOCONF_VERSION} \
AUTOMAKE_VERSION=${AUTOMAKE_VERSION} ./bootstrap.sh
post-install:
${INSTALL_PROGRAM} ${WRKSRC}/src/address_parser ${PREFIX}/bin
rm ${PREFIX}/bin/libpostal_data
.include <bsd.port.mk>

2
geo/libpostal/distinfo Normal file
View File

@ -0,0 +1,2 @@
SHA256 (libpostal-1.0.0.tar.gz) = MDWvfhWyiUBpdTl12VP6FahtloEDkT2/jOS4qiYjFkQ=
SIZE (libpostal-1.0.0.tar.gz) = 5537587

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-src_Makefile_am,v 1.1.1.1 2018/08/06 09:15:11 fcambus Exp $
Remove hardcoded optimization levels.
Index: src/Makefile.am
--- src/Makefile.am.orig
+++ src/Makefile.am
@@ -1,10 +1,10 @@
# Inherited from autoconf / user-specified
CFLAGS_CONF = @CFLAGS@
-CFLAGS_BASE = -Wall -Wextra -Wno-unused-function -Wformat -Werror=format-security -Winit-self -Wno-sign-compare -DLIBPOSTAL_DATA_DIR='"$(datadir)/libpostal"' -g $(CFLAGS_CONF)
+CFLAGS_BASE = -Wall -Wextra -Wno-unused-function -Wformat -Werror=format-security -Winit-self -Wno-sign-compare -DLIBPOSTAL_DATA_DIR='"$(datadir)/libpostal"' $(CFLAGS_CONF)
CFLAGS_O0 = $(CFLAGS_BASE) -O0
-CFLAGS_O1 = $(CFLAGS_BASE) -O1
-CFLAGS_O2 = $(CFLAGS_BASE) -O2
-CFLAGS_O3 = $(CFLAGS_BASE) -O3
+CFLAGS_O1 = $(CFLAGS_BASE)
+CFLAGS_O2 = $(CFLAGS_BASE)
+CFLAGS_O3 = $(CFLAGS_BASE)
DEFAULT_INCLUDES = -I.. -I/usr/local/include
# Wonky but have to be able to override the user's optimization level to compile the scanner

View File

@ -0,0 +1,10 @@
$OpenBSD: patch-src_sparkey_Makefile_am,v 1.1.1.1 2018/08/06 09:15:11 fcambus Exp $
--- src/sparkey/Makefile.am.orig Thu Feb 9 20:34:15 2017
+++ src/sparkey/Makefile.am Mon Feb 13 13:41:01 2017
@@ -1,5 +1,5 @@
CFLAGS_CONF = @CFLAGS@
-CFLAGS = -I/usr/local/include -O2 -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Werror -pedantic $(CFLAGS_CONF)
+CFLAGS = -I/usr/local/include -Wall -Wextra -Wfloat-equal -Wshadow -Wpointer-arith -Werror -pedantic -fgnu89-inline $(CFLAGS_CONF)
noinst_LTLIBRARIES = libsparkey.la
libsparkey_la_SOURCES = endiantools.h hashheader.h logheader.h \

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-test_Makefile_am,v 1.1.1.1 2018/08/06 09:15:11 fcambus Exp $
Remove hardcoded optimization levels.
Index: test/Makefile.am
--- test/Makefile.am.orig
+++ test/Makefile.am
@@ -1,8 +1,8 @@
CFLAGS_BASE = -Wfloat-equal -Wpointer-arith -std=gnu99 -DLIBPOSTAL_DATA_DIR='"$(datadir)/libpostal"' -g
CFLAGS_O0 = $(CFLAGS_BASE) -O0
-CFLAGS_O1 = $(CFLAGS_BASE) -O1
-CFLAGS_O2 = $(CFLAGS_BASE) -O2
-CFLAGS_O3 = $(CFLAGS_BASE) -O3
+CFLAGS_O1 = $(CFLAGS_BASE)
+CFLAGS_O2 = $(CFLAGS_BASE)
+CFLAGS_O3 = $(CFLAGS_BASE)
DEFAULT_INCLUDES = -I.. -I/usr/local/include
CFLAGS = $(CFLAGS_BASE)

5
geo/libpostal/pkg/DESCR Normal file
View File

@ -0,0 +1,5 @@
C library for parsing/normalizing street addresses around the world, powered
by statistical NLP and open geo data.
This library helps convert the free-form addresses that humans use into clean
normalized forms suitable for machine comparison and full-text indexing.

16
geo/libpostal/pkg/MESSAGE Normal file
View File

@ -0,0 +1,16 @@
libpostal requires data files which should be fetched before use.
Fetching data files requires 776M of free space, and the extracted data
takes 1.8G.
The user fetching data must be part of the _libpostal group:
# usermod -G _libpostal <username>
The data files can then be fetched as follows:
$ cd ${LOCALSTATEDIR}/db/libpostal &&
for f in language_classifier libpostal_data parser; do
ftp https://github.com/openvenues/libpostal/releases/download/v1.0.0/$f.tar.gz
tar xfz $f.tar.gz
done;

13
geo/libpostal/pkg/PLIST Normal file
View File

@ -0,0 +1,13 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2018/08/06 09:15:11 fcambus Exp $
@newgroup _libpostal:816
@extraunexec rm -rf /var/db/libpostal
@bin bin/address_parser
include/libpostal/
include/libpostal/libpostal.h
lib/libpostal.a
lib/libpostal.la
@lib lib/libpostal.so.${LIBpostal_VERSION}
lib/pkgconfig/libpostal.pc
@mode 775
@group _libpostal
@sample ${LOCALSTATEDIR}/db/libpostal/