git: 1c27e081725a - main - astro/libosmium: update 2.17.2 → 2.18.0

From: Dmitry Marakasov <amdmi3_at_FreeBSD.org>
Date: Tue, 15 Mar 2022 11:50:43 UTC
The branch main has been updated by amdmi3:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1c27e081725a749c7b2eba92859d26406f535314

commit 1c27e081725a749c7b2eba92859d26406f535314
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2022-03-14 19:27:47 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2022-03-15 11:50:06 +0000

    astro/libosmium: update 2.17.2 → 2.18.0
    
    - Convert LIB_DEPENDS to BUILD_DEPENDS, as this is a header-only
      library and the actual usage of dependencies is optional and depends
      on the consumer
    - Patch most linux-only #ifdefs to also include FreeBSD
---
 astro/libosmium/Makefile                           | 37 ++++++++++++----------
 astro/libosmium/distinfo                           |  6 ++--
 .../files/patch-include_osmium_thread_util.hpp     | 29 +++++++++++++++++
 astro/libosmium/pkg-plist                          |  3 --
 4 files changed, 53 insertions(+), 22 deletions(-)

diff --git a/astro/libosmium/Makefile b/astro/libosmium/Makefile
index 8440f0740510..4b4ebaa5fe87 100644
--- a/astro/libosmium/Makefile
+++ b/astro/libosmium/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	libosmium
-PORTVERSION=	2.17.2
 DISTVERSIONPREFIX=	v
+DISTVERSION=	2.18.0
 CATEGORIES=	astro geography devel
 
 MAINTAINER=	amdmi3@FreeBSD.org
@@ -9,23 +9,22 @@ COMMENT=	Fast and flexible C++ library for working with OpenStreetMap data
 LICENSE=	BSL
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-LIB_DEPENDS=	libgdal.so:graphics/gdal \
-		libboost_regex.so:devel/boost-libs \
-		libgeos.so:graphics/geos \
-		libexpat.so:textproc/expat2
-BUILD_DEPENDS=	sparsehash>=0:devel/sparsehash \
-		${LOCALBASE}/include/protozero/version.hpp:devel/protozero
-RUN_DEPENDS=	${LOCALBASE}/include/protozero/version.hpp:devel/protozero
+BUILD_DEPENDS=	boost-libs>=0:devel/boost-libs \
+		protozero>=0:devel/protozero \
+		gdal>=0:graphics/gdal \
+		protozero>=0:devel/protozero \
+		expat>=0:textproc/expat2 \
+		liblz4>=0:archivers/liblz4 \
+		geos>=0:graphics/geos
+#		proj>=0:graphics/proj
 
 USES=		cmake compiler:c++11-lib
 USE_GITHUB=	yes
 GH_ACCOUNT=	osmcode
-
-CMAKE_ARGS=	-DBUILD_EXAMPLES:BOOL=OFF
-
-# if/when corresponding port appears in the tree, this will need to
-# be turned into dependency
-CMAKE_ARGS+=	-DINSTALL_GDALCPP:BOOL=ON
+CMAKE_ON=	INSTALL_GDALCPP  # until it appears as a port
+CMAKE_ON+=	BUILD_HEADERS
+CMAKE_OFF=	BUILD_EXAMPLES
+CMAKE_OFF+=	WITH_PROJ  # the ports version is not supported
 
 # although it builds tests the library itself is header-only
 NO_ARCH=	yes
@@ -37,8 +36,14 @@ OPTIONS_DEFAULT=	TEST
 TEST_TEST_TARGET=	test
 TEST_CMAKE_BOOL=	BUILD_TESTING
 
-post-extract:
-	@${RM} -rf ${WRKSRC}/include/utf8*
+post-patch:
+	@${FIND} ${WRKSRC} -type f \( -name "*.cpp" -o -name "*.hpp" \) \
+		-not -name "memory_mapping.hpp" \
+		-not -name "test_memory_mapping.cpp" \
+		-not -name "test_memory.cpp" \
+		-exec ${REINPLACE_CMD} \
+			-e 's,^#ifdef __linux__,#if defined(__linux__) || defined(__FreeBSD__),' \
+			-e 's,^#ifndef __linux__,#if !defined(__linux__) && !defined(__FreeBSD__),' {} \;
 
 post-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
