git: b17b4e025cbc - main - math/nlopt: Update to 2.8.0

From: Rainer Hurling <rhurlin_at_FreeBSD.org>
Date: Sun, 25 Aug 2024 13:19:43 UTC
The branch main has been updated by rhurlin:

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

commit b17b4e025cbce6e71c8a3451070a0eba738db6c1
Author:     Rainer Hurling <rhurlin@FreeBSD.org>
AuthorDate: 2024-08-25 13:06:33 +0000
Commit:     Rainer Hurling <rhurlin@FreeBSD.org>
CommitDate: 2024-08-25 13:19:20 +0000

    math/nlopt: Update to 2.8.0
    
    - Switch from guile2 to guile3
    - Pet portclippy
    
    Since guile-config-3.0 crashes, nlopt avoids its use with some patches.
    
    Changelog: https://github.com/stevengj/nlopt/releases/tag/v2.8.0
    
    Reported by:    portscout, Repology
---
 math/nlopt/Makefile                            |  18 ++--
 math/nlopt/distinfo                            |   6 +-
 math/nlopt/files/patch-cmake_FindGuile.cmake   | 116 +++++++++++++++++++++++++
 math/nlopt/files/patch-src_swig_CMakeLists.txt |  15 ++++
 math/nlopt/pkg-plist                           |   3 +-
 5 files changed, 146 insertions(+), 12 deletions(-)

diff --git a/math/nlopt/Makefile b/math/nlopt/Makefile
index eeb959b8d964..3609c20c2617 100644
--- a/math/nlopt/Makefile
+++ b/math/nlopt/Makefile
@@ -1,7 +1,6 @@
 PORTNAME=	nlopt
 DISTVERSIONPREFIX=	v
-DISTVERSION=	2.7.1
-PORTREVISION=	3
+DISTVERSION=	2.8.0
 CATEGORIES=	math
 
 MAINTAINER=	rhurlin@FreeBSD.org
@@ -15,24 +14,29 @@ LICENSE_FILE=	${WRKSRC}/COPYING
 BROKEN_armv6=	fails to package: Unable to access file site-packages/_nlopt.a:No such file or directory
 BROKEN_armv7=	fails to package: Unable to access file site-packages/_nlopt.a:No such file or directory
 
+FLAVORS=	full minimal
+
 USES=		cmake:testing
 USE_GITHUB=	yes
 GH_ACCOUNT=	stevengj
 USE_LDCONFIG=	yes
 
-FLAVORS=	full minimal
-
 .if ${FLAVOR:U} == minimal
 PKGNAMESUFFIX=	-${FLAVOR}
 CMAKE_OFF=	NLOPT_GUILE NLOPT_PYTHON NLOPT_SWIG
 CONFLICTS_INSTALL=	${PORTNAME}
 .else
-USES+=		guile:2.2,alias localbase pkgconfig python
+USES+=		guile:3.0,alias localbase pkgconfig python
 BUILD_DEPENDS=	swig:devel/swig ${PYNUMPY}
+# Because guile-config-3.0 crashes, nlopt avoids this by using
+# files/patch-cmake_FindGuile.cmake and setting GUILE_EXECUTABLE
+# and GUILE_CONFIG_EXECUTABLE
+MAKE_ENV+=	GUILE_EXECUTABLE=${PREFIX}/bin/guile3 \
+		GUILE_CONFIG_EXECUTABLE=${PREFIX}/bin/guile-config-3
 RUN_DEPENDS=	${PYNUMPY}
 CONFLICTS_INSTALL=	${PORTNAME}-minimal
-PLIST_FILES=	lib/guile/2.2/extensions/nlopt_guile.so \
-		${PYTHON_SITELIBDIR}/_nlopt.so \
+PLIST_FILES+=	lib/guile/3.0/extensions/nlopt_guile.so \
+		${PYTHON_SITELIBDIR}/_nlopt%%PYTHON_EXT_SUFFIX%%.so \
 		${PYTHON_SITELIBDIR}/nlopt.py \
 		${GUILE_SITE_DIR}/nlopt.scm
 .endif
