git: 1e4da4ba03aa - main - devel/poco: Modernize port Makefile

From: Felix Palmen <zirias_at_FreeBSD.org>
Date: Sun, 16 Jul 2023 15:05:00 UTC
The branch main has been updated by zirias:

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

commit 1e4da4ba03aa0210cd1c9eed23f68053a41335c3
Author:     Felix Palmen <zirias@FreeBSD.org>
AuthorDate: 2023-07-15 12:12:51 +0000
Commit:     Felix Palmen <zirias@FreeBSD.org>
CommitDate: 2023-07-16 15:01:36 +0000

    devel/poco: Modernize port Makefile
    
    * Replace CMAKE_ARGS and <opt>_CMAKE_[ON|OFF] by CMAKE_[ON|OFF] and
      <opt>_CMAKE_BOOL[_OFF] for handling cmake BOOL knobs
    * Drop a CONFLICTS to a port that was removed in 2019
    * As advised by portclippy, put all options descriptions in their own
      block
    
    Approved by:    portmgr (blanket)
---
 devel/poco/Makefile | 97 ++++++++++++++++++++++++-----------------------------
 1 file changed, 43 insertions(+), 54 deletions(-)

diff --git a/devel/poco/Makefile b/devel/poco/Makefile
index f3df7c1dcc62..e5c9e874ce3f 100644
--- a/devel/poco/Makefile
+++ b/devel/poco/Makefile
@@ -15,73 +15,77 @@ LIB_DEPENDS=	libpcre2-8.so:devel/pcre2 \
 		libexpat.so:textproc/expat2
 
 USES=		cmake compiler:c++14-lang cpe localbase pkgconfig tar:bz2
-USE_LDCONFIG=	yes
-
-CONFLICTS=	poco-ssl
-
 CPE_VENDOR=	pocoproject
+USE_LDCONFIG=	yes
 
-CMAKE_ARGS=	-DPOCO_UNBUNDLED:BOOL=ON
+CMAKE_ON=	POCO_UNBUNDLED
 SHLIB_MAJOR=	94
 PLIST_SUB=	SHLIB_MAJOR=${SHLIB_MAJOR}
 
 OPTIONS_DEFINE=		ACTIVERECORD ENCODINGS JSON JWT MONGODB PAGECOMPILER \
 			PROMETHEUS REDIS SSL TEST XML ZIP
-OPTIONS_RADIO=		ODBC
-OPTIONS_RADIO_ODBC=	IODBC UNIXODBC
-OPTIONS_GROUP=		DB
-OPTIONS_GROUP_DB=	MYSQL PGSQL SQLITE
 OPTIONS_DEFAULT=	ACTIVERECORD ENCODINGS JSON JWT MYSQL MONGODB \
 			PAGECOMPILER PGSQL PROMETHEUS REDIS SQLITE SSL \
 			XML ZIP
+OPTIONS_GROUP=		DB
+OPTIONS_GROUP_DB=	MYSQL PGSQL SQLITE
+OPTIONS_RADIO=		ODBC
+OPTIONS_RADIO_ODBC=	IODBC UNIXODBC
 OPTIONS_SUB=		yes
 
-# Database support
+ACTIVERECORD_DESC=	Enable ActiveRecord ORM and compiler
 DB_DESC=		Database support
+ENCODINGS_DESC=		Enable Encodings component
+JWT_DESC=		Enable JWT (JSON Web Token) component
+MONGODB_DESC=		Enable MongoDB support
+PAGECOMPILER_DESC=	Enable PageCompiler and File2Page
+PROMETHEUS_DESC=	Enable Prometheus component
+ZIP_DESC=		Enable Zip support
+
+# Database support
 MYSQL_USES=		mysql
-MYSQL_CMAKE_OFF=	-DENABLE_DATA_MYSQL:BOOL=OFF
+MYSQL_CMAKE_BOOL=	ENABLE_DATA_MYSQL
 PGSQL_USES=		pgsql
-PGSQL_CMAKE_OFF=	-DENABLE_DATA_POSTGRESQL:BOOL=OFF
+PGSQL_CMAKE_BOOL=	ENABLE_DATA_POSTGRESQL
 SQLITE_USES=		sqlite
-SQLITE_CMAKE_OFF=	-DENABLE_DATA_SQLITE:BOOL=OFF
+SQLITE_CMAKE_BOOL=	ENABLE_DATA_SQLITE
 IODBC_LIB_DEPENDS=	libiodbc.so:databases/libiodbc
 IODBC_CMAKE_ON=		-DODBC_INCLUDE_DIR:PATH=${LOCALBASE}/include/libiodbc \
 			-DODBC_LIBRARIES:FILEPATH=${LOCALBASE}/lib/libiodbc.so
 UNIXODBC_LIB_DEPENDS=	libodbc.so:databases/unixODBC
-UNIXODBC_CMAKE_ON=	-DODBC_INCLUDE_DIR:PATH=${LOCALBASE}/include \
-			-DODBC_LIBRARIES:FILEPATH=${LOCALBASE}/lib/libodbc.so
+UNIXODBC_CMAKE_ON=	-DODBC_LIBRARIES:FILEPATH=${LOCALBASE}/lib/libodbc.so
 
 # Key-value store support
-MONGODB_DESC=		Enable MongoDB support
-MONGODB_CMAKE_OFF=	-DENABLE_MONGODB:BOOL=OFF
-REDIS_CMAKE_OFF=	-DENABLE_REDIS:BOOL=OFF
+MONGODB_CMAKE_BOOL=	ENABLE_MONGODB
+REDIS_CMAKE_BOOL=	ENABLE_REDIS
 
 # Components
 ACTIVERECORD_IMPLIES=	XML
-ACTIVERECORD_CMAKE_OFF=	-DENABLE_ACTIVERECORD:BOOL=OFF \
-			-DENABLE_ACTIVERECORD_COMPILER:BOOL=OFF
-ACTIVERECORD_DESC=	Enable ActiveRecord ORM and compiler
-ENCODINGS_CMAKE_OFF=	-DENABLE_ENCODINGS:BOOL=OFF
-ENCODINGS_DESC=		Enable Encodings component
-JSON_CMAKE_OFF=		-DENABLE_JSON:BOOL=OFF
-JWT_CMAKE_OFF=		-DENABLE_JWT:BOOL=OFF
-JWT_DESC=		Enable JWT (JSON Web Token) component
+ACTIVERECORD_CMAKE_BOOL=	ENABLE_ACTIVERECORD \
+				ENABLE_ACTIVERECORD_COMPILER
+ENCODINGS_CMAKE_BOOL=	ENABLE_ENCODINGS
+JSON_CMAKE_BOOL=	ENABLE_JSON
 JWT_IMPLIES=		JSON SSL
-PAGECOMPILER_CMAKE_OFF=	-DENABLE_PAGECOMPILER:BOOL=OFF \
-			-DENABLE_PAGECOMPILER_FILE2PAGE:BOOL=OFF
-PAGECOMPILER_DESC=	Enable PageCompiler and File2Page
-PROMETHEUS_CMAKE_OFF=	-DENABLE_PROMETHEUS:BOOL=OFF
-PROMETHEUS_DESC=	Enable Prometheus component
+JWT_CMAKE_BOOL=		ENABLE_JWT
+PAGECOMPILER_CMAKE_BOOL=	ENABLE_PAGECOMPILER \
+				ENABLE_PAGECOMPILER_FILE2PAGE
+PROMETHEUS_CMAKE_BOOL=	ENABLE_PROMETHEUS
 SSL_USES=		ssl
-SSL_CMAKE_OFF=		-DENABLE_CRYPTO:BOOL=OFF \
-			-DENABLE_NETSSL:BOOL=OFF \
-			-DENABLE_JWT:BOOL=OFF
-TEST_CMAKE_ON=		-DENABLE_TESTS:BOOL=ON
+SSL_CMAKE_BOOL=		ENABLE_CRYPTO ENABLE_NETSSL
 TEST_IMPLIES=		JSON SQLITE SSL XML
+TEST_CMAKE_BOOL=	ENABLE_TESTS
 TEST_TEST_TARGET=	test
-XML_CMAKE_OFF=		-DENABLE_XML:BOOL=OFF
-ZIP_CMAKE_OFF=		-DENABLE_ZIP:BOOL=OFF
-ZIP_DESC=		Enable Zip support
+XML_CMAKE_BOOL=		ENABLE_XML
+ZIP_CMAKE_BOOL=		ENABLE_ZIP
+
+post-patch:
+	@${REINPLACE_CMD} -e \
+		's|CMAKE_DEBUG_POSTFIX "d"|CMAKE_DEBUG_POSTFIX ""|' \
+		 ${WRKSRC}/cmake/DefinePlatformSpecifc.cmake
+
+# Avoid conflict with archivers/arc
+post-install-ACTIVERECORD-on:
+	@${MV} ${STAGEDIR}${PREFIX}/bin/arc ${STAGEDIR}${PREFIX}/bin/arc-poco
 
 .include <bsd.port.options.mk>
 
@@ -94,23 +98,8 @@ PLIST_SUB+=	DATA="@comment "
 .if ${PORT_OPTIONS:MIODBC} || ${PORT_OPTIONS:MUNIXODBC}
 PLIST_SUB+=	ODBC=""
 .else
-CMAKE_ARGS+=	-DENABLE_DATA_ODBC:BOOL=OFF
+CMAKE_OFF+=	ENABLE_DATA_ODBC
 PLIST_SUB+=	ODBC="@comment "
 .endif
 
-.for opt in ${_ALL_OPTIONS}
-.if !${OPTIONS_DEFINE:M${opt}}
-PLIST_SUB+=	${opt}="@comment "
-.endif
-.endfor
-
-post-patch:
-	@${REINPLACE_CMD} -e \
-		's|CMAKE_DEBUG_POSTFIX "d"|CMAKE_DEBUG_POSTFIX ""|' \
-		 ${WRKSRC}/cmake/DefinePlatformSpecifc.cmake
-
-# Avoid conflict with archivers/arc
-post-install-ACTIVERECORD-on:
-	@${MV} ${STAGEDIR}${PREFIX}/bin/arc ${STAGEDIR}${PREFIX}/bin/arc-poco
-
 .include <bsd.port.mk>