[PATCH 0/3] Add clingo

  • Done
  • quality assurance status badge
Details
One participant
  • Liliana Marie Prikler
Owner
unassigned
Submitted by
Liliana Marie Prikler
Severity
normal
L
L
Liliana Marie Prikler wrote on 1 Oct 2021 11:51
(name . guix-patches)(address . guix-patches@gnu.org)
cover.1633081882.git.liliana.prikler@gmail.com
This patch adds a package for clingo ad its dependencies. I haven't
tested clingo itself (I did test clasp however) and the test suite has
two failing assertion in the solver category, but as far as I can see
it ought to work mostly.

Regards,
Liliana

Liliana Marie Prikler (3):
gnu: Add libpotassco.
gnu: Add clasp.
gnu: Add clingo.

gnu/packages/maths.scm | 157 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 157 insertions(+)

--
2.33.0
L
L
Liliana Marie Prikler wrote on 25 Sep 2021 11:51
[PATCH 1/3] gnu: Add libpotassco.
(address . 50933@debbugs.gnu.org)
6f6894593962c94927eedc074cca29e682a23cb2.1633081882.git.liliana.prikler@gmail.com
* gnu/packages/maths.scm (libpotassco): New variable.
---
gnu/packages/maths.scm | 49 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)

Toggle diff (62 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 164924b6af..dbb149db53 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -2194,6 +2194,55 @@ Computational Engineering and Sciences} at The University of Texas at Austin.
includes a complete LAPACK implementation.")
(license license:bsd-3)))
+(define-public libpotassco
+ ;; No public release, update together with clasp
+ (let ((revision "1")
+ (commit "2f9fb7ca2c202f1b47643aa414054f2f4f9c1821"))
+ (package
+ (name "libpotassco")
+ (version (git-version "0.0" revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/potassco/libpotassco")
+ (commit commit)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "1c32f9gqclf7qx07lpx8wd720vfhkjqhzc6nyy8mjmgwpmb3iyyn"))))
+ (arguments
+ `(#:configure-flags '("-DLIB_POTASSCO_BUILD_TESTS=on"
+ "-DLIB_POTASSCO_INSTALL_LIB=on"
+ "-DBUILD_SHARED_LIBS=on")
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-cmake
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ ;; clasp expects lowercase potassco and include directory is
+ ;; lowercase as well, so let's use that
+ (("\"cmake/Potassco\"") "\"cmake/potassco\"")
+ (("PotasscoConfig\\.cmake") "potassco-config.cmake")
+ (("PotasscoConfigVersion\\.cmake")
+ "potassco-config-version.cmake"))
+ (rename-file "cmake/PotasscoConfig.cmake.in"
+ "cmake/potassco-config.cmake.in"))))))
+ (build-system cmake-build-system)
+ (home-page "https://potassco.org/")
+ (synopsis "Utility library for Potassco's projects")
+ (description "@code{libpotassco} is a utility library providing functions
+and datatypes for
+@itemize
+@item parsing, writing, and converting logic programs in aspif and smodels
+format,
+@item passing information between a grounder and a solver,
+@item and defining and parsing command-line options and for creating
+command-line applications.
+@end itemize
+Furthermore, it comes with the tool @command{lpconvert} that converts either
+between aspif and smodels format or to a human-readable text format.")
+ (license license:expat))))
+
(define-public ceres
(package
(name "ceres-solver")
--
2.33.0
L
L
Liliana Marie Prikler wrote on 1 Oct 2021 11:47
[PATCH 3/3] gnu: Add clingo.
(address . 50933@debbugs.gnu.org)
152ca434f5cd88d6f61e01df91d6ff818745cafc.1633081882.git.liliana.prikler@gmail.com
* gnu/packages/maths.scm (clingo): New variable.
---
gnu/packages/maths.scm | 65 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 65 insertions(+)

Toggle diff (78 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index f9790dd64a..4baca52007 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -2286,6 +2286,71 @@ conflict-driven nogood learning, a technique that proved very successful for
satisfiability checking (SAT).")
(license license:expat)))
+(define-public clingo
+ (package
+ (name "clingo")
+ (version "5.5.0")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/potassco/clingo")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0rfjwkcwm0mmf3r4i7asyjwb6cia4i7px7fn2kdbi9j85qvas4pb"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags `("-DCLINGO_BUILD_TESTS=on"
+ "-DCLINGO_INSTALL_LIB=on"
+ "-DCLINGO_BUILD_STATIC=off"
+ "-DCLINGO_BUILD_SHARED=on"
+ ;; XXX: Clingo requries private headers and
+ ;; sources from clasp
+ ,(string-append
+ "-DCLASP_SOURCE_DIR="
+ (assoc-ref %build-inputs "clasp-src")))
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-cmake
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ (("add_subdirectory\\(clasp\\)")
+ "find_package(clasp REQUIRED)"))
+ (substitute* "libclingo/CMakeLists.txt"
+ (("\"cmake/Clingo\"") "\"cmake/clingo\"")
+ (("ClingoConfig\\.cmake") "clingo-config.cmake")
+ (("ClingoConfigVersion\\.cmake")
+ "clingo-config-version.cmake"))
+ (substitute* "cmake/ClingoConfig.cmake.in"
+ (("find_package\\(Clasp") "find_package(clasp"))
+ (rename-file "cmake/ClingoConfig.cmake.in"
+ "cmake/clingo-config.cmake.in")))
+ (add-after 'unpack 'skip-failing-tests
+ (lambda _
+ (with-directory-excursion "libclingo/tests"
+ (substitute* "CMakeLists.txt"
+ (("COMMAND test_clingo" all)
+ (string-append all
+ " -f "
+ "\"${CMAKE_CURRENT_SOURCE_DIR}/good.txt\"")))
+ (call-with-output-file "good.txt"
+ (lambda (port)
+ (for-each (lambda (test) (format port "~s~%" test))
+ '("parse-ast-v2" "add-ast-v2" "build-ast-v2"
+ "unpool-ast-v2" "parse_term"
+ "propagator" "propgator-sequence-mining"
+ "symbol" "visitor"))))))))))
+ (inputs
+ `(("clasp" ,clasp)
+ ("libpotassco" ,libpotassco)))
+ (native-inputs
+ `(("clasp-src" ,(package-source clasp))))
+ (home-page "https://potassco.org/")
+ (synopsis "Grounder and solver for logic programs")
+ (description "Clingo computes answer sets for a given logic program.")
+ (license license:expat)))
+
(define-public ceres
(package
(name "ceres-solver")
--
2.33.0
L
L
Liliana Marie Prikler wrote on 25 Sep 2021 13:16
[PATCH 2/3] gnu: Add clasp.
(address . 50933@debbugs.gnu.org)
81efb43dc035062c61fc759fda62d09effcd2d29.1633081882.git.liliana.prikler@gmail.com
* gnu/packages/maths.scm (clasp): New variable.
---
gnu/packages/maths.scm | 43 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)

Toggle diff (56 lines)
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index dbb149db53..f9790dd64a 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -2243,6 +2243,49 @@ Furthermore, it comes with the tool @command{lpconvert} that converts either
between aspif and smodels format or to a human-readable text format.")
(license license:expat))))
+(define-public clasp
+ (package
+ (name "clasp")
+ (version "3.3.6")
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/potassco/clasp")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32
+ "0rahqiq530jckvx717858h1q5p8znp1kb6sjm95p8blkr4n3pvmj"))))
+ (build-system cmake-build-system)
+ (arguments
+ `(#:configure-flags '("-DCLASP_BUILD_TESTS=on"
+ "-DCLASP_INSTALL_LIB=on"
+ "-DCLASP_USE_LOCAL_LIB_POTASSCO=off"
+ "-DBUILD_SHARED_LIBS=on")
+ #:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'patch-cmake
+ (lambda _
+ (substitute* "CMakeLists.txt"
+ ;; Use lowercase to be consistent with libpotassco
+ (("\"cmake/Clasp\"") "\"cmake/clasp\"")
+ (("ClaspConfig\\.cmake") "clasp-config.cmake")
+ (("ClaspConfigVersion\\.cmake")
+ "clasp-config-version.cmake"))
+ (substitute* "cmake/ClaspConfig.cmake.in"
+ (("find_package\\(Potassco") "find_package(potassco"))
+ (rename-file "cmake/ClaspConfig.cmake.in"
+ "cmake/clasp-config.cmake.in"))))))
+ (inputs
+ `(("libpotassco" ,libpotassco)))
+ (home-page "https://potassco.org/")
+ (synopsis "Answer set solver")
+ (description "clasp is an answer set solver for (extended) normal and
+disjunctive logic programs. The primary algorithm of clasp relies on
+conflict-driven nogood learning, a technique that proved very successful for
+satisfiability checking (SAT).")
+ (license license:expat)))
+
(define-public ceres
(package
(name "ceres-solver")
--
2.33.0
L
L
Liliana Marie Prikler wrote on 24 Oct 2021 20:44
Re: [PATCH 0/3] Add clingo
(address . 50933-done@debbugs.gnu.org)
dda3420340529e274561fb59a63f386e1df2db37.camel@gmail.com
Am Freitag, den 01.10.2021, 11:51 +0200 schrieb Liliana Marie Prikler:
Toggle quote (4 lines)
> This patch adds a package for clingo ad its dependencies. I haven't
> tested clingo itself (I did test clasp however) and the test suite
> has two failing assertion in the solver category, but as far as I can
> see it ought to work mostly.
After finally getting around to test that clingo indeed can solve crime
[1], I've decided to push this patch set.

Regards,
Liliana

Closed
?