me
/
guix
Archived
1
0
Fork 0

gnu: gecode: Update to 6.2.0-1.f7f0d7c.

* gnu/packages/maths.scm (gecode): Update to 6.2.0-1.f7f0d7c.
[version]: Use version.
[arguments]: Add patch-msc-and-version phase.  Install examples to the
examples output again.
(minizinc)[arguments]: Copy provided gecode.msc file instead.

Change-Id: I5e89105f3fef61d6aa677a4a118225679220ce5d
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
master
Herman Rimm 2024-05-15 20:01:58 +02:00 committed by Ludovic Courtès
parent e170c51404
commit 4b443b41f4
No known key found for this signature in database
GPG Key ID: 090B11993D9AEBB5
1 changed files with 43 additions and 62 deletions

View File

@ -2704,28 +2704,26 @@ and quadratic objectives using the Simplex algorithm.")
(license license:epl1.0))) (license license:epl1.0)))
(define-public gecode (define-public gecode
;; The current release is not compatible with minizinc anymore. (let* ((commit "f7f0d7c273d6844698f01cec8229ebe0b66a016a")
;; Use a commit that has been tested with minizinc. (version (git-version "6.2.0" "1" commit)))
(let ((commit "2d20e88cae176584b6e09d909aca3eb72ae76829")
(revision "2"))
(package (package
(name "gecode") (name "gecode")
(version (git-version "6.2.0" revision commit)) (version version)
(source (source
(origin (origin
(method git-fetch) (method git-fetch)
(uri (git-reference (uri (git-reference
(url "https://github.com/Gecode/gecode") (url "https://github.com/Gecode/gecode")
(commit commit))) (commit commit)))
(file-name (git-file-name name version)) (file-name (git-file-name name version))
(sha256 (sha256
(base32 "0hf7hd7m5p26xwn8f561f0gn2a6q33xz818jg3ivmvp2ysmmmm4r")) (base32
"16gzwa64w90vifaflmii515rsrqclf2y7nziq621m4ad9cjgcixj"))
(modules '((guix build utils))) (modules '((guix build utils)))
(snippet '(begin ;; delete generated sources
;; delete generated sources (snippet '(for-each delete-file
(for-each delete-file '("gecode/kernel/var-imp.hpp"
'("gecode/kernel/var-imp.hpp" "gecode/kernel/var-type.hpp")))))
"gecode/kernel/var-type.hpp"))))))
(outputs '("out" "examples")) (outputs '("out" "examples"))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
@ -2739,6 +2737,16 @@ and quadratic objectives using the Simplex algorithm.")
(ice-9 popen)) (ice-9 popen))
#:phases #:phases
#~(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-before 'configure 'patch-msc-and-version
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(substitute* "tools/flatzinc/gecode.msc.in"
(("\\.\\./../..") out)
(("\\.\\.")
(string-append out "/share/minizinc")))
(substitute* "configure"
(("(PACKAGE_[^0-9]*)[0-9\\.]+" all match)
(string-append match #$version))))))
(add-after 'build 'build-examples (add-after 'build 'build-examples
(lambda _ (lambda _
(invoke "make" "compileexamples"))) (invoke "make" "compileexamples")))
@ -2747,33 +2755,27 @@ and quadratic objectives using the Simplex algorithm.")
(add-after 'install 'fix-rpath (add-after 'install 'fix-rpath
(lambda _ (lambda _
(let ((libdir (string-append #$output "/lib"))) (let ((libdir (string-append #$output "/lib")))
(for-each (lambda (file) (for-each
(let* ((pipe (open-pipe* OPEN_READ (lambda (file)
"patchelf" (let* ((pipe (open-pipe* OPEN_READ "patchelf"
"--print-rpath" file)) "--print-rpath" file))
(line (read-line pipe))) (line (read-line pipe)))
(and (zero? (close-pipe pipe)) (and (zero? (close-pipe pipe))
(invoke "patchelf" "--set-rpath" (invoke "patchelf" "--set-rpath"
(string-append libdir (string-append libdir ":" line)
":" line) file))))
file)))) (find-files libdir ".*\\.so$")))))
(find-files libdir ".*\\.so$")))))
(add-after 'install 'install-examples (add-after 'install 'install-examples
(lambda _ (lambda* (#:key outputs #:allow-other-keys)
(invoke "make" "installexamples" (let* ((examples (assoc-ref outputs "examples"))
(string-append "bindir=" (bindir (format #f "bindir=~a/bin" examples)))
#$output "/bin")))) (invoke "make" "installexamples" bindir)))))))
;; Tests depend on installed libraries.
(delete 'check)
(add-after 'fix-rpath 'check
(assoc-ref %standard-phases
'check)))))
(native-inputs (list patchelf perl sed)) (native-inputs (list patchelf perl sed))
(home-page "https://www.gecode.org") (home-page "https://www.gecode.org")
(synopsis "Toolkit for developing constraint-based systems") (synopsis "Toolkit for developing constraint-based systems")
(description (description
"Gecode is a C++ toolkit for developing constraint-based "Gecode is a C++ toolkit for developing constraint-based systems
systems and applications. It provides a modular and extensible solver.") and applications. It provides a modular and extensible solver.")
(license license:expat)))) (license license:expat))))
(define-public libfixmath (define-public libfixmath
@ -4181,33 +4183,12 @@ book.")
}" }"
port) port)
(newline port))) (newline port)))
(for-each
(copy-recursively (lambda (solver)
(string-append chuffed "/share/minizinc/solvers") (copy-recursively
(string-append pkgdatadir "/solvers")) (string-append solver "/share/minizinc/solvers")
(call-with-output-file (string-append pkgdatadir (string-append pkgdatadir "/solvers")))
"/solvers/gecode.msc") (list gecode chuffed))))))))
(lambda (port)
(format port
"\
{
\"id\": \"org.gecode.gecode\",
\"name\": \"Gecode\",
\"description\": \"Gecode FlatZinc executable\",
\"version\": ~s,
\"mznlib\": ~s,
\"executable\": ~s,
\"supportsMzn\": false,
\"supportsFzn\": true,
\"needsSolns2Out\": true,
\"needsMznExecutable\": false,
\"needsStdlibDir\": false,
\"isGUIApplication\": false
}"
(last (string-split gecode #\-))
(string-append gecode "/share/gecode/mznlib")
(string-append gecode "/bin/fzn-gecode"))
(newline port)))))))))
(native-inputs (native-inputs
(list bison flex)) (list bison flex))
(inputs (inputs