git: b607e109fcba - main - devel/simpleini: install cmake files

From: Dmitry Marakasov <amdmi3_at_FreeBSD.org>
Date: Tue, 11 Jun 2024 18:38:40 UTC
The branch main has been updated by amdmi3:

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

commit b607e109fcbad6c4f61133fd020deaa136dba694
Author:     Dmitry Marakasov <amdmi3@FreeBSD.org>
AuthorDate: 2024-06-03 15:35:55 +0000
Commit:     Dmitry Marakasov <amdmi3@FreeBSD.org>
CommitDate: 2024-06-11 18:10:34 +0000

    devel/simpleini: install cmake files
    
    - Switch to upstream cmake build to install cmake target files properly
---
 devel/simpleini/Makefile                   | 16 ++++--------
 devel/simpleini/files/patch-CMakeLists.txt | 10 ++++++++
 devel/simpleini/files/patch-cmake-targets  | 41 ++++++++++++++++++++++++++++++
 devel/simpleini/pkg-plist                  |  4 +++
 4 files changed, 60 insertions(+), 11 deletions(-)

diff --git a/devel/simpleini/Makefile b/devel/simpleini/Makefile
index a09698fda3a6..5275e60d32db 100644
--- a/devel/simpleini/Makefile
+++ b/devel/simpleini/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	simpleini
 DISTVERSIONPREFIX=	v
 DISTVERSION=	4.22
+PORTREVISION=	1
 CATEGORIES=	devel
 
 MAINTAINER=	amdmi3@FreeBSD.org
@@ -10,30 +11,23 @@ WWW=		https://github.com/brofield/simpleini
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENCE.txt
 
+USES=		cmake:testing
 USE_GITHUB=	yes
 GH_ACCOUNT=	brofield
-NO_BUILD=	yes
 NO_ARCH=	yes
 CMAKE_ON=	SIMPLEINI_USE_SYSTEM_GTEST
 
 PORTDOCS=	*
 
-PLIST_FILES=	include/SimpleIni.h
-
 OPTIONS_DEFINE=	TEST DOCS
 
-TEST_USES=	pkgconfig
 TEST_BUILD_DEPENDS=	googletest>=0:devel/googletest
 
-do-install:
-	${INSTALL_DATA} ${WRKSRC}/SimpleIni.h ${STAGEDIR}${PREFIX}/include
+post-patch-TEST-off:
+	@${REINPLACE_CMD} -e '/add_subdirectory(tests/ d' ${WRKSRC}/CMakeLists.txt
 
-do-install-DOCS-on:
+post-install-DOCS-on:
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}
 	${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR}/
 
-do-test-TEST-on:
-	cd ${WRKSRC}/tests && ${SETENV} ${MAKE_ENV} ${TEST_ENV} \
-		${MAKE_CMD} ${_MAKE_JOBS} ${MAKE_ARGS} test
-
 .include <bsd.port.mk>
diff --git a/devel/simpleini/files/patch-CMakeLists.txt b/devel/simpleini/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..835b583840f6
--- /dev/null
+++ b/devel/simpleini/files/patch-CMakeLists.txt
@@ -0,0 +1,10 @@
+--- CMakeLists.txt.orig	2023-12-29 02:44:28 UTC
++++ CMakeLists.txt
+@@ -34,6 +34,7 @@ add_library(${EXPORT_NAMESPACE}${PROJECT_NAME} ALIAS $
+ 
+ add_library(${PROJECT_NAME} INTERFACE)
+ add_library(${EXPORT_NAMESPACE}${PROJECT_NAME} ALIAS ${PROJECT_NAME})
++target_compile_definitions(${PROJECT_NAME} INTERFACE SI_NO_CONVERSION)
+ 
+ include(GNUInstallDirs)
+ 
diff --git a/devel/simpleini/files/patch-cmake-targets b/devel/simpleini/files/patch-cmake-targets
new file mode 100644
index 000000000000..966b2529a634
--- /dev/null
+++ b/devel/simpleini/files/patch-cmake-targets
@@ -0,0 +1,41 @@
+From aeacf861a8ad8add5f4974792a88ffea393e41db Mon Sep 17 00:00:00 2001
+From: Alexandre Bouvier <contact@amb.tf>
+Date: Tue, 2 Jan 2024 08:42:03 +0100
+Subject: [PATCH] cmake: fix namespace and include dir (#74)
+
+---
+ CMakeLists.txt | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git CMakeLists.txt CMakeLists.txt
+index 8f09295..7804947 100644
+--- CMakeLists.txt
++++ CMakeLists.txt
+@@ -48,7 +48,7 @@ configure_package_config_file(${PROJECT_NAME}Config.cmake.in
+ )
+ 
+ install(FILES SimpleIni.h
+-	DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
++	DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ )
+ 
+ install(TARGETS ${PROJECT_NAME}
+@@ -62,12 +62,15 @@ install(FILES
+ )
+ install(EXPORT ${PROJECT_NAME}Targets
+ 	DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake/${PROJECT_NAME}
+-	NAMESPACE EXPORT_NAMESPACE
++	NAMESPACE ${EXPORT_NAMESPACE}
+ )
+ 
+-target_include_directories(${PROJECT_NAME} INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
++target_include_directories(${PROJECT_NAME} INTERFACE
++	$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
++	$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
++)
+ 
+ if(IS_TOPLEVEL_PROJECT)
+-	enable_testing()
++	include(CTest)
+ 	add_subdirectory(tests)
+ endif()
diff --git a/devel/simpleini/pkg-plist b/devel/simpleini/pkg-plist
new file mode 100644
index 000000000000..36349f911b1b
--- /dev/null
+++ b/devel/simpleini/pkg-plist
@@ -0,0 +1,4 @@
+include/SimpleIni.h
+share/cmake/SimpleIni/SimpleIniConfig.cmake
+share/cmake/SimpleIni/SimpleIniConfigVersion.cmake
+share/cmake/SimpleIni/SimpleIniTargets.cmake