git: 2e5eef9e1035 - main - devel/libnest2d-ultimaker: Update for cura 5.7

From: Diane Bruce <db_at_FreeBSD.org>
Date: Wed, 04 Sep 2024 20:05:00 UTC
The branch main has been updated by db:

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

commit 2e5eef9e103594b9396a69b26e14bc135aa4c2e7
Author:     Matthieu Volat <mazhe@alkumuna.eu>
AuthorDate: 2024-09-04 20:02:36 +0000
Commit:     Diane Bruce <db@FreeBSD.org>
CommitDate: 2024-09-04 20:04:42 +0000

    devel/libnest2d-ultimaker: Update for cura 5.7
    
    - upgrade in preparation for cura
---
 devel/libnest2d-ultimaker/Makefile                 | 23 ++++--
 devel/libnest2d-ultimaker/distinfo                 |  6 +-
 devel/libnest2d-ultimaker/files/Findclipper.cmake  | 88 ++++++++++++++++++++++
 .../libnest2d-ultimaker/files/patch-CMakeLists.txt | 23 ++++++
 devel/libnest2d-ultimaker/pkg-plist                |  8 +-
 5 files changed, 131 insertions(+), 17 deletions(-)

diff --git a/devel/libnest2d-ultimaker/Makefile b/devel/libnest2d-ultimaker/Makefile
index 389da1444cb4..9dd374199606 100644
--- a/devel/libnest2d-ultimaker/Makefile
+++ b/devel/libnest2d-ultimaker/Makefile
@@ -1,8 +1,5 @@
 PORTNAME=	libnest2d-ultimaker
-# XXX there is no 4.13.1
-# https://github.com/Ultimaker/libnest2d/tags
-DISTVERSION=	4.12.0
-PORTREVISION=	3
+DISTVERSION=	5.3.0
 CATEGORIES=	devel
 
 MAINTAINER=	db@FreeBSD.org
@@ -13,14 +10,26 @@ LICENSE=	LGPL3
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
 LIB_DEPENDS=	libboost_system.so:devel/boost-libs \
-	libpolyclipping.so:graphics/polyclipping \
-	libnlopt.so:math/nlopt
+		libpolyclipping.so:graphics/polyclipping \
+		libnlopt.so:math/nlopt
 
-USES=	cmake
+USES=		cmake
 USE_GITHUB=	yes
 GH_ACCOUNT=	Ultimaker
 GH_PROJECT=	libnest2d
+STRIP=
+
+CMAKE_ARGS+=	-DGEOMETRIES=clipper \
+		-DOPTIMIZER=nlopt \
+		-DTHREADING=omp
 
 NO_ARCH=	yes
 
+post-extract:
+	@${MKDIR} ${WRKSRC}/cmake
+	@${CP} ${FILESDIR}/Findclipper.cmake ${WRKSRC}/cmake
+
+do-install:
+	@${CP} -r ${WRKSRC}/include/libnest2d ${STAGEDIR}${PREFIX}/include
+
 .include <bsd.port.mk>
