summaryrefslogtreecommitdiff
path: root/converters/osm2pgsql/Makefile
blob: a491117ab6894c68f611bca8c5a71824b8dd10b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
PORTNAME=	osm2pgsql
PORTVERSION=	1.9.2
CATEGORIES=	converters geography

MAINTAINER=	amdmi3@FreeBSD.org
COMMENT=	Convert OSM XML data to PostgreSQL database
WWW=		https://osm2pgsql.org/ \
		https://wiki.openstreetmap.org/wiki/Osm2pgsql \
		https://github.com/openstreetmap/osm2pgsql

LICENSE=	GPLv2+
LICENSE_FILE=	${WRKSRC}/COPYING

LIB_DEPENDS=	libproj.so:graphics/proj \
		libboost_system.so:devel/boost-libs \
		libexpat.so:textproc/expat2
BUILD_DEPENDS=	${LOCALBASE}/include/osmium/version.hpp:astro/libosmium \
		${LOCALBASE}/include/protozero/version.hpp:devel/protozero \
		${LOCALBASE}/include/nlohmann/json.hpp:devel/nlohmann-json

USE_GITHUB=	yes
GH_ACCOUNT=	openstreetmap

USES=		cmake compiler:c++17-lang pgsql python:run shebangfix
SHEBANG_FILES=	scripts/osm2pgsql-replication
CMAKE_ON=	CMAKE_DISABLE_FIND_PACKAGE_Git \
		EXTERNAL_LIBOSMIUM \
		EXTERNAL_PROTOZERO
#		EXTERNAL_FMT  # XXX: does not build with libfmt 9.x from ports, so use bundled version until upstream fixes
CMAKE_ARGS=	-DLUA_EXE="${LOCALBASE}/bin/${LUA_CMD}"

PORTDOCS=	AUTHORS CONTRIBUTING.md README.md
PORTDATA=	*

OPTIONS_DEFINE=	DOCS LUAJIT TEST # GEN (utility built with this option is not installed)

LUAJIT_DESC=		Build with LuaJIT support
LUAJIT_CMAKE_BOOL=	WITH_LUAJIT
LUAJIT_USES=		luajit lua:54:build  # lua is needed just for running tests
LUAJIT_USES_OFF=	lua:54
TEST_CMAKE_BOOL=	BUILD_TESTS
TEST_TEST_TARGET=	test
TEST_CMAKE_ON=		-DCMAKE_CTEST_ARGUMENTS="--label-regex;NoDB;--output-on-failure"
TEST_BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}behave>=0:devel/py-behave@${PY_FLAVOR}
TEST_TEST_DEPENDS=	${PYTHON_PKGNAMEPREFIX}behave>=0:devel/py-behave@${PY_FLAVOR}
#GEN_DESC=		Build experimental osm2pgsql-gen data generalization utility
#GEN_LIB_DEPENDS=	libpotrace.so:graphics/libpotrace
#GEN_BUILD_DEPENDS=	${LOCALBASE}/include/CImg.h:graphics/cimg

post-patch:
	@${REINPLACE_CMD} -e 's|find_package(Lua |&${LUA_VER} EXACT |' \
		${WRKSRC}/CMakeLists.txt
# for post-patch-GEN-off: when GEN option is implemented
	@${REINPLACE_CMD} -Ee '/find_(path|library)/ s,(potrace|CImg),no&,' \
		${WRKSRC}/CMakeLists.txt

post-install-DOCS-on:
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
.for f in ${PORTDOCS}
	${INSTALL_DATA} ${WRKSRC}/${f} ${STAGEDIR}${DOCSDIR}/
.endfor

.include <bsd.port.mk>