diff --git a/math/lemon/Makefile b/math/lemon/Makefile index 79b26d1b75ea..455c084956dd 100644 --- a/math/lemon/Makefile +++ b/math/lemon/Makefile @@ -1,39 +1,39 @@ PORTNAME= lemon DISTVERSION= 1.3.1 -PORTREVISION= 4 +PORTREVISION= 5 CATEGORIES= math MASTER_SITES= https://lemon.cs.elte.hu/pub/sources/ PKGNAMEPREFIX= coin-or- MAINTAINER= yuri@FreeBSD.org COMMENT= Library for Efficient Modeling and Optimization in Networks WWW= https://lemon.cs.elte.hu/trac/lemon/ LICENSE= BSL LICENSE_FILE= ${WRKSRC}/LICENSE LIB_DEPENDS= libCbc.so:math/cbc \ libCgl.so:math/cgl \ libClp.so:math/clp \ libCoinUtils.so:math/coinutils \ libOsi.so:math/osi USES= cmake USE_CXXSTD= c++14 USE_LDCONFIG= yes CMAKE_ON= BUILD_SHARED_LIBS CONFLICTS_BUILD= SoPlex # Incompatible with SoPlex-4.0.0 optional dependency: https://lemon.cs.elte.hu/trac/lemon/ticket/616 OPTIONS_DEFINE= GLPK OPTIONS_DEFAULT= GLPK GLPK_DESC= Build with GLPK solver GLPK_CMAKE_BOOL= LEMON_ENABLE_GLPK GLPK_LIB_DEPENDS= libglpk.so:math/glpk post-install: @${RM} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}-0.x-to-1.x.sh .include diff --git a/math/lemon/files/patch-lemon_bits_array__map.h b/math/lemon/files/patch-lemon_bits_array__map.h new file mode 100644 index 000000000000..404c1faba292 --- /dev/null +++ b/math/lemon/files/patch-lemon_bits_array__map.h @@ -0,0 +1,108 @@ +-- Replace deprecated std::allocator::construct/destroy (removed in C++20) with +-- placement new and explicit destructor calls. These are compatible with C++11 +-- through C++26 and fix compilation of C++20 consumers of LEMON (e.g. OpenROAD). + +--- lemon/bits/array_map.h.orig ++++ lemon/bits/array_map.h +@@ -88,7 +88,7 @@ + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; +- allocator.construct(&(values[id]), Value()); ++ ::new(static_cast(&(values[id]))) Value(); + } + } + +@@ -102,7 +102,7 @@ + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; +- allocator.construct(&(values[id]), value); ++ ::new(static_cast(&(values[id]))) Value(value); + } + } + +@@ -121,7 +121,7 @@ + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; +- allocator.construct(&(values[id]), copy.values[id]); ++ ::new(static_cast(&(values[id]))) Value(copy.values[id]); + } + } + +@@ -218,15 +218,15 @@ + for (nf->first(it); it != INVALID; nf->next(it)) { + int jd = nf->id(it);; + if (id != jd) { +- allocator.construct(&(new_values[jd]), values[jd]); +- allocator.destroy(&(values[jd])); ++ ::new(static_cast(&(new_values[jd]))) Value(values[jd]); ++ values[jd].~Value(); + } + } + if (capacity != 0) allocator.deallocate(values, capacity); + values = new_values; + capacity = new_capacity; + } +- allocator.construct(&(values[id]), Value()); ++ ::new(static_cast(&(values[id]))) Value(); + } + + // \brief Adds more new keys to the map. +@@ -260,8 +260,8 @@ + } + } + if (found) continue; +- allocator.construct(&(new_values[id]), values[id]); +- allocator.destroy(&(values[id])); ++ ::new(static_cast(&(new_values[id]))) Value(values[id]); ++ values[id].~Value(); + } + if (capacity != 0) allocator.deallocate(values, capacity); + values = new_values; +@@ -269,7 +269,7 @@ + } + for (int i = 0; i < int(keys.size()); ++i) { + int id = nf->id(keys[i]); +- allocator.construct(&(values[id]), Value()); ++ ::new(static_cast(&(values[id]))) Value(); + } + } + +@@ -279,7 +279,7 @@ + // and it overrides the erase() member function of the observer base. + virtual void erase(const Key& key) { + int id = Parent::notifier()->id(key); +- allocator.destroy(&(values[id])); ++ values[id].~Value(); + } + + // \brief Erase more keys from the map. +@@ -289,7 +289,7 @@ + virtual void erase(const std::vector& keys) { + for (int i = 0; i < int(keys.size()); ++i) { + int id = Parent::notifier()->id(keys[i]); +- allocator.destroy(&(values[id])); ++ values[id].~Value(); + } + } + +@@ -303,7 +303,7 @@ + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it);; +- allocator.construct(&(values[id]), Value()); ++ ::new(static_cast(&(values[id]))) Value(); + } + } + +@@ -317,7 +317,7 @@ + Item it; + for (nf->first(it); it != INVALID; nf->next(it)) { + int id = nf->id(it); +- allocator.destroy(&(values[id])); ++ values[id].~Value(); + } + allocator.deallocate(values, capacity); + capacity = 0; diff --git a/math/lemon/files/patch-lemon_network__simplex.h b/math/lemon/files/patch-lemon_network__simplex.h new file mode 100644 index 000000000000..1be67435f9f7 --- /dev/null +++ b/math/lemon/files/patch-lemon_network__simplex.h @@ -0,0 +1,24 @@ +-- Guard the NetworkSimplex class against the MAX(a,b) macro defined by FreeBSD system +-- headers via . LEMON uses MAX as a member variable name; the macro +-- expansion corrupts the constructor initializer list in C++20 code. +-- Uses #pragma push_macro/pop_macro, supported by GCC, Clang and MSVC. + +--- lemon/network_simplex.h.orig ++++ lemon/network_simplex.h +@@ -71,6 +71,8 @@ + /// \note %NetworkSimplex provides five different pivot rule + /// implementations, from which the most efficient one is used + /// by default. For more information, see \ref PivotRule. ++#pragma push_macro("MAX") ++#undef MAX + template + class NetworkSimplex + { +@@ -1651,6 +1653,7 @@ + } + + }; //class NetworkSimplex ++#pragma pop_macro("MAX") + + ///@} +