Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 01 Jun 2026 06:37:07 +0000
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org
Subject:   git: 4bc419c85c17 - main - math/lemon: Add patches
Message-ID:  <6a1d2893.1c7b4.60577b6@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch main has been updated by yuri:

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

commit 4bc419c85c17ec045f69bee24d814b7b8f6eebbc
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2026-06-01 06:32:33 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2026-06-01 06:36:45 +0000

    math/lemon: Add patches
---
 math/lemon/Makefile                             |   2 +-
 math/lemon/files/patch-lemon_bits_array__map.h  | 108 ++++++++++++++++++++++++
 math/lemon/files/patch-lemon_network__simplex.h |  24 ++++++
 3 files changed, 133 insertions(+), 1 deletion(-)

diff --git a/math/lemon/Makefile b/math/lemon/Makefile
index 79b26d1b75ea..455c084956dd 100644
--- a/math/lemon/Makefile
+++ b/math/lemon/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	lemon
 DISTVERSION=	1.3.1
-PORTREVISION=	4
+PORTREVISION=	5
 CATEGORIES=	math
 MASTER_SITES=	https://lemon.cs.elte.hu/pub/sources/
 PKGNAMEPREFIX=	coin-or-
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<void*>(&(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<void*>(&(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<void*>(&(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<void*>(&(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<void*>(&(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<void*>(&(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<void*>(&(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<Key>& 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<void*>(&(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 <sys/param.h>. 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 <typename GR, typename V = int, typename C = V>
+   class NetworkSimplex
+   {
+@@ -1651,6 +1653,7 @@
+     }
+ 
+   }; //class NetworkSimplex
++#pragma pop_macro("MAX")
+ 
+   ///@}
+ 


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a1d2893.1c7b4.60577b6>