Subject: [PATCH] gnu: Add clingo-lpx.

From: Liliana Marie Prikler <[email-masked]>
Date: Thu, 3 Oct 2024 08:11:13 +0200

* gnu/packages/potassco.scm (clingo-lpx): New variable.
---
 gnu/packages/potassco.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/gnu/packages/potassco.scm b/gnu/packages/potassco.scm
index 9f6b48f890..3465974fde 100644
--- a/gnu/packages/potassco.scm
+++ b/gnu/packages/potassco.scm
@@ -32,6 +32,7 @@ (define-module (gnu packages potassco)
   #:use-module (guix build-system emacs)
   #:use-module (guix build-system python)
   #:use-module (guix build-system pyproject)
+  #:use-module (gnu packages algebra)
   #:use-module (gnu packages bison)
   #:use-module (gnu packages check)
   #:use-module (gnu packages cpp)
@@ -238,6 +239,42 @@ (define-public clingo-dl
 over difference logic.")
     (license license:expat)))
 
+(define-public clingo-lpx
+  (package
+    (name "clingo-lpx")
+    (version "1.3.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/potassco/clingo-lpx")
+                    (commit (string-append "v" version))))
+              (file-name (git-file-name name version))
+              (modules '((guix build utils)))
+              (snippet
+               #~(begin
+                   (delete-file-recursively "third_party")))
+              (sha256
+               (base32
+                "1i184gy18k0mpqywbgziwl5wzkwwcdks81axndk4x6hjy878vhww"))))
+    (build-system cmake-build-system)
+    (arguments
+     (list #:configure-flags #~(list "-DCLINGOLPX_BUILD_TESTS=on"
+                                     "-DPYCLINGOLPX_ENABLE=off")
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'patch-cmake
+                 (lambda _
+                   (substitute* "CMakeLists.txt"
+                     (("add_subdirectory\\(third_party\\)")
+                      "find_package(Catch2 3 REQUIRED)")))))))
+    (home-page "https://github.com/potassco/clingo-lpx")
+    (inputs (list clingo flint))
+    (native-inputs (list catch2-3))
+    (synopsis "Simplex solver")
+    (description "Clingo-LPX is an extension to Clingo that models constraints
+and goals over linear (in)equations.")
+    (license license:expat)))
+
 (define-public plasp
   (package
     (name "plasp")

base-commit: 061e0acd596262420facef7c2d1fc9cc4327d75a
-- 
2.46.0