Improve compcert and add ppsimpl

Julien LepillerThu Sep 06 17:26:25+0200 2018

8cb6d30

Improve compcert and add ppsimpl

more/packages/ocaml.scm

4444
  #:use-module (gnu packages python)
4545
  #:use-module (gnu packages tex)
4646
  #:use-module (gnu packages texinfo)
47-
  #:use-module (more packages smt))
47+
  #:use-module (more packages smt)
48+
  #:use-module (ice-9 match))
4849
4950
(define (ocaml-forge-uri name version file-number)
5051
  (string-append "https://forge.ocamlcore.org/frs/download.php/"

389390
    (description "")
390391
    (license license:lgpl2.1+))); with linking exception
391392
393+
(define-public coq-8.7
394+
  (package
395+
    (inherit coq)
396+
    (name "coq")
397+
    (version "8.7.2")
398+
    (source (origin
399+
              (method url-fetch)
400+
              (uri (string-append "https://github.com/coq/coq/archive/V"
401+
                                  version ".tar.gz"))
402+
              (file-name (string-append name "-" version ".tar.gz"))
403+
              (sha256
404+
               (base32
405+
                "1lkqvs7ayzv5kkg26y837pg0d6r2b5hbjxl71ba93f39kybw69gg"))))
406+
    (native-inputs
407+
     `(("ocamlbuild" ,ocaml-build)
408+
       ("hevea" ,hevea)
409+
       ("texlive" ,texlive)))
410+
    (inputs
411+
     `(("lablgtk" ,lablgtk-fix)
412+
       ("python" ,python-2)
413+
       ("camlp5" ,camlp5-fix)
414+
       ;; ocaml-num was removed from the ocaml package in 4.06.
415+
       ("ocaml-num" ,ocaml-num)))
416+
    (arguments
417+
     `(#:ocaml ,ocaml-fix
418+
       #:findlib ,ocaml-findlib-fix
419+
       #:phases
420+
       (modify-phases %standard-phases
421+
         (replace 'configure
422+
           (lambda* (#:key outputs #:allow-other-keys)
423+
             (let* ((out (assoc-ref outputs "out"))
424+
                    (mandir (string-append out "/share/man"))
425+
                    (browser "icecat -remote \"OpenURL(%s,new-tab)\""))
426+
               (invoke "./configure"
427+
                       "-prefix" out
428+
                       "-mandir" mandir
429+
                       "-browser" browser
430+
                       "-coqide" "opt"))
431+
             #t))
432+
         (replace 'build
433+
           (lambda* (#:key inputs #:allow-other-keys)
434+
             (substitute* "ide/ideutils.ml"
435+
               (("Bytes.unsafe_to_string read_string") "read_string"))
436+
             (invoke "make" "-j" (number->string
437+
                                  (parallel-job-count))
438+
                     (string-append
439+
                       "USERFLAGS=-I "
440+
                       (assoc-ref inputs "ocaml-num")
441+
                       "/lib/ocaml/site-lib")
442+
                     "world")
443+
             #t))
444+
         (delete 'check)
445+
         (add-after 'install 'check
446+
           (lambda _
447+
             (with-directory-excursion "test-suite"
448+
               ;; These two tests fail.
449+
               ;; This one fails because the output is not formatted as expected.
450+
               (delete-file-recursively "coq-makefile/timing")
451+
               ;; This one fails because we didn't build coqtop.byte.
452+
               (delete-file-recursively "coq-makefile/findlib-package")
453+
               (invoke "make"))
454+
             #t)))))))
455+
392456
(define-public coq-fix
393457
  (package
394458
    (inherit coq)

442506
               (invoke "make"))
443507
             #t)))))))
444508
509+
(define-public coq-bignums-8.7
510+
  (package
511+
    (inherit coq-bignums)
512+
    (name "coq-bignums")
513+
    (version "8.7.0")
514+
    (source (origin
515+
              (method url-fetch)
516+
              (uri (string-append "https://github.com/coq/bignums/archive/V"
517+
                                  version ".tar.gz"))
518+
              (file-name (string-append name "-" version ".tar.gz"))
519+
              (sha256
520+
               (base32
521+
                "03iw9jiwq9jx45gsvp315y3lxr8m9ksppmcjvxs5c23qnky6zqjx"))))
522+
    (native-inputs
523+
     `(("ocaml-fix" ,ocaml-fix)
524+
       ("coq-8.7" ,coq-8.7)))
525+
    (inputs
526+
     `(("camlp5-fix" ,camlp5-fix)))))
527+
528+
(define-public ppsimpl
529+
  (package
530+
    (name "ppsimpl")
531+
    (version "8.7")
532+
    (source (origin
533+
              (method git-fetch)
534+
              (uri (git-reference
535+
                     (url "https://scm.gforge.inria.fr/anonscm/git/ppsimpl/ppsimpl.git")
536+
                     (commit "86255a47568df58767d1d8e0b9e2da31cf73a5fc")))
537+
              (file-name (string-append name "-" version))
538+
              (sha256
539+
               (base32
540+
                "0h509w43j2wd2pyx04k3xfd0bsbmqscwqvhf8whzc3cxzl4j6vvq"))))
541+
              ;(uri "https://gforge.inria.fr/frs/download.php/file/37615/ppsimpl-09-07-2018.tar.gz")
542+
              ;(sha256
543+
              ; (base32
544+
              ;  "010zgskc1wd5v6wmmyxaapvwxjlgbdqqiks2dvf6llx03b07ak59"))))
545+
    (build-system gnu-build-system)
546+
    (arguments
547+
     `(#:test-target "test"
548+
       #:configure-flags
549+
       (list "-R" (string-append (assoc-ref %build-inputs "compcert") "/lib/coq/user-contrib/compcert") "compcert")
550+
       #:make-flags (list "COQC=coqc -R src PP -I src"
551+
                          (string-append
552+
                            "COQLIBINSTALL="
553+
                            (assoc-ref %outputs "out")
554+
                            "/lib/coq/user-contrib"))))
555+
    (inputs
556+
     `(("coq-bignums-8.7" ,coq-bignums-8.7)
557+
       ("compcert" ,compcert)))
558+
    (native-inputs
559+
     `(("coq-8.7" ,coq-8.7)
560+
       ("ocaml-fix" ,ocaml-fix)
561+
       ("ocaml-findlib-fix" ,ocaml-findlib-fix)
562+
       ("camlp4-fix" ,camlp4-fix)
563+
       ("camlp5-fix" ,camlp5-fix)
564+
       ("which" ,which)))
565+
    (home-page "")
566+
    (synopsis "")
567+
    (description "")
568+
    ;; No declared license -> all rights reserved
569+
    (license #f)))
570+
445571
(define-public compcert
446572
  (package
447573
    (name "compcert")
448-
    (version "3.2")
574+
    (version "3.3")
449575
    (source (origin
450576
              (method url-fetch)
451577
              (uri (string-append "http://compcert.inria.fr/release/compcert-"
452578
                                  version ".tgz"))
453579
              (sha256
454580
               (base32
455-
                "11q4121s0rxva63njjwya7syfx9w0p4hzr6avh8s57vfbrcakc93"))))
581+
                "16xrqcwak1v1fk5ndx6jf1yvxv3adsr7p7z34gfm2mpggxnq0xwn"))))
