unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: 50933@debbugs.gnu.org
Subject: [bug#50933] [PATCH 3/3] gnu: Add clingo.
Date: Fri, 1 Oct 2021 11:47:17 +0200	[thread overview]
Message-ID: <152ca434f5cd88d6f61e01df91d6ff818745cafc.1633081882.git.liliana.prikler@gmail.com> (raw)
In-Reply-To: <cover.1633081882.git.liliana.prikler@gmail.com>

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

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






  parent reply	other threads:[~2021-10-01 10:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-01  9:51 [bug#50933] [PATCH 0/3] Add clingo Liliana Marie Prikler
2021-09-25  9:51 ` [bug#50933] [PATCH 1/3] gnu: Add libpotassco Liliana Marie Prikler
2021-09-25 11:16 ` [bug#50933] [PATCH 2/3] gnu: Add clasp Liliana Marie Prikler
2021-10-01  9:47 ` Liliana Marie Prikler [this message]
2021-10-24 18:44 ` bug#50933: [PATCH 0/3] Add clingo Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=152ca434f5cd88d6f61e01df91d6ff818745cafc.1633081882.git.liliana.prikler@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=50933@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).