Subject: [bug#70087] [PATCH 3/4] gnu: minizinc: Add chuffed backend.

From: Herman Rimm <[email-masked]>
Date: Sat, 30 Mar 2024 12:42:40 +0100

* gnu/packages/maths.scm (minizinc): Add backend.

Change-Id: If178a7585d70eb4b6f3223f5f6b2f34d9d2f2257
---
 gnu/packages/maths.scm | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm
index 0c08851616..fd44f1f985 100644
--- a/gnu/packages/maths.scm
+++ b/gnu/packages/maths.scm
@@ -4065,9 +4065,9 @@ (define-public minizinc
                                (lambda (file)
                                  (member file (cons* "." ".." targets)))
                                (scandir ".")))
-                    (substitute* "libmzn.cmake"
-                      (("include\\(cmake/targets/(.*)\\)" all target)
-                       (if (member target targets) all "")))))
+                     (substitute* "libmzn.cmake"
+                       (("include\\(cmake/targets/(.*)\\)" all target)
+                        (if (member target targets) all "")))))
                   (with-directory-excursion "include/minizinc/solvers/MIP"
                     (for-each delete-file
                               (remove
@@ -4106,9 +4106,10 @@ (define-public minizinc
        (modify-phases %standard-phases
          (add-after 'install 'install-solver-configs
            (lambda* (#:key inputs outputs #:allow-other-keys)
-             (let ((gecode (assoc-ref inputs "gecode"))
+             (let ((chuffed (assoc-ref inputs "chuffed"))
+                   (gecode (assoc-ref inputs "gecode"))
                    (pkgdatadir (string-append (assoc-ref outputs "out")
-                                                  "/share/minizinc")))
+                                              "/share/minizinc")))
                (call-with-output-file (string-append pkgdatadir
                                                      "/Preferences.json")
                  (lambda (port)
@@ -4123,7 +4124,9 @@ (define-public minizinc
                             port)
                    (newline port)))
 
-               (mkdir-p (string-append pkgdatadir "/solvers"))
+               (copy-recursively
+                 (string-append chuffed "/share/minizinc/solvers")
+                 (string-append pkgdatadir "/solvers"))
                (call-with-output-file (string-append pkgdatadir
                                                      "/solvers/gecode.msc")
                  (lambda (port)
@@ -4150,7 +4153,7 @@ (define-public minizinc
     (native-inputs
      (list bison flex))
     (inputs
-     (list cbc gecode zlib))
+     (list cbc chuffed gecode zlib))
     (home-page "https://www.minizinc.org")
     (synopsis "High-level constraint modeling language")
     (description "MiniZinc is a high-level modeling language for constraint
-- 
2.41.0