From 9fc13943b29196763524ddbc247218398d889459 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Mon, 16 Dec 2019 12:09:16 +0100 Subject: [PATCH 1/2] gnu: Add why3. * gnu/packages/maths.scm (why3): New variable. --- gnu/packages/maths.scm | 67 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 0ed61ad4a1..991f164737 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -28,7 +28,7 @@ ;;; Copyright © 2018 Adam Massmann ;;; Copyright © 2018 Marius Bakke ;;; Copyright © 2018 Eric Brown -;;; Copyright © 2018 Julien Lepiller +;;; Copyright © 2018, 2019 Julien Lepiller ;;; Copyright © 2018 Amin Bandali ;;; Copyright © 2019 Nicolas Goaziou ;;; Copyright © 2019 Steve Sprang @@ -61,6 +61,7 @@ #:use-module ((guix build utils) #:select (alist-replace)) #:use-module (guix build-system cmake) #:use-module (guix build-system gnu) + #:use-module (guix build-system ocaml) #:use-module (guix build-system python) #:use-module (guix build-system ruby) #:use-module (gnu packages algebra) @@ -72,10 +73,12 @@ #:use-module (gnu packages check) #:use-module (gnu packages cmake) #:use-module (gnu packages compression) + #:use-module (gnu packages coq) #:use-module (gnu packages curl) #:use-module (gnu packages cyrus-sasl) #:use-module (gnu packages documentation) #:use-module (gnu packages elf) + #:use-module (gnu packages emacs) #:use-module (gnu packages flex) #:use-module (gnu packages fltk) #:use-module (gnu packages fontutils) @@ -101,6 +104,7 @@ #:use-module (gnu packages mpi) #:use-module (gnu packages multiprecision) #:use-module (gnu packages netpbm) + #:use-module (gnu packages ocaml) #:use-module (gnu packages onc-rpc) #:use-module (gnu packages pcre) #:use-module (gnu packages popt) @@ -4182,6 +4186,67 @@ as equations, scalars, vectors, and matrices.") theories} (SMT) solver. It provides a C/C++ API, as well as Python bindings.") (license license:expat))) +(define-public why3 + (package + (name "why3") + (version "1.2.1") + (source (origin + (method url-fetch) + (uri (string-append "https://gforge.inria.fr/frs/download.php/file" + "/38185/why3-" version ".tar.gz")) + (sha256 + (base32 + "014gkwisjp05x3342zxkryb729p02ngx1hcjjsrplpa53jzgz647")))) + (build-system ocaml-build-system) + (native-inputs + `(("coq" ,coq) + ("ocaml" ,ocaml) + ("which" ,which))) + (propagated-inputs + `(("camlzip" ,camlzip) + ("ocaml-graph" ,ocaml-graph) + ("ocaml-menhir" ,ocaml-menhir) + ("ocaml-num" ,ocaml-num) + ("ocaml-zarith" ,ocaml-zarith))) + (inputs + `(("coq-flocq" ,coq-flocq) + ("emacs-minimal" ,emacs-minimal) + ("zlib" ,zlib))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-before 'configure 'fix-configure + (lambda _ + (setenv "CONFIG_SHELL" (which "sh")) + (substitute* "configure" + ;; find ocaml-num in the correct directory + (("\\$DIR/nums.cma") "$DIR/../nums.cma") + (("\\$DIR/num.cmi") "$DIR/../num.cmi")) + #t)) + (add-after 'configure 'fix-makefile + (lambda _ + (substitute* "Makefile" + ;; find ocaml-num in the correct directory + (("site-lib/num") "site-lib")) + #t)) + (add-after 'install 'install-lib + (lambda _ + (invoke "make" "byte") + (invoke "make" "install-lib") + #t))))) + (home-page "http://why3.lri.fr") + (synopsis "Deductive program verification") + (description "Why3 provides a language for specification and programming, +called WhyML, and relies on external theorem provers, both automated and +interactive, to discharge verification conditions. Why3 comes with a standard +library of logical theories (integer and real arithmetic, Boolean operations, +sets and maps, etc.) and basic programming data structures (arrays, queues, +hash tables, etc.). A user can write WhyML programs directly and get +correct-by-construction OCaml programs through an automated extraction +mechanism. WhyML is also used as an intermediate language for the verification +of C, Java, or Ada programs.") + (license license:lgpl2.1))) + (define-public elpa (package (name "elpa") -- 2.24.0