diff options
author | Mathieu Othacehe <othacehe@gnu.org> | 2021-10-12 16:50:47 +0000 |
---|---|---|
committer | Mathieu Othacehe <othacehe@gnu.org> | 2021-10-12 17:46:23 +0000 |
commit | a1eca979fb8da842e73c42f4f53be29b169810f2 (patch) | |
tree | 681c7283e412bb8a29c2531c4408b49c3e184764 /gnu/packages/maths.scm | |
parent | 48d86a9ec6d8d2e97da2299ea41a03ef4cdaab83 (diff) | |
parent | 371aa5777a3805a3886f3feea5f1960fe3fe4219 (diff) | |
download | guix-a1eca979fb8da842e73c42f4f53be29b169810f2.tar guix-a1eca979fb8da842e73c42f4f53be29b169810f2.tar.gz |
Merge remote-tracking branch 'origin/master' into core-updates-frozen.
Diffstat (limited to 'gnu/packages/maths.scm')
-rw-r--r-- | gnu/packages/maths.scm | 252 |
1 files changed, 241 insertions, 11 deletions
diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 7b07cb4342..dc4d7f677c 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -2071,6 +2071,77 @@ linear and quadratic objectives. There are limited facilities for nonlinear and quadratic objectives using the Simplex algorithm.") (license license:epl1.0))) +(define-public gecode + (package + (name "gecode") + (version "6.2.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/Gecode/gecode") + (commit (string-append "release-" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0b1cq0c810j1xr2x9y9996p894571sdxng5h74py17c6nr8c6dmk")) + (modules '((guix build utils))) + (snippet + '(begin + ;; delete generated sources + (for-each delete-file + '("gecode/kernel/var-imp.hpp" + "gecode/kernel/var-type.hpp")))))) + (outputs '("out" "examples")) + (build-system gnu-build-system) + (arguments + `(#:configure-flags + (list (string-append "GLDFLAGS=-Wl,-rpath=" + (assoc-ref %outputs "out") + "/lib") + "--enable-examples=no") + #:modules ((guix build gnu-build-system) + (guix build utils) + (ice-9 rdelim) + (ice-9 popen)) + #:phases + (modify-phases %standard-phases + (add-after 'build 'build-examples + (lambda* (#:key outputs #:allow-other-keys) + (invoke "make" "compileexamples"))) + ;; The Makefile disrespects GLDFLAGS for some reason, so we have to + ;; patch it ourselves... *sigh* + (add-after 'install 'fix-rpath + (lambda* (#:key outputs #:allow-other-keys) + (let ((libdir (string-append (assoc-ref outputs "out") "/lib"))) + (for-each + (lambda (file) + (let* ((pipe (open-pipe* OPEN_READ "patchelf" + "--print-rpath" file)) + (line (read-line pipe))) + (and (zero? (close-pipe pipe)) + (invoke "patchelf" "--set-rpath" + (string-append libdir ":" line) + file)))) + (find-files libdir ".*\\.so$"))))) + (add-after 'install 'install-examples + (lambda* (#:key outputs #:allow-other-keys) + (invoke "make" "installexamples" + (string-append "bindir=" (assoc-ref outputs "examples") + "/bin")))) + ;; Tests depend on installed libraries. + (delete 'check) + (add-after 'fix-rpath 'check + (assoc-ref %standard-phases 'check))))) + (native-inputs + `(("patchelf" ,patchelf) + ("perl" ,perl) + ("sed" ,sed))) + (home-page "https://www.gecode.org") + (synopsis "Toolkit for developing constraint-based systems") + (description "Gecode is a C++ toolkit for developing constraint-based +systems and applications. It provides a modular and extensible solver.") + (license license:expat))) + (define-public libflame (package (name "libflame") @@ -3049,6 +3120,136 @@ the Cauchy-Schwarz inequality, Stirling's formula, etc. See the Metamath book.") (license license:gpl2+))) +(define-public minizinc + (package + (name "minizinc") + (version "2.5.5") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/MiniZinc/libminizinc") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "10b2hsl1fx9psh0iagmp8ki3f60f3qg5hmvra5aczjlfmbl88ggp")) + (modules '((guix build utils) + (ice-9 ftw) + (srfi srfi-1))) + (snippet + '(begin + ;; Do not advertise proprietary solvers + (with-directory-excursion "cmake/targets" + (let ((targets '("libminizinc_fzn.cmake" + "libminizinc_gecode.cmake" + "libminizinc_mip.cmake" + "libminizinc_nl.cmake" + "libminizinc_osicbc.cmake" + "libminizinc_parser.cmake" + "libmzn.cmake" + "minizinc.cmake" + "mzn2doc.cmake"))) + (for-each delete-file + (remove + (lambda (file) + (member file (cons* "." ".." targets))) + (scandir "."))) + (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 + (lambda (file) + (member file '("." ".." + "MIP_osicbc_solverfactory.hh" + "MIP_osicbc_wrap.hh" + "MIP_solverinstance.hh" + "MIP_solverinstance.hpp" + "MIP_wrap.hh"))) + (scandir ".")))) + (with-directory-excursion "solvers/MIP" + (for-each delete-file + (remove + (lambda (file) + (member file '("." ".." + "MIP_osicbc_solverfactory.cpp" + "MIP_osicbc_wrap.cpp" + "MIP_solverinstance.cpp" + "MIP_wrap.cpp"))) + (scandir ".")))) + (substitute* "CMakeLists.txt" + (("find_package\\(([^ ]*).*\\)" all pkg) + (if (member pkg '("Gecode" "OsiCBC" "Threads")) + all + ""))) + ;; TODO: swap out miniz for zlib + #t)))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; no ‘check’ target + #:modules ((guix build cmake-build-system) + (guix build utils) + (srfi srfi-1)) + #:phases + (modify-phases %standard-phases + (add-after 'install 'install-solver-configs + (lambda* (#:key inputs outputs #:allow-other-keys) + (let ((gecode (assoc-ref inputs "gecode")) + (pkgdatadir (string-append (assoc-ref outputs "out") + "/share/minizinc"))) + (call-with-output-file (string-append pkgdatadir + "/Preferences.json") + (lambda (port) + (display "\ +{ + \"tagDefaults\": [ + [\"\", \"org.gecode.gecode\"], + [\"gecode\", \"org.gecode.gecode\"] + ], + \"solverDefaults\": [] +}" + port) + (newline port))) + + (mkdir-p (string-append pkgdatadir "/solvers")) + (call-with-output-file (string-append pkgdatadir + "/solvers/gecode.msc") + (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 + `(("bison" ,bison) + ("flex" ,flex))) + (inputs + `(("cbc" ,cbc) + ("gecode" ,gecode) + ("zlib" ,zlib))) + (home-page "https://www.minizinc.org") + (synopsis "High-level constraint modeling language") + (description "MiniZinc is a high-level modeling language for constraint +satisfaction and optimization problems. Models are compiled to FlatZinc, a +language understood by many solvers.") + (license license:mpl2.0))) + (define-public mumps (package (name "mumps") @@ -5615,7 +5816,7 @@ reduction.") version ".tar.gz")) (sha256 (base32 - "0db9wgy9spwm76mgfisnifrlg69y9cadjgxjr4gdwzfgg6wgqf6d")))) + "1xgx3cd57vc7gbjic24j1q2za6j3ybz6nk4afvvpbwsf33xnlf4v")))) (inputs `(("boost" ,boost) ("glu" ,glu) @@ -6742,17 +6943,21 @@ numeric differences and differences in numeric formats.") (define-public why3 (package (name "why3") - (version "1.3.3") + (version "1.4.0") (source (origin - (method url-fetch) - (uri (string-append "https://gforge.inria.fr/frs/download.php/file" - "/38367/why3-" version ".tar.gz")) + (method git-fetch) + (uri (git-reference + (url "https://gitlab.inria.fr/why3/why3") + (commit version))) + (file-name (git-file-name name version)) (sha256 (base32 - "1n0a2nn1gnk0zg339lh698g4wpk7m8m1vyi2yvifd5adqvk4milw")))) + "0pfsiddnk26f384wbazfpgzh1n1ibf3xq101q74mxvczi7z0a791")))) (build-system ocaml-build-system) (native-inputs - `(("coq" ,coq) + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("coq" ,coq) ("ocaml" ,ocaml) ("which" ,which))) (propagated-inputs @@ -6768,10 +6973,12 @@ numeric differences and differences in numeric formats.") (arguments `(#:phases (modify-phases %standard-phases - (add-before 'configure 'fix-configure + (add-before 'configure 'bootstrap (lambda _ + (invoke "./autogen.sh") (setenv "CONFIG_SHELL" (which "sh")) (substitute* "configure" + (("#! /bin/sh") (string-append "#!" (which "sh"))) ;; find ocaml-num in the correct directory (("\\$DIR/nums.cma") "$DIR/num.cma") (("\\$DIR/num.cmi") "$DIR/core/num.cmi")) @@ -6803,14 +7010,14 @@ of C, Java, or Ada programs.") (define-public frama-c (package (name "frama-c") - (version "22.0") + (version "23.1") (source (origin (method url-fetch) (uri (string-append "http://frama-c.com/download/frama-c-" - version "-Titanium.tar.gz")) + version "-Vanadium.tar.gz")) (sha256 (base32 - "1mq1fijka95ydrla486yr4w6wdl9l7vmp512s1q00b0p6lmfwmkh")))) + "1rgkq9sg436smw005ag0j6y3xryhjn18a07m5wjfrfp0s1438nnj")))) (build-system ocaml-build-system) (arguments `(#:tests? #f; no test target in Makefile @@ -6930,6 +7137,29 @@ when an application performs repeated divisions by the same divisor.") "05mm4vrxsac35hjf5djif9r6rdxj9ippg97ia3p6q6b8lrp7srwv")) (patches (search-patches "fp16-system-libraries.patch")))) (build-system cmake-build-system) + (arguments + `(#:imported-modules ((guix build python-build-system) + ,@%cmake-build-system-modules) + #:modules (((guix build python-build-system) + #:select (site-packages)) + (guix build cmake-build-system) + (guix build utils)) + #:phases (modify-phases %standard-phases + (add-after 'install 'move-python-files + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; Python files get installed to $includedir (!). + ;; Move them to the usual Python site directory. + (let* ((out (assoc-ref outputs "out")) + (include (string-append out "/include")) + (site (site-packages inputs outputs)) + (target (string-append site "/fp16"))) + (mkdir-p target) + (for-each (lambda (file) + (rename-file file + (string-append target "/" + (basename + file)))) + (find-files include "\\.py$")))))))) (native-inputs `(("python-wrapper" ,python-wrapper))) (inputs |