add sci-libs/lemon
authorgit <redacted>
Tue, 7 Jul 2026 14:03:03 +0000 (10:03 -0400)
committergit <redacted>
Tue, 7 Jul 2026 14:03:03 +0000 (10:03 -0400)
README.md
sci-libs/lemon/Manifest [new file with mode: 0644]
sci-libs/lemon/files/lemon-1.3.1-cmake4.patch [new file with mode: 0644]
sci-libs/lemon/files/lemon-as-needed.patch [new file with mode: 0644]
sci-libs/lemon/files/lemon-disable-broken-tests.patch [new file with mode: 0644]
sci-libs/lemon/files/lemon-multilib.patch [new file with mode: 0644]
sci-libs/lemon/lemon-1.3.1.ebuild [new file with mode: 0644]
sci-libs/lemon/lemon-9999.ebuild [new file with mode: 0644]
sci-libs/lemon/metadata.xml [new file with mode: 0644]

index 93c7e43db5a016c9beab55359e17efe5acf2683e..5f7b64d74518af4ed9a73e0bb121b4ff983e5df8 100644 (file)
--- a/README.md
+++ b/README.md
@@ -6,4 +6,5 @@ Ebuild files taken from the official Gentoo repository.
 * `dev-libs/boost` & `dev-libs/boost-static` - a hacky way to get static Boost libraries using a second ebuild, not all USE flags are tested!
 * `sci-electronics/magic` - updated to a newer version and set `-std=gnu89` permanently, used to fail to compile because of `termio.h` and old-style function declarations mixed with C99-style comments.
 * `sci-electronics/opensta` - new ebuild, the stable version needs SWIG 3.0, which is no longer available in the Gentoo repo, the live ebuild merges fine.
+* `sci-libs/lemon` - updated for C++20 compatibility.
 * `sci-mathematics/cudd` - building documentation fails with a modern C++ compiler, this ebuild just skips the docs.
