nlopt, bump to 2.9.1 (#13599)

2.10.0 changes SONAME, 2.9.1 is still compatible for orcaslicer
This commit is contained in:
Schrijvers Luc
2026-01-08 13:56:53 +01:00
committed by GitHub
parent da1e981811
commit 61c713fd8e
2 changed files with 159 additions and 8 deletions

View File

@@ -6,15 +6,16 @@ HOMEPAGE="https://github.com/stevengj/nlopt"
COPYRIGHT="2007-2011 Massachusetts Institute of Technology"
LICENSE="MIT
GNU LGPL v2.1"
REVISION="2"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="db88232fa5cef0ff6e39943fc63ab6074208831dc0031cf1545f6ecd31ae2a1a"
CHECKSUM_SHA256="1e6c33f8cbdc4138d525f3326c231f14ed50d99345561e85285638c49b64ee93"
SOURCE_FILENAME="nlopt-v$portVersion.tar.gz"
PATCHES="nlopt-$portVersion.patchset"
ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"
libVersion="0.11.1"
libVersion="0.13.0"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"
PROVIDES="
@@ -50,15 +51,17 @@ defineDebugInfoPackage nlopt$secondaryArchSuffix \
BUILD()
{
cmake -Bbuild -S. \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
$cmakeDirArgs -Wno-dev
make -Cbuild $jobArgs
cmake -B build -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo \
$cmakeDirArgs \
-Wno-dev \
-DNLOPT_TESTS=OFF
make -C build $jobArgs
}
INSTALL()
{
make -Cbuild install
make -C build install
prepareInstalledDevelLib \
libnlopt

View File

@@ -0,0 +1,148 @@
From 7e8aa81c79a69bd110797b9bb04be9a6e93e9b77 Mon Sep 17 00:00:00 2001
From: Begasus <begasus@gmail.com>
Date: Thu, 8 Jan 2026 13:00:27 +0100
Subject: applying patch octave-build.patch
Based on: https://src.fedoraproject.org/rpms/NLopt/blob/rawhide/f/octave-build.patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53e3aac..c9f4365 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -76,8 +76,6 @@ endif ()
include (CheckIncludeFiles)
include (CheckFunctionExists)
include (CheckTypeSize)
-include (CheckCCompilerFlag)
-include (CheckCXXSymbolExists)
include (CheckCSourceCompiles)
include (CheckCXXCompilerFlag)
include (CheckLibraryExists)
@@ -143,19 +141,6 @@ if (WITH_THREADLOCAL AND NOT DEFINED THREADLOCAL)
endif ()
-if (NLOPT_CXX OR NLOPT_PYTHON OR NLOPT_GUILE OR NLOPT_OCTAVE)
- check_cxx_symbol_exists (__cplusplus ciso646 SYSTEM_HAS_CXX)
- if (SYSTEM_HAS_CXX)
- set (CMAKE_CXX_STANDARD 11) # set the standard to C++11 but do not require it
-
- if (NLOPT_CXX)
- set (CMAKE_CXX_STANDARD_REQUIRED ON) # if we build C++ API, we do need C++11
- endif ()
- else()
- message (FATAL_ERROR "The compiler doesn't support CXX.")
- endif ()
-endif ()
-
#==============================================================================
# CREATE nlopt_config.h
#==============================================================================
@@ -260,6 +245,9 @@ endif ()
target_link_libraries (${nlopt_lib} ${M_LIBRARY})
set_target_properties (${nlopt_lib} PROPERTIES SOVERSION ${SO_MAJOR})
set_target_properties (${nlopt_lib} PROPERTIES VERSION "${SO_MAJOR}.${SO_MINOR}.${SO_PATCH}")
+if (NLOPT_CXX)
+ target_compile_features (${nlopt_lib} PUBLIC cxx_lambdas)
+endif ()
#==============================================================================
# INCLUDE DIRECTORIES
diff --git a/src/swig/CMakeLists.txt b/src/swig/CMakeLists.txt
index 5e26b61..7259566 100644
--- a/src/swig/CMakeLists.txt
+++ b/src/swig/CMakeLists.txt
@@ -19,7 +19,7 @@ endif ()
include_directories (${NLOPT_PRIVATE_INCLUDE_DIRS})
set_source_files_properties (nlopt.i PROPERTIES CPLUSPLUS ON)
-if (NUMPY_FOUND AND Python_FOUND)
+if (NUMPY_FOUND AND Python_FOUND AND NLOPT_CXX)
set (SWIG_MODULE_nlopt_python_EXTRA_DEPS nlopt-python.i numpy.i generate-cpp)
@@ -49,7 +49,7 @@ if (NUMPY_FOUND AND Python_FOUND)
endif ()
-if (GUILE_FOUND)
+if (GUILE_FOUND AND NLOPT_CXX)
set_source_files_properties (nlopt.i PROPERTIES SWIG_FLAGS "-scmstub")
set (SWIG_MODULE_nlopt_guile_EXTRA_DEPS nlopt-guile.i generate-cpp)
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index cd367e9..07c71d9 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -1,17 +1,19 @@
add_custom_target (tests)
macro(NLOPT_add_cpp_test test_name)
- add_executable (${test_name} ${test_name}.cxx)
- target_link_libraries (${test_name} ${nlopt_lib})
- add_dependencies (tests ${test_name})
- target_include_directories (${test_name} PRIVATE ${NLOPT_PRIVATE_INCLUDE_DIRS})
- foreach(arg IN ITEMS ${ARGN})
- add_test (NAME check_${test_name}_${arg} COMMAND ${test_name} ${arg})
- if (CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
- set_tests_properties (check_${test_name}_${arg}
- PROPERTIES ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}\\${CMAKE_BUILD_TYPE};$ENV{PATH}") # to load dll
- endif ()
- endforeach()
+ if (NLOPT_CXX)
+ add_executable (${test_name} ${test_name}.cxx)
+ target_link_libraries (${test_name} ${nlopt_lib})
+ add_dependencies (tests ${test_name})
+ target_include_directories (${test_name} PRIVATE ${NLOPT_PRIVATE_INCLUDE_DIRS})
+ foreach(arg IN ITEMS ${ARGN})
+ add_test (NAME check_${test_name}_${arg} COMMAND ${test_name} ${arg})
+ if (CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
+ set_tests_properties (check_${test_name}_${arg}
+ PROPERTIES ENVIRONMENT "PATH=${PROJECT_BINARY_DIR}\\${CMAKE_BUILD_TYPE};$ENV{PATH}") # to load dll
+ endif ()
+ endforeach()
+ endif ()
endmacro()
NLOPT_add_cpp_test(t_tutorial 23 24 30 39)
@@ -19,9 +21,6 @@ NLOPT_add_cpp_test(cpp_functor 0)
NLOPT_add_cpp_test(t_fbound 0)
NLOPT_add_cpp_test(t_bounded 0 1 2 3 4 5 6 7 8 18 34 41 42)
-if (NOT NLOPT_CXX)
- set_tests_properties (check_t_bounded_8 check_t_bounded_42 PROPERTIES DISABLED TRUE)
-endif ()
# have to add timer.c and mt19937ar.c as symbols are declared extern
set (testopt_sources testfuncs.c testfuncs.h testopt.c ${PROJECT_SOURCE_DIR}/src/util/timer.c ${PROJECT_SOURCE_DIR}/src/util/mt19937ar.c)
@@ -62,7 +61,7 @@ foreach (algo_index RANGE 28) # 42
endforeach ()
endforeach ()
-if (Python_FOUND AND NUMPY_FOUND AND (SWIG_FOUND OR (EXISTS ${PROJECT_SOURCE_DIR}/src/swig/nlopt-python.cpp)))
+if (TARGET nlopt_python)
set (PYINSTALLCHECK_ENVIRONMENT "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/src/swig"
"PYTHONPATH=${PROJECT_BINARY_DIR}/src/swig"
)
@@ -76,15 +75,15 @@ if (Python_FOUND AND NUMPY_FOUND AND (SWIG_FOUND OR (EXISTS ${PROJECT_SOURCE_DIR
set_tests_properties (test_memoize PROPERTIES ENVIRONMENT "${PYINSTALLCHECK_ENVIRONMENT}")
endif ()
-if (OCTAVE_FOUND)
+if (TARGET nlopt_optimize)
add_test (NAME test_octave COMMAND ${OCTAVE_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/t_octave.m ${PROJECT_SOURCE_DIR}/src/octave ${PROJECT_BINARY_DIR}/src/octave)
endif ()
-if (MATLAB_FOUND)
+if (TARGET nlopt_optimize-mex)
add_test (NAME test_matlab COMMAND ${Matlab_MAIN_PROGRAM} -nodesktop -nosplash -r "addpath('${PROJECT_SOURCE_DIR}/src/octave'); addpath('${PROJECT_BINARY_DIR}/src/octave'); try; run('${CMAKE_CURRENT_SOURCE_DIR}/t_matlab.m'); catch; exit(1); end; quit")
endif ()
-if (GUILE_FOUND AND (SWIG_FOUND OR (EXISTS ${PROJECT_SOURCE_DIR}/src/swig/nlopt-guile.cpp)))
+if (TARGET nlopt_guile)
set (GUILECHECK_ENVIRONMENT "LD_LIBRARY_PATH=${PROJECT_BINARY_DIR}/src/swig"
"GUILE_LOAD_PATH=${PROJECT_BINARY_DIR}/src/swig"
"GUILE_AUTO_COMPILE=0")
--
2.52.0