diff --git a/devel/libnest2d-ultimaker/distinfo b/devel/libnest2d-ultimaker/distinfo
index 897d2fdd0d2d..d1ec3ce80d14 100644
--- a/devel/libnest2d-ultimaker/distinfo
+++ b/devel/libnest2d-ultimaker/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1643649196
-SHA256 (Ultimaker-libnest2d-4.12.0_GH0.tar.gz) = 38ff1a82a3819c521d0203ff84b2850f12a3038cc7cf933aa295c182736c4b3b
-SIZE (Ultimaker-libnest2d-4.12.0_GH0.tar.gz) = 366602
+TIMESTAMP = 1713678948
+SHA256 (Ultimaker-libnest2d-5.3.0_GH0.tar.gz) = 06786cce8fb489f8069e7f77882e0a8658fecce6de4f6edec8c147ef5f184020
+SIZE (Ultimaker-libnest2d-5.3.0_GH0.tar.gz) = 350790
diff --git a/devel/libnest2d-ultimaker/files/Findclipper.cmake b/devel/libnest2d-ultimaker/files/Findclipper.cmake
new file mode 100644
index 000000000000..bcdd121cbaac
--- /dev/null
+++ b/devel/libnest2d-ultimaker/files/Findclipper.cmake
@@ -0,0 +1,88 @@
+# Find Clipper library (http://www.angusj.com/delphi/clipper.php).
+# The following variables are set
+#
+# CLIPPER_FOUND
+# CLIPPER_INCLUDE_DIRS
+# CLIPPER_LIBRARIES
+#
+# It searches the environment variable $CLIPPER_PATH automatically.
+
+unset(CLIPPER_FOUND CACHE)
+unset(CLIPPER_INCLUDE_DIRS CACHE)
+unset(CLIPPER_LIBRARIES CACHE)
+unset(CLIPPER_LIBRARIES_RELEASE CACHE)
+unset(CLIPPER_LIBRARIES_DEBUG CACHE)
+
+if(CMAKE_BUILD_TYPE MATCHES "(Debug|DEBUG|debug)")
+    set(CLIPPER_BUILD_TYPE DEBUG)
+else()
+    set(CLIPPER_BUILD_TYPE RELEASE)
+endif()
+
+FIND_PATH(CLIPPER_INCLUDE_DIRS clipper.hpp
+    $ENV{CLIPPER_PATH}
+    $ENV{CLIPPER_PATH}/cpp/
+    $ENV{CLIPPER_PATH}/include/
+    $ENV{CLIPPER_PATH}/include/polyclipping/
+    ${PROJECT_SOURCE_DIR}/python/pymesh/third_party/include/
+    ${PROJECT_SOURCE_DIR}/python/pymesh/third_party/include/polyclipping/
+    ${CMAKE_PREFIX_PATH}/include/polyclipping
+    ${CMAKE_PREFIX_PATH}/include/
+    /opt/local/include/
+    /opt/local/include/polyclipping/
+    /usr/local/include/
+    /usr/local/include/polyclipping/
+    /usr/include
+    /usr/include/polyclipping/)
+
+set(LIB_SEARCHDIRS 
+    $ENV{CLIPPER_PATH}
+    $ENV{CLIPPER_PATH}/cpp/
+    $ENV{CLIPPER_PATH}/cpp/build/
+    $ENV{CLIPPER_PATH}/lib/
+    $ENV{CLIPPER_PATH}/lib/polyclipping/
+    ${PROJECT_SOURCE_DIR}/python/pymesh/third_party/lib/
+    ${PROJECT_SOURCE_DIR}/python/pymesh/third_party/lib/polyclipping/
+    ${CMAKE_PREFIX_PATH}/lib/
+    ${CMAKE_PREFIX_PATH}/lib/polyclipping/
+    /opt/local/lib/
+    /opt/local/lib/polyclipping/
+    /usr/local/lib/
+    /usr/local/lib/polyclipping/
+    /usr/lib/polyclipping
+)
+
+set(_deb_postfix "d")
+
+FIND_LIBRARY(CLIPPER_LIBRARIES_RELEASE polyclipping ${LIB_SEARCHDIRS})
+FIND_LIBRARY(CLIPPER_LIBRARIES_DEBUG polyclipping${_deb_postfix} ${LIB_SEARCHDIRS})
+
+if(CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE})
+    set(CLIPPER_LIBRARIES "${CLIPPER_LIBRARIES_${CLIPPER_BUILD_TYPE}}")
+else()
+    set(CLIPPER_LIBRARIES "${CLIPPER_LIBRARIES_RELEASE}")
+endif()
+
+include(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(clipper
+    "Clipper library cannot be found.  Consider set CLIPPER_PATH environment variable"
+    CLIPPER_INCLUDE_DIRS
+    CLIPPER_LIBRARIES)
+
+MARK_AS_ADVANCED(
+    CLIPPER_INCLUDE_DIRS
+    CLIPPER_LIBRARIES)
+
+if(CLIPPER_FOUND)
+    add_library(Clipper::Clipper UNKNOWN IMPORTED)
+    set_target_properties(Clipper::Clipper PROPERTIES IMPORTED_LOCATION ${CLIPPER_LIBRARIES})
+    set_target_properties(Clipper::Clipper PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${CLIPPER_INCLUDE_DIRS})
+    if(CLIPPER_LIBRARIES_RELEASE AND CLIPPER_LIBRARIES_DEBUG)
+        set_target_properties(Clipper::Clipper PROPERTIES
+            IMPORTED_LOCATION_DEBUG          ${CLIPPER_LIBRARIES_DEBUG}
+            IMPORTED_LOCATION_RELWITHDEBINFO ${CLIPPER_LIBRARIES_RELEASE}
+            IMPORTED_LOCATION_RELEASE        ${CLIPPER_LIBRARIES_RELEASE}
+            IMPORTED_LOCATION_MINSIZEREL     ${CLIPPER_LIBRARIES_RELEASE}
+        )
+    endif()
+endif()
diff --git a/devel/libnest2d-ultimaker/files/patch-CMakeLists.txt b/devel/libnest2d-ultimaker/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..bd77ee535b84
--- /dev/null
+++ b/devel/libnest2d-ultimaker/files/patch-CMakeLists.txt
@@ -0,0 +1,23 @@
+--- CMakeLists.txt.orig	2023-09-11 12:51:21 UTC
++++ CMakeLists.txt
+@@ -1,8 +1,10 @@ cmake_minimum_required(VERSION 3.20)
+ cmake_policy(SET CMP0091 NEW)
+ project(libnest2d)
+ cmake_minimum_required(VERSION 3.20)
+-find_package(standardprojectsettings REQUIRED)
++#find_package(standardprojectsettings REQUIRED)
+ 
++list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
++
+ option(BUILD_SHARED_LIBS "Build shared libs instead of static (applies for dependencies as well)" OFF)
+ option(HEADER_ONLY "If enabled static library will not be built." ON)
+ option(ENABLE_TESTING "Build with Google unittest" OFF)
+@@ -11,7 +13,7 @@ add_library(project_options INTERFACE)
+ set(THREADING std CACHE STRING "Multithreading, available options: 'std' (default), 'tbb', 'omp', 'none'")
+ 
+ add_library(project_options INTERFACE)
+-set_project_warnings(project_options)
++#set_project_warnings(project_options)
+ 
+ set(nest2d_HDRS
+         include/libnest2d/libnest2d.hpp
diff --git a/devel/libnest2d-ultimaker/pkg-plist b/devel/libnest2d-ultimaker/pkg-plist
index 71885f4e79f1..b52b6763e69f 100644
--- a/devel/libnest2d-ultimaker/pkg-plist
+++ b/devel/libnest2d-ultimaker/pkg-plist
@@ -10,6 +10,7 @@ include/libnest2d/optimizers/nlopt/genetic.hpp
 include/libnest2d/optimizers/nlopt/nlopt_boilerplate.hpp
 include/libnest2d/optimizers/nlopt/simplex.hpp
 include/libnest2d/optimizers/nlopt/subplex.hpp
+include/libnest2d/optimizers/optimlib/particleswarm.hpp
 include/libnest2d/parallel.hpp
 include/libnest2d/placers/bottomleftplacer.hpp
 include/libnest2d/placers/nfpplacer.hpp
@@ -24,10 +25,3 @@ include/libnest2d/utils/metaloop.hpp
 include/libnest2d/utils/rational.hpp
 include/libnest2d/utils/rotcalipers.hpp
 include/libnest2d/utils/rotfinder.hpp
-lib/cmake/Libnest2D/FindClipper.cmake
-lib/cmake/Libnest2D/FindNLopt.cmake
-lib/cmake/Libnest2D/FindTBB.cmake
-lib/cmake/Libnest2D/Libnest2DConfig.cmake
-lib/cmake/Libnest2D/Libnest2DConfigVersion.cmake
-lib/cmake/Libnest2D/Libnest2DTargets.cmake
-lib/cmake/Libnest2D/RPPackageVersions.cmake