diff --git a/sci-libs/lemon/Manifest b/sci-libs/lemon/Manifest
new file mode 100644 (file)
index 0000000..464bb68
--- /dev/null
@@ -0,0 +1 @@
+DIST 1.3.1.tar.gz 4473209 BLAKE2B 16d11ce2f23f9215b7157a7b0fa3c3a40afb98bb6113a7e53ae31e5ab87b9108b7b522455e4f8a4932c12632f0a10ecad20adaec4c17871d921f0fc2f7d61ca9 SHA512 77dc1533bcdd726349412511bf14e2de63c8f0874dc13fc2e2cabeb60389010f35633d8a6ac5f48f2c3546644ca517c513783e9aacb914c8f1c6b2438c96522c
diff --git a/sci-libs/lemon/files/lemon-1.3.1-cmake4.patch b/sci-libs/lemon/files/lemon-1.3.1-cmake4.patch
new file mode 100644 (file)
index 0000000..1a70f1e
--- /dev/null
@@ -0,0 +1,21 @@
+Source: https://salsa.debian.org/med-team/liblemon/-/raw/master/debian/patches/cmake-4.patch
+
+Description: bump cmake minimum required to 3.10.
+ Portability to cmake 4 and beyond also required dropping the CMP0048
+ enforcement to the OLD behavior.
+Author: Étienne Mollier <emollier@debian.org>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1113170
+Forwarded: no
+Last-Update: 2025-10-02
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- liblemon.orig/CMakeLists.txt
++++ liblemon/CMakeLists.txt
+@@ -1,6 +1,4 @@
+-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+-
+-CMAKE_POLICY(SET CMP0048 OLD)
++CMAKE_MINIMUM_REQUIRED(VERSION 3.10)
+ SET(PROJECT_NAME "LEMON")
+ PROJECT(${PROJECT_NAME})
diff --git a/sci-libs/lemon/files/lemon-as-needed.patch b/sci-libs/lemon/files/lemon-as-needed.patch
new file mode 100644 (file)
index 0000000..ab205e6
--- /dev/null
@@ -0,0 +1,47 @@
+ CMakeLists.txt       | 4 ++++
+ lemon/CMakeLists.txt | 2 ++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b06e5c7..fa68aa8 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -84,21 +84,25 @@ IF(GLPK_FOUND)
+   SET(LEMON_HAVE_LP TRUE)
+   SET(LEMON_HAVE_MIP TRUE)
+   SET(LEMON_HAVE_GLPK TRUE)
++  SET(LEMON_LP_LIBRARIES ${LEMON_LP_LIBRARIES} ${GLPK_LIBRARIES})
+ ENDIF(GLPK_FOUND)
+ IF(ILOG_FOUND)
+   SET(LEMON_HAVE_LP TRUE)
+   SET(LEMON_HAVE_MIP TRUE)
+   SET(LEMON_HAVE_CPLEX TRUE)
++  SET(LEMON_LP_LIBRARIES ${LEMON_LP_LIBRARIES} ${ILOG_LIBRARIES})
+ ENDIF(ILOG_FOUND)
+ IF(COIN_FOUND)
+   SET(LEMON_HAVE_LP TRUE)
+   SET(LEMON_HAVE_MIP TRUE)
+   SET(LEMON_HAVE_CLP TRUE)
+   SET(LEMON_HAVE_CBC TRUE)
++  SET(LEMON_LP_LIBRARIES ${LEMON_LP_LIBRARIES} ${COIN_LIBRARIES})
+ ENDIF(COIN_FOUND)
+ IF(SOPLEX_FOUND)
+   SET(LEMON_HAVE_LP TRUE)
+   SET(LEMON_HAVE_SOPLEX TRUE)
++  SET(LEMON_LP_LIBRARIES ${LEMON_LP_LIBRARIES} ${COIN_LIBRARIES})
+ ENDIF(SOPLEX_FOUND)
+ IF(ILOG_FOUND)
+diff --git a/lemon/CMakeLists.txt b/lemon/CMakeLists.txt
+index 8011833..2487345 100644
+--- a/lemon/CMakeLists.txt
++++ b/lemon/CMakeLists.txt
+@@ -59,6 +59,8 @@ IF(UNIX)
+   SET_TARGET_PROPERTIES(lemon PROPERTIES OUTPUT_NAME emon)
+ ENDIF()
++TARGET_LINK_LIBRARIES(lemon ${LEMON_LP_LIBRARIES})
++
+ INSTALL(
+   TARGETS lemon
+   ARCHIVE DESTINATION lib
diff --git a/sci-libs/lemon/files/lemon-disable-broken-tests.patch b/sci-libs/lemon/files/lemon-disable-broken-tests.patch
new file mode 100644 (file)
index 0000000..18597bb
--- /dev/null
@@ -0,0 +1,54 @@
+From 241c0472607f691d6ffca254eca96a6ea794911d Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <asturm@gentoo.org>
+Date: Fri, 19 Dec 2025 23:35:42 +0100
+Subject: [PATCH] Disable presumably broken tests
+
+Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
+---
+ test/CMakeLists.txt | 8 --------
+ 1 file changed, 8 deletions(-)
+
+diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
+index 96fc5dd..0f3f1cb 100644
+--- a/test/CMakeLists.txt
++++ b/test/CMakeLists.txt
+@@ -31,7 +31,6 @@ SET(TESTS
+   gomory_hu_test
+   graph_copy_test
+   graph_test
+-  graph_utils_test
+   hao_orlin_test
+   heap_test
+   kruskal_test
+@@ -40,8 +39,6 @@ SET(TESTS
+   maps_test
+   matching_test
+   max_cardinality_search_test
+-  max_clique_test
+-  max_flow_test
+   min_cost_arborescence_test
+   min_cost_flow_test
+   min_mean_cycle_test
+@@ -49,10 +46,7 @@ SET(TESTS
+   path_test
+   planarity_test
+   radix_sort_test
+-  random_test
+   suurballe_test
+-  time_measure_test
+-  tsp_test
+   unionfind_test
+ )
+@@ -79,8 +73,6 @@ IF(LEMON_HAVE_LP)
+   ENDIF()
+   TARGET_LINK_LIBRARIES(lp_test ${LP_TEST_LIBS})
+-  ADD_TEST(lp_test lp_test)
+-  ADD_DEPENDENCIES(check lp_test)
+   IF(WIN32 AND LEMON_HAVE_GLPK)
+     GET_TARGET_PROPERTY(TARGET_LOC lp_test LOCATION)
+-- 
+2.52.0
+
diff --git a/sci-libs/lemon/files/lemon-multilib.patch b/sci-libs/lemon/files/lemon-multilib.patch
new file mode 100644 (file)
index 0000000..f2b3cd6
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/lemon/CMakeLists.txt     2014-07-07 16:40:24.911315501 +0200
++++ b/lemon/CMakeLists.txt     2018-10-15 22:13:12.040890710 +0200
+@@ -66,8 +66,8 @@
+ INSTALL(
+   TARGETS lemon
+-  ARCHIVE DESTINATION lib
+-  LIBRARY DESTINATION lib
++  ARCHIVE DESTINATION lib${LIB_SUFFIX}
++  LIBRARY DESTINATION lib${LIB_SUFFIX}
+   COMPONENT library
+ )
+@@ -86,6 +86,6 @@
+ INSTALL(
+   FILES ${CMAKE_CURRENT_BINARY_DIR}/lemon.pc
+-  DESTINATION lib/pkgconfig
++  DESTINATION lib${LIB_SUFFIX}/pkgconfig
+ )
+--- a/lemon/lemon.pc.in        2014-07-07 16:40:24.949315716 +0200
++++ b/lemon/lemon.pc.in        2018-10-15 22:45:28.869931587 +0200
+@@ -1,6 +1,6 @@
+ prefix=@CMAKE_INSTALL_PREFIX@
+ exec_prefix=@CMAKE_INSTALL_PREFIX@/bin
+-libdir=@CMAKE_INSTALL_PREFIX@/lib
++libdir=@CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@
+ includedir=@CMAKE_INSTALL_PREFIX@/include
+ Name: @PROJECT_NAME@
diff --git a/sci-libs/lemon/lemon-1.3.1.ebuild b/sci-libs/lemon/lemon-1.3.1.ebuild
new file mode 100644 (file)
index 0000000..f523732
--- /dev/null
@@ -0,0 +1,90 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Needed to build tests for now
+CMAKE_MAKEFILE_GENERATOR=emake
+inherit cmake
+
+DESCRIPTION="C++ template static library of common data structures and algorithms"
+# the official website seems to no longer be available
+HOMEPAGE="https://github.com/The-OpenROAD-Project/lemon-graph"
+SRC_URI="https://github.com/The-OpenROAD-Project/lemon-graph/archive/refs/tags/${PV}.tar.gz"
+
+S="${WORKDIR}/${PN}-graph-${PV}"
+
+LICENSE="Boost-1.0"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="+coin doc glpk static-libs test"
+
+REQUIRED_USE="|| ( coin glpk )"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       coin? (
+               sci-libs/coinor-cbc:=
+               sci-libs/coinor-clp:=
+       )
+       glpk? ( sci-mathematics/glpk:= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       doc? (
+               app-text/doxygen
+               app-text/ghostscript-gpl
+               <dev-libs/mathjax-3
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-multilib.patch
+       "${FILESDIR}"/${PN}-as-needed.patch
+       "${FILESDIR}"/${P}-cmake4.patch # bug 967729
+       "${FILESDIR}"/${PN}-disable-broken-tests.patch
+)
+
+src_prepare() {
+       cmake_comment_add_subdirectory demo
+
+       use doc || cmake_comment_add_subdirectory doc
+       use test || cmake_comment_add_subdirectory test
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DLEMON_ENABLE_COIN=$(usex coin)
+               -DLEMON_ENABLE_GLPK=$(usex glpk)
+       )
+
+       use coin && mycmakeargs+=( -DCOIN_ROOT_DIR="${EPREFIX}/usr" )
+
+       if use doc; then
+               mycmakeargs+=(
+                       -DLEMON_DOC_MATHJAX_RELPATH="${EPREFIX}/usr/share/mathjax"
+                       -DLEMON_DOC_SOURCE_BROWSER=$(usex doc)
+                       -DLEMON_DOC_USE_MATHJAX=$(usex doc)
+               )
+       fi
+
+       cmake_src_configure
+}
+
+src_test() {
+       pushd "${S}" > /dev/null || die
+               emake -C "${BUILD_DIR}" check
+       popd > /dev/null || die
+}
+
+src_install() {
+       cmake_src_install
+
+       # TODO: Upstream needs to see the light of GNUInstallDirs
+       if use doc; then
+               mv "${ED}"/usr/share/doc/lemon/html "${ED}"/usr/share/doc/${PF} || die
+               rmdir "${ED}"/usr/share/doc/lemon || die
+       fi
+}
diff --git a/sci-libs/lemon/lemon-9999.ebuild b/sci-libs/lemon/lemon-9999.ebuild
new file mode 100644 (file)
index 0000000..b2b7ec3
--- /dev/null
@@ -0,0 +1,87 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+# Needed to build tests for now
+CMAKE_MAKEFILE_GENERATOR=emake
+inherit cmake git-r3
+
+DESCRIPTION="C++ template static library of common data structures and algorithms"
+# the official website seems to no longer be available
+HOMEPAGE="https://github.com/The-OpenROAD-Project/lemon-graph"
+EGIT_REPO_URI="https://github.com/The-OpenROAD-Project/lemon-graph"
+
+LICENSE="Boost-1.0"
+SLOT="0"
+KEYWORDS=""
+IUSE="+coin doc glpk static-libs test"
+
+REQUIRED_USE="|| ( coin glpk )"
+RESTRICT="!test? ( test )"
+
+RDEPEND="
+       coin? (
+               sci-libs/coinor-cbc:=
+               sci-libs/coinor-clp:=
+       )
+       glpk? ( sci-mathematics/glpk:= )
+"
+DEPEND="${RDEPEND}"
+BDEPEND="
+       doc? (
+               app-text/doxygen
+               app-text/ghostscript-gpl
+               <dev-libs/mathjax-3
+       )
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-multilib.patch
+       "${FILESDIR}"/${PN}-as-needed.patch
+       "${FILESDIR}"/${PN}-disable-broken-tests.patch
+)
+
+src_prepare() {
+       cmake_comment_add_subdirectory demo
+
+       use doc || cmake_comment_add_subdirectory doc
+       use test || cmake_comment_add_subdirectory test
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DLEMON_ENABLE_COIN=$(usex coin)
+               -DLEMON_ENABLE_GLPK=$(usex glpk)
+       )
+
+       use coin && mycmakeargs+=( -DCOIN_ROOT_DIR="${EPREFIX}/usr" )
+
+       if use doc; then
+               mycmakeargs+=(
+                       -DLEMON_DOC_MATHJAX_RELPATH="${EPREFIX}/usr/share/mathjax"
+                       -DLEMON_DOC_SOURCE_BROWSER=$(usex doc)
+                       -DLEMON_DOC_USE_MATHJAX=$(usex doc)
+               )
+       fi
+
+       cmake_src_configure
+}
+
+src_test() {
+       pushd "${S}" > /dev/null || die
+               emake -C "${BUILD_DIR}" check
+       popd > /dev/null || die
+}
+
+src_install() {
+       cmake_src_install
+
+       # TODO: Upstream needs to see the light of GNUInstallDirs
+       if use doc; then
+               mv "${ED}"/usr/share/doc/lemon/html "${ED}"/usr/share/doc/${PF} || die
+               rmdir "${ED}"/usr/share/doc/lemon || die
+       fi
+}
diff --git a/sci-libs/lemon/metadata.xml b/sci-libs/lemon/metadata.xml
new file mode 100644 (file)
index 0000000..07541a4
--- /dev/null
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="project">
+               <email>disk.destroyer@yahoo.com</email>
+               <name>datadissipation.net</name>
+       </maintainer>
+       <longdescription>
+               LEMON stands for Library for Efficient Modeling and Optimization in
+               Networks. It is a C++ template library providing efficient
+               implementations of common data structures and algorithms with focus
+               on combinatorial optimization tasks connected mainly with graphs and
+               networks.
+       </longdescription>
+       <use>
+               <flag name="coin">Enable the <pkg>sci-libs/coinor-clp</pkg> and <pkg>sci-libs/coinor-cbc</pkg> graph algorithms</flag>
+               <flag name="glpk">Enable GNU Linear Programming Kit <pkg>sci-mathematics/glpk</pkg> support</flag>
+       </use>
+</pkgmetadata>