diff --git a/astro/libosmium/distinfo b/astro/libosmium/distinfo
index c772712cfdfd..ef8ec6ea88d1 100644
--- a/astro/libosmium/distinfo
+++ b/astro/libosmium/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1639744850
-SHA256 (osmcode-libosmium-v2.17.2_GH0.tar.gz) = f30e37c28f37ca3857b8107a12e6d138a0719831eca52a836692909801c8b0bd
-SIZE (osmcode-libosmium-v2.17.2_GH0.tar.gz) = 569488
+TIMESTAMP = 1647270667
+SHA256 (osmcode-libosmium-v2.18.0_GH0.tar.gz) = c05a3e95c9c811521ebad8637e90f43ab8fb053b310875acce741cc4c17d6f59
+SIZE (osmcode-libosmium-v2.18.0_GH0.tar.gz) = 565862
diff --git a/astro/libosmium/files/patch-include_osmium_thread_util.hpp b/astro/libosmium/files/patch-include_osmium_thread_util.hpp
new file mode 100644
index 000000000000..fd7360b76bc0
--- /dev/null
+++ b/astro/libosmium/files/patch-include_osmium_thread_util.hpp
@@ -0,0 +1,29 @@
+--- include/osmium/thread/util.hpp.orig	2022-02-07 12:59:17 UTC
++++ include/osmium/thread/util.hpp
+@@ -38,8 +38,10 @@ DEALINGS IN THE SOFTWARE.
+ #include <thread>
+ #include <utility>
+ 
+-#ifdef __linux__
++#if defined(__linux__)
+ # include <sys/prctl.h>
++#elif defined(__FreeBSD__)
++# include <pthread.h>
+ #endif
+ 
+ namespace osmium {
+@@ -72,9 +74,13 @@ namespace osmium {
+         /**
+          * Set name of current thread for debugging. This only works on Linux.
+          */
+-#ifdef __linux__
++#if defined(__linux__)
+         inline void set_thread_name(const char* name) noexcept {
+             prctl(PR_SET_NAME, name, 0, 0, 0);
++        }
++#elif defined(__FreeBSD__)
++        inline void set_thread_name(const char* name) noexcept {
++			pthread_setname_np(pthread_self(), name);
+         }
+ #else
+         inline void set_thread_name(const char*) noexcept {
diff --git a/astro/libosmium/pkg-plist b/astro/libosmium/pkg-plist
index c92e69e41393..6b7f4389812b 100644
--- a/astro/libosmium/pkg-plist
+++ b/astro/libosmium/pkg-plist
@@ -19,7 +19,6 @@ include/osmium/area/problem_reporter_stream.hpp
 include/osmium/area/stats.hpp
 include/osmium/builder/attr.hpp
 include/osmium/builder/builder.hpp
-include/osmium/builder/builder_helper.hpp
 include/osmium/builder/osm_object_builder.hpp
 include/osmium/diff_handler.hpp
 include/osmium/diff_iterator.hpp
@@ -68,7 +67,6 @@ include/osmium/index/map/flex_mem.hpp
 include/osmium/index/map/sparse_file_array.hpp
 include/osmium/index/map/sparse_mem_array.hpp
 include/osmium/index/map/sparse_mem_map.hpp
-include/osmium/index/map/sparse_mem_table.hpp
 include/osmium/index/map/sparse_mmap_array.hpp
 include/osmium/index/multimap.hpp
 include/osmium/index/multimap/all.hpp
@@ -181,7 +179,6 @@ include/osmium/thread/function_wrapper.hpp
 include/osmium/thread/pool.hpp
 include/osmium/thread/queue.hpp
 include/osmium/thread/util.hpp
-include/osmium/util/cast.hpp
 include/osmium/util/compatibility.hpp
 include/osmium/util/config.hpp
 include/osmium/util/delta.hpp