diff --git a/math/nlopt/distinfo b/math/nlopt/distinfo
index c666e9ae7541..fe2610318c52 100644
--- a/math/nlopt/distinfo
+++ b/math/nlopt/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1638900611
-SHA256 (stevengj-nlopt-v2.7.1_GH0.tar.gz) = db88232fa5cef0ff6e39943fc63ab6074208831dc0031cf1545f6ecd31ae2a1a
-SIZE (stevengj-nlopt-v2.7.1_GH0.tar.gz) = 2044180
+TIMESTAMP = 1723360401
+SHA256 (stevengj-nlopt-v2.8.0_GH0.tar.gz) = e02a4956a69d323775d79fdaec7ba7a23ed912c7d45e439bc933d991ea3193fd
+SIZE (stevengj-nlopt-v2.8.0_GH0.tar.gz) = 2050287
diff --git a/math/nlopt/files/patch-cmake_FindGuile.cmake b/math/nlopt/files/patch-cmake_FindGuile.cmake
new file mode 100644
index 000000000000..4a158cc25e70
--- /dev/null
+++ b/math/nlopt/files/patch-cmake_FindGuile.cmake
@@ -0,0 +1,116 @@
+--- cmake/FindGuile.cmake.orig	2024-08-09 20:31:24 UTC
++++ cmake/FindGuile.cmake
+@@ -12,87 +12,42 @@
+ # GUILE_SITE_DIR         - site dir
+ # GUILE_EXTENSION_DIR    - extension dir
+ # GUILE_ROOT_DIR         - prefix dir
++find_package(PkgConfig REQUIRED)
+ 
+-# Look for the header file
+-# Look for guile-2.2 first, then 2.0, then 1.8
+-# Macports for OSX puts things in /opt/local
+-find_path (GUILE_INCLUDE_DIR libguile.h
+-  PATH_SUFFIXES
+-    guile/3.0
+-    guile/2.2
+-    guile/2.0
+-    guile/1.8
+-    libguile
+-    guile
+-  HINTS /opt/local/include
+-)
+-
+-# Look for the library
+-find_library (GUILE_LIBRARY NAMES guile-3.0 guile-2.2 guile-2.0 guile
+-  HINTS
+-    /opt/local/lib
+-)
+-
+-
+-set (GUILE_LIBRARIES ${GUILE_LIBRARY})
+-set (GUILE_INCLUDE_DIRS ${GUILE_INCLUDE_DIR})
+-
+-
+-# check guile's version if we're using cmake >= 2.6
+-if (GUILE_INCLUDE_DIR)
+-  SET(GUILE_VERSION_MAJOR 0)
+-  SET(GUILE_VERSION_MINOR 0)
+-  SET(GUILE_VERSION_PATCH 0)
+-
+-  IF(NOT EXISTS "${GUILE_INCLUDE_DIR}/libguile/version.h")
+-          MESSAGE(FATAL_ERROR "Found ${GUILE_INCLUDE_DIR}/libguile.h but not version.h; check your guile installation!")
+-  ENDIF(NOT EXISTS "${GUILE_INCLUDE_DIR}/libguile/version.h")
+-
+-  # Extract the libguile version from the 'version.h' file
+-  SET(GUILE_MAJOR_VERSION 0)
+-  FILE(READ "${GUILE_INCLUDE_DIR}/libguile/version.h" _GUILE_VERSION_H_CONTENTS)
+-
+-  STRING(REGEX MATCH "#define SCM_MAJOR_VERSION[	 ]+([0-9])" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
+-  SET(GUILE_VERSION_MAJOR ${CMAKE_MATCH_1})
+-  STRING(REGEX MATCH "#define SCM_MINOR_VERSION[	 ]+([0-9]+)" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
+-  SET(GUILE_VERSION_MINOR ${CMAKE_MATCH_1})
+-  STRING(REGEX MATCH "#define SCM_MICRO_VERSION[	 ]+([0-9]+)" _MATCH "${_GUILE_VERSION_H_CONTENTS}")
+-  SET(GUILE_VERSION_PATCH ${CMAKE_MATCH_1})
+-
+-  SET(GUILE_VERSION_STRING "${GUILE_VERSION_MAJOR}.${GUILE_VERSION_MINOR}.${GUILE_VERSION_PATCH}")
+-
+-endif ()
+-
+ find_program(GUILE_EXECUTABLE
+               NAMES guile3.0 guile2.2 guile2.0 guile
+            )
+-
+ find_program(GUILE_CONFIG_EXECUTABLE
+               NAMES guile-config3.0 guile-config2.2 guile-config2.0 guile-config
+            )
+ 
++pkg_check_modules(GUILE IMPORTED_TARGET guile)
++if (GUILE_FOUND)
++  pkg_get_variable(GUILE_ROOT_DIR guile prefix)
++  pkg_get_variable(GUILE_SITE_DIR guile sitedir)
++  pkg_get_variable(GUILE_EXTENSION_DIR guile extensiondir)
++else()
++  pkg_check_modules(GUILE IMPORTED_TARGET guile-2.0>=2.0)
++endif()
++if (GUILE_FOUND)
++  pkg_get_variable(GUILE_ROOT_DIR guile-2.0 prefix)
++  pkg_get_variable(GUILE_SITE_DIR guile-2.0 sitedir)
++  pkg_get_variable(GUILE_EXTENSION_DIR guile-2.0 extensiondir)
++else()
++  pkg_check_modules(GUILE REQUIRED IMPORTED_TARGET guile-3.0>=3.0)
++  pkg_get_variable(GUILE_ROOT_DIR guile-3.0 prefix)
++  pkg_get_variable(GUILE_SITE_DIR guile-3.0 sitedir)
++  pkg_get_variable(GUILE_EXTENSION_DIR guile-3.0 extensiondir)
++endif()
++message(STATUS "GUILE_VERSION is set to ${GUILE_VERSION}")
++message(STATUS "GUILE_ROOT_DIR is set to ${GUILE_ROOT_DIR}")
++message(STATUS "GUILE_SITE_DIR is set to ${GUILE_SITE_DIR}")
++message(STATUS "GUILE_EXTENSION_DIR is set to ${GUILE_EXTENSION_DIR}")
++message(STATUS "GUILE_EXECUTABLE is set to ${GUILE_EXECUTABLE}")
++message(STATUS "GUILE_CONFIG_EXECUTABLE is set to ${GUILE_CONFIG_EXECUTABLE}")
+ 
+-if (GUILE_CONFIG_EXECUTABLE)
+-  execute_process (COMMAND ${GUILE_CONFIG_EXECUTABLE} info prefix
+-                    OUTPUT_VARIABLE GUILE_ROOT_DIR
+-                    OUTPUT_STRIP_TRAILING_WHITESPACE)
+-
+-  execute_process (COMMAND ${GUILE_CONFIG_EXECUTABLE} info sitedir
+-                    OUTPUT_VARIABLE GUILE_SITE_DIR
+-                    OUTPUT_STRIP_TRAILING_WHITESPACE)
+-
+-  execute_process (COMMAND ${GUILE_CONFIG_EXECUTABLE} info extensiondir
+-                    OUTPUT_VARIABLE GUILE_EXTENSION_DIR
+-                    OUTPUT_STRIP_TRAILING_WHITESPACE)
+-endif ()
+-
+-# IF(GUILE_FOUND AND GUILE_VERSION_MAJOR EQUAL 2)
+-# 	ADD_DEFINITIONS(-DHAVE_GUILE2)
+-# ENDIF(GUILE_FOUND AND GUILE_VERSION_MAJOR EQUAL 2)
+-
+ # handle REQUIRED and QUIET options
+ include (FindPackageHandleStandardArgs)
+-find_package_handle_standard_args (Guile REQUIRED_VARS GUILE_EXECUTABLE GUILE_ROOT_DIR GUILE_INCLUDE_DIRS GUILE_LIBRARIES VERSION_VAR GUILE_VERSION_STRING)
+-
++find_package_handle_standard_args (Guile REQUIRED_VARS GUILE_SITE_DIR GUILE_EXTENSION_DIR GUILE_ROOT_DIR GUILE_INCLUDE_DIRS GUILE_LIBRARIES GUILE_CFLAGS GUILE_LDFLAGS GUILE_VERSION)
+ 
+ mark_as_advanced (GUILE_INCLUDE_DIR GUILE_LIBRARY)
diff --git a/math/nlopt/files/patch-src_swig_CMakeLists.txt b/math/nlopt/files/patch-src_swig_CMakeLists.txt
new file mode 100644
index 000000000000..9f0885a76c59
--- /dev/null
+++ b/math/nlopt/files/patch-src_swig_CMakeLists.txt
@@ -0,0 +1,15 @@
+--- src/swig/CMakeLists.txt.orig	2024-08-09 20:31:24 UTC
++++ src/swig/CMakeLists.txt
+@@ -57,10 +57,10 @@ if (GUILE_FOUND)
+   # swig_add_module is deprecated
+   swig_add_library (nlopt_guile LANGUAGE guile SOURCES nlopt.i)
+ 
+-  target_include_directories (nlopt_guile PRIVATE ${GUILE_INCLUDE_DIRS})
++  target_compile_options(nlopt_guile PRIVATE ${GUILE_CFLAGS})
+ 
+   swig_link_libraries (nlopt_guile ${nlopt_lib})
+-  target_link_libraries (nlopt_guile ${GUILE_LIBRARIES})
++  target_link_options(nlopt_guile PRIVATE ${GUILE_LDFLAGS})
+ 
+   file (RELATIVE_PATH _REL_GUILE_SITE_PATH ${GUILE_ROOT_DIR} ${GUILE_SITE_DIR})
+   set (GUILE_SITE_PATH ${_REL_GUILE_SITE_PATH})
diff --git a/math/nlopt/pkg-plist b/math/nlopt/pkg-plist
index e54a29a5e4e9..1fc0a90a3d59 100644
--- a/math/nlopt/pkg-plist
+++ b/math/nlopt/pkg-plist
@@ -1,4 +1,3 @@
-include/nlopt.f
 include/nlopt.h
 include/nlopt.hpp
 lib/cmake/nlopt/NLoptConfig.cmake
@@ -7,7 +6,7 @@ lib/cmake/nlopt/NLoptLibraryDepends-%%CMAKE_BUILD_TYPE%%.cmake
 lib/cmake/nlopt/NLoptLibraryDepends.cmake
 lib/libnlopt.so
 lib/libnlopt.so.0
-lib/libnlopt.so.0.11.1
+lib/libnlopt.so.0.12.0
 libdata/pkgconfig/nlopt.pc
 share/man/man3/nlopt.3.gz
 share/man/man3/nlopt_minimize.3.gz