456582
    (build-system gnu-build-system)
457583
    (arguments
458584
     `(#:phases
459585
       (modify-phases %standard-phases
460586
         (replace 'configure
461587
           (lambda* (#:key outputs #:allow-other-keys)
462-
             (invoke "./configure" "x86_64-linux" "-prefix"
463-
                     (assoc-ref outputs "out")))))
588+
             (let ((system ,(match (or (%current-target-system) (%current-system))
589+
                              ("x86_64-linux" "x86_64-linux")
590+
                              ("i686-linux" "x86_32-linux")
591+
                              ("armhf-linux" "arm-linux"))))
592+
               (format #t "Building for ~a~%" system)
593+
               (invoke "./configure" system "-prefix"
594+
                       (assoc-ref outputs "out")))
595+
             #t))
596+
         (add-after 'install 'install-lib
597+
           (lambda* (#:key outputs #:allow-other-keys)
598+
             (for-each
599+
               (lambda (file)
600+
                 (install-file
601+
                   file
602+
                   (string-append
603+
                     (assoc-ref outputs "out")
604+
                     "/lib/coq/user-contrib/compcert/" (dirname file))))
605+
               (find-files "." ".*.vo$"))
606+
             #t)))
464607
       #:tests? #f))
465608
    (native-inputs
466609
     `(("ocaml" ,ocaml-fix)
467-
       ("coq" ,coq-fix)))
610+
       ("coq" ,coq-8.7)))
468611
    (inputs
469612
     `(("menhir" ,ocaml-menhir-fix)))
470613
    (home-page "http://compcert.inria.fr")