git: 09dc34631b1e - main - devel/mongo-c-driver: Rework port

From: Daniel Engberg <diizzy_at_FreeBSD.org>
Date: Mon, 20 Feb 2023 21:24:02 UTC
The branch main has been updated by diizzy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=09dc34631b1ec320ea53b44cf8a5389bc503d02f

commit 09dc34631b1ec320ea53b44cf8a5389bc503d02f
Author:     Daniel Engberg <diizzy@FreeBSD.org>
AuthorDate: 2023-02-20 21:15:02 +0000
Commit:     Daniel Engberg <diizzy@FreeBSD.org>
CommitDate: 2023-02-20 21:23:58 +0000

    devel/mongo-c-driver: Rework port
    
    * Use upstream release archive as recommended by Porters Handbook
    * Remove cyrus-sasl2 from LIB_DEPENDS
    * Use framework helpers when possible
    * Rearrange Makefile to better follow Porters Handbook and easier readability
    * Don't install unnecessary files in share directory
    
    PR:             269625
    Reviewed by:    Krzysztof <ports@bsdserwis.com> (maintainer)
---
 devel/mongo-c-driver/Makefile                      | 74 ++++++++++++----------
 devel/mongo-c-driver/distinfo                      |  6 +-
 ..._libmongoc_src_mongoc_mongoc-counters-private.h |  6 +-
 devel/mongo-c-driver/pkg-plist                     | 20 ++----
 4 files changed, 50 insertions(+), 56 deletions(-)

diff --git a/devel/mongo-c-driver/Makefile b/devel/mongo-c-driver/Makefile
index ed38905ed3ea..387d02a760fa 100644
--- a/devel/mongo-c-driver/Makefile
+++ b/devel/mongo-c-driver/Makefile
@@ -1,6 +1,8 @@
 PORTNAME=	mongo-c-driver
-PORTVERSION=	1.23.2
+DISTVERSION=	1.23.2
+PORTREVISION=	1
 CATEGORIES=	devel
+MASTER_SITES=	https://github.com/mongodb/${PORTNAME}/releases/download/${DISTVERSION}/
 
 MAINTAINER=	ports@bsdserwis.com
 COMMENT=	C Driver for MongoDB
@@ -9,54 +11,57 @@ WWW=		https://github.com/mongodb/mongo-c-driver
 LICENSE=	APACHE20
 LICENSE_FILE=	${WRKSRC}/COPYING
 
-USES=		cmake:noninja cpe pkgconfig
-USE_GITHUB=	yes
+LIB_DEPENDS=	libbson-1.0.so:devel/libbson \
+		libzstd.so:archivers/zstd
+
+USES=		cmake cpe pathfix pkgconfig python:env
 CPE_VENDOR=	mongodb
-GH_ACCOUNT=	mongodb
 USE_LDCONFIG=	yes
 
-LIB_DEPENDS=	libsasl2.so:security/cyrus-sasl2 \
-		libbson-1.0.so:devel/libbson \
-		libzstd.so:archivers/zstd
-SNAPPY_LIB_DEPENDS=	libsnappy.so:archivers/snappy
-SASL_LIB_DEPENDS=	libsasl2.so:security/cyrus-sasl2
-DOCS_VARS=	BUILD_DEPENDS+=sphinx-build:textproc/py-sphinx
-
-PATCH_STRIP=	-p1
 CFLAGS+=	-D__BSD_VISIBLE=1
-LDFLAGS+=	-pthread
 
-OPTIONS_DEFINE=	CRYPTOPROFILE DOCS RDTSCP SASL SNAPPY SSL
+CMAKE_OFF=	BUILD_TESTING \
+		ENABLE_EXAMPLES \
+		ENABLE_ICU \
+		ENABLE_TESTS \
+		ENABLE_UNINSTALL
+CMAKE_ON=	ENABLE_MONGOC \
+		ENABLE_ZSTD
+CMAKE_ARGS=	-DENABLE_BSON=SYSTEM \
+		-DENABLE_ZLIB=SYSTEM
+
+OPTIONS_DEFINE=		CRYPTOPROFILE DOCS RDTSCP SASL SNAPPY SSL
 OPTIONS_DEFAULT=	SSL
-OPTIONS_SUB=	yes
-CRYPTOPROFILE_DESC=	Use system crypto profile (require OPENSSL)
-RDTSCP_DESC=	Fast performance counters on Intel using the RDTSCP instruction
-SSL_DESC=	Enable TLS connections and SCRAM-SHA-1 authentication
-SSL_USES=	ssl
-SSL_CMAKE_OFF=	-DENABLE_SSL=OFF
-CRYPTOPROFILE_IMPLIES=	SSL
-
-CMAKE_ON=	ENABLE_EXAMPLES
-CMAKE_OFF=	ENABLE_TESTS ENABLE_UNINSTALL
-CMAKE_ARGS=	-DENABLE_MONGOC=ON -DENABLE_BSON=SYSTEM
-CMAKE_ARGS+=	-DENABLE_ZLIB=SYSTEM -DENABLE_ZSTD=ON
-CMAKE_ARGS+=	-DBSON_HAVE_STRINGS_H=0
-DOCS_CMAKE_ON=	-DENABLE_HTML_DOCS=ON -DENABLE_MAN_PAGES=ON
+OPTIONS_SUB=		yes
+
+CRYPTOPROFILE_DESC=	Use system crypto profile (requires OpenSSL)
+RDTSCP_DESC=		Fast performance counters on Intel using the RDTSCP instruction
+
+DOCS_BUILD_DEPENDS=	${PYTHON_PKGNAMEPREFIX}sphinx>0:textproc/py-sphinx@${PY_FLAVOR}
+DOCS_CMAKE_ON=		-DENABLE_HTML_DOCS=ON -DENABLE_MAN_PAGES=ON
+
 RDTSCP_CMAKE_ON=	-DENABLE_RDTSCP=ON
 RDTSCP_CMAKE_OFF=	-DENABLE_RDTSCP=OFF
-SASL_CMAKE_ON=	-DENABLE_SASL=CYRUS
-SASL_CMAKE_OFF=	-DENABLE_SASL=OFF
+
+SASL_LIB_DEPENDS=	libsasl2.so:security/cyrus-sasl2
+SASL_CMAKE_ON=		-DENABLE_SASL=CYRUS
+SASL_CMAKE_OFF=		-DENABLE_SASL=OFF
+
+SNAPPY_LIB_DEPENDS=	libsnappy.so:archivers/snappy
 SNAPPY_CMAKE_ON=	-DENABLE_SNAPPY=ON
 SNAPPY_CMAKE_OFF=	-DENABLE_SNAPPY=OFF
 
+SSL_USES=		ssl
+
 .include <bsd.port.options.mk>
 
 .if ${PORT_OPTIONS:MSSL}
-.	if ${SSL_DEFAULT:Mlibressl*}
+.if	${SSL_DEFAULT:Mlibressl*}
 CMAKE_ARGS+=	-DENABLE_SSL=LIBRESSL
-.	else
+.endif
 CMAKE_ARGS+=	-DENABLE_SSL=OPENSSL
-.	endif
+.else
+CMAKE_ARGS+=	-DENABLE_SSL=OFF
 .endif
 
 .if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1300523
@@ -70,9 +75,10 @@ pre-configure-CRYPTOPROFILE-on:
 .endif
 
 post-extract:
-	${ECHO} "${PORTVERSION}" > ${WRKSRC}/VERSION_CURRENT
+	${ECHO} "${DISTVERSION}" > ${WRKSRC}/VERSION_CURRENT
 
 post-install:
+	${RM} -r ${STAGEDIR}${PREFIX}/share/${PORTNAME}
 	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/mongoc-stat
 
 .include <bsd.port.mk>
diff --git a/devel/mongo-c-driver/distinfo b/devel/mongo-c-driver/distinfo
index 85c00a497c9b..554191df12d5 100644
--- a/devel/mongo-c-driver/distinfo
+++ b/devel/mongo-c-driver/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1673293086
-SHA256 (mongodb-mongo-c-driver-1.23.2_GH0.tar.gz) = a0f944ba659586d3a0751cdb544876ddf1ae2796efabba02a6af75efd8c61b1a
-SIZE (mongodb-mongo-c-driver-1.23.2_GH0.tar.gz) = 6498979
+TIMESTAMP = 1676629962
+SHA256 (mongo-c-driver-1.23.2.tar.gz) = 123c358827eea07cd76a31c40281bb1c81b6744f6587c96d0cf217be8b1234e3
+SIZE (mongo-c-driver-1.23.2.tar.gz) = 7781649
diff --git a/devel/mongo-c-driver/files/extra-patch-src_libmongoc_src_mongoc_mongoc-counters-private.h b/devel/mongo-c-driver/files/extra-patch-src_libmongoc_src_mongoc_mongoc-counters-private.h
index 1c4e96a15357..a0e02f62e210 100644
--- a/devel/mongo-c-driver/files/extra-patch-src_libmongoc_src_mongoc_mongoc-counters-private.h
+++ b/devel/mongo-c-driver/files/extra-patch-src_libmongoc_src_mongoc_mongoc-counters-private.h
@@ -1,7 +1,5 @@
-diff --git a/src/libmongoc/src/mongoc/mongoc-counters-private.h b/src/libmongoc/src/mongoc/mongoc-counters-private.h
-index ddd4d4954..c22908af0 100644
---- a/src/libmongoc/src/mongoc/mongoc-counters-private.h
-+++ b/src/libmongoc/src/mongoc/mongoc-counters-private.h
+--- src/libmongoc/src/mongoc/mongoc-counters-private.h.orig	2023-01-03 15:52:22 UTC
++++ src/libmongoc/src/mongoc/mongoc-counters-private.h
 @@ -28,6 +28,7 @@
  #include <sys/sysinfo.h>
  #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || \
diff --git a/devel/mongo-c-driver/pkg-plist b/devel/mongo-c-driver/pkg-plist
index f9a1b9a654c3..dc966ac5ea8a 100644
--- a/devel/mongo-c-driver/pkg-plist
+++ b/devel/mongo-c-driver/pkg-plist
@@ -72,28 +72,22 @@ libdata/pkgconfig/libmongoc-static-1.0.pc
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_images/msvc-create-project.png
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_images/msvc-set-path.png
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_images/msvc-switch-architecture.png
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/ajax-loader.gif
+%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/_sphinx_javascript_frameworks_compat.js
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/basic.css
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/comment-bright.png
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/comment-close.png
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/comment.png
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/doctools.js
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/documentation_options.js
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/down-pressed.png
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/down.png
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/file.png
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/jquery-3.2.1.js
+%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/jquery-3.6.0.js
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/jquery.js
+%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/language_data.js
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/minus.png
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/plus.png
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/pygments.css
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/readable.css
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/searchtools.js
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/underscore-1.3.1.js
+%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/sphinx_highlight.js
+%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/underscore-1.13.1.js
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/underscore.js
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/up-pressed.png
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/up.png
-%%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/_static/websupport.js
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/advanced-connections.html
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/aggregate.html
 %%PORTDOCS%%%%DOCSDIR%%/mongo-c-driver/html/api.html
@@ -1470,7 +1464,3 @@ libdata/pkgconfig/libmongoc-static-1.0.pc
 %%PORTDOCS%%share/man/man3/mongoc_write_concern_set_wtimeout.3.gz
 %%PORTDOCS%%share/man/man3/mongoc_write_concern_set_wtimeout_int64.3.gz
 %%PORTDOCS%%share/man/man3/mongoc_write_concern_t.3.gz
-%%DATADIR%%/COPYING
-%%DATADIR%%/NEWS
-%%DATADIR%%/README.rst
-%%DATADIR%%/THIRD_PARTY_NOTICES