git: 3c16f8786105 - main - math/py-kahip: New port: Karlsruhe high quality graph partitioning

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Sun, 26 Jun 2022 07:20:33 UTC
The branch main has been updated by yuri:

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

commit 3c16f87861059ca3cba2b404a1f70abf10f22a78
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-06-26 07:19:31 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-06-26 07:20:19 +0000

    math/py-kahip: New port: Karlsruhe high quality graph partitioning
---
 math/Makefile                      |  1 +
 math/py-kahip/Makefile             | 40 ++++++++++++++++++++++++++++++++++++++
 math/py-kahip/distinfo             |  3 +++
 math/py-kahip/files/CMakeLists.txt |  7 +++++++
 math/py-kahip/pkg-descr            | 12 ++++++++++++
 5 files changed, 63 insertions(+)

diff --git a/math/Makefile b/math/Makefile
index 36314ef12293..82f1307f96c7 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -876,6 +876,7 @@
     SUBDIR += py-iohexperimenter
     SUBDIR += py-ipyopt
     SUBDIR += py-jax
+    SUBDIR += py-kahip
     SUBDIR += py-keras
     SUBDIR += py-keras-applications
     SUBDIR += py-keras-preprocessing
diff --git a/math/py-kahip/Makefile b/math/py-kahip/Makefile
new file mode 100644
index 000000000000..235ebdb2a37c
--- /dev/null
+++ b/math/py-kahip/Makefile
@@ -0,0 +1,40 @@
+PORTNAME=	kahip
+DISTVERSIONPREFIX=	v
+DISTVERSION=	3.14-19
+DISTVERSIONSUFFIX=	-g5956007
+CATEGORIES=	math
+PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Karlsruhe high quality graph partitioning
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+BUILD_DEPENDS=	pybind11>0:devel/pybind11
+LIB_DEPENDS=	libkahip.so:math/kahip
+
+USES=		cmake localbase:ldflags python
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	KaHIP
+GH_PROJECT=	KaHIP
+
+CMAKE_SOURCE_PATH=	${FILESDIR}/CMakeLists.txt
+CMAKE_ARGS=	-DFREEBSD_WRKSRC=${WRKSRC}
+
+CXXFLAGS+=	-I${WRKSRC}
+
+PLIST_FILES=	${PYTHON_SITELIBDIR}/${PORTNAME}${PYTHON_EXT_SUFFIX}.so
+
+do-install:
+	@${MKDIR} ${STAGEDIR}${PYTHON_SITELIBDIR}
+	${INSTALL_LIB} ${BUILD_WRKSRC}/${PORTNAME}${PYTHON_EXT_SUFFIX}.so ${STAGEDIR}${PYTHON_SITELIBDIR}
+
+do-test:
+	@cd ${WRKSRC} && \
+		${SETENV} ${TEST_ENV} ${PYTHON_CMD} ${WRKSRC}/misc/pymodule/callkahipfrompython.py && \
+		${ECHO} "Tests succeeded."
+
+.include <bsd.port.mk>
diff --git a/math/py-kahip/distinfo b/math/py-kahip/distinfo
new file mode 100644
index 000000000000..b8fcf57265a2
--- /dev/null
+++ b/math/py-kahip/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1656203807
+SHA256 (KaHIP-KaHIP-v3.14-19-g5956007_GH0.tar.gz) = c890983b9fd4ba2464526981c3677a63de9ea8d4e6c518e3140a9ee7a45cf99a
+SIZE (KaHIP-KaHIP-v3.14-19-g5956007_GH0.tar.gz) = 3061437
diff --git a/math/py-kahip/files/CMakeLists.txt b/math/py-kahip/files/CMakeLists.txt
new file mode 100644
index 000000000000..f95d97c2fd53
--- /dev/null
+++ b/math/py-kahip/files/CMakeLists.txt
@@ -0,0 +1,7 @@
+cmake_minimum_required(VERSION 3.23.0)
+project(kahip LANGUAGES CXX)
+
+find_package(pybind11 REQUIRED)
+pybind11_add_module(kahip_python_binding ${FREEBSD_WRKSRC}/misc/pymodule/kahip.cpp)
+target_link_libraries(kahip_python_binding PUBLIC kahip)
+set_target_properties(kahip_python_binding PROPERTIES OUTPUT_NAME "kahip")
diff --git a/math/py-kahip/pkg-descr b/math/py-kahip/pkg-descr
new file mode 100644
index 000000000000..d7c4719d6170
--- /dev/null
+++ b/math/py-kahip/pkg-descr
@@ -0,0 +1,12 @@
+KaHIP - Karlsruhe High Quality Partitioning - is a family of graph
+partitioning programs. It includes KaFFPa (Karlsruhe Fast Flow
+Partitioner), which is a multilevel graph partitioning algorithm, in
+its variants Strong, Eco and Fast, KaFFPaE (KaFFPaEvolutionary) which
+is a parallel evolutionary algorithm that uses KaFFPa to provide
+combine and mutation operations, as well as KaBaPE which extends the
+evolutionary algorithm. Moreover, specialized techniques are included
+to partition road networks (Buffoon), to output a vertex separator
+from a given partition or techniques geared towards efficient
+partitioning of social networks.
+
+WWW: https://kahip.github.io/