ocaml: prepare for ocaml-4.05

Julien LepillerTue Oct 10 23:05:35+0200 2017

4a27d37

ocaml: prepare for ocaml-4.05

more/packages/ocaml.scm

3232
  #:use-module (gnu packages emacs)
3333
  #:use-module (gnu packages flex)
3434
  #:use-module (gnu packages llvm)
35+
  #:use-module (gnu packages m4)
3536
  #:use-module (gnu packages maths)
3637
  #:use-module (gnu packages multiprecision)
3738
  #:use-module (gnu packages ocaml)

8182
                         "/lib/ocaml/site-lib"))
8283
    #:phases (modify-phases %standard-phases (delete 'configure))))
8384
85+
(define-public ocaml-fix
86+
  (package
87+
    (inherit ocaml)
88+
    (version "4.05.0")
89+
    (source (origin
90+
              (method url-fetch)
91+
              (uri (string-append
92+
                    "http://caml.inria.fr/pub/distrib/ocaml-"
93+
                    (version-major+minor version)
94+
                    "/ocaml-" version ".tar.xz"))
95+
              (sha256
96+
               (base32
97+
                "1y9fw1ci9pwnbbrr9nwr8cq8vypcxwdf4akvxard3mxl2jx2g984"))))
98+
    (arguments
99+
     `(#:modules ((guix build gnu-build-system)
100+
                  (guix build utils)
101+
                  (web server))
102+
       #:phases
103+
       (modify-phases %standard-phases
104+
         (add-after 'unpack 'patch-/bin/sh-references
105+
           (lambda* (#:key inputs #:allow-other-keys)
106+
             (let* ((sh (string-append (assoc-ref inputs "bash")
107+
                                       "/bin/sh"))
108+
                    (quoted-sh (string-append "\"" sh "\"")))
109+
               (with-fluids ((%default-port-encoding #f))
110+
                 (for-each
111+
                  (lambda (file)
112+
                    (substitute* file
113+
                      (("\"/bin/sh\"")
114+
                       (begin
115+
                         (format (current-error-port) "\
116+
patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%"
117+
                                 file quoted-sh)
118+
                         quoted-sh))))
119+
                  (find-files "." "\\.ml$"))
120+
                 #t))))
121+
         (replace 'configure
122+
           (lambda* (#:key outputs #:allow-other-keys)
123+
             (let* ((out (assoc-ref outputs "out"))
124+
                    (mandir (string-append out "/share/man")))
125+
               ;; Custom configure script doesn't recognize
126+
               ;; --prefix=<PREFIX> syntax (with equals sign).
127+
               (zero? (system* "./configure"
128+
                               "--prefix" out
129+
                               "--mandir" mandir)))))
130+
         (replace 'build
131+
           (lambda _
132+
             (zero? (system* "make" "-j1" ;; fails to build otherwise
133+
                             "world.opt"))))
134+
         (delete 'check)
135+
         (add-after 'install 'check
136+
           (lambda _
137+
             (with-directory-excursion "testsuite"
138+
               (zero? (system* "make" "all"))))))))))
139+
84140
(define-public ocaml-zed
85141
  (package
86142
    (name "ocaml-zed")

260316
provers.")
261317
    (license license:gpl2+)))
262318
319+
(define-public ocaml-findlib-fix
320+
  (package
321+
    (inherit ocaml-findlib)
322+
    (native-inputs
323+
     `(("camlp4" ,camlp4)
324+
       ("ocaml" ,ocaml-fix)
325+
       ("m4" ,m4)))))
326+
327+
(define-public ocaml-build
328+
  (package
329+
    (name "ocaml-build")
330+
    (version "0.11.0")
331+
    (source (origin
332+
              (method url-fetch)
333+
              (uri (string-append "https://github.com/ocaml/ocamlbuild/archive/"
334+
                                  version ".tar.gz"))
335+
              (file-name (string-append name "-" version ".tar.gz"))
336+
              (sha256
337+
               (base32
338+
                "1vh30731gv1brr4ljfzd6m5lni44ifyb1w8hwir81ff9874fs5qp"))))
339+
    (build-system gnu-build-system)
340+
    (arguments
341+
     `(#:test-target "test"
342+
       #:tests? #f; FIXME: tests fail to find Findlib
343+
       #:make-flags
344+
       (list (string-append "OCAMLBUILD_PREFIX=" (assoc-ref %outputs "out"))
345+
             (string-append "OCAMLBUILD_BINDIR=" (assoc-ref %outputs "out") "/bin")
346+
             (string-append "OCAMLBUILD_LIBDIR=" (assoc-ref %outputs "out") "/lib")
347+
             (string-append "OCAMLBUILD_MANDIR=" (assoc-ref %outputs "out") "/share/man"))
348+
       #:phases
349+
       (modify-phases %standard-phases
350+
         (delete 'configure)
351+
         ;(replace 'configure
352+
         ;  (lambda* (#:key outputs #:allow-other-keys)
353+
         ;    (let ((out (assoc-ref %outputs "out")))
354+
         ;      (zero? (system* "make" "-f" "configure.make" "all")))))
355+
         (add-before 'build 'findlib-environment
356+
           (lambda* (#:key outputs #:allow-other-keys)
357+
             (let* ((out (assoc-ref outputs "out")))
358+
               (setenv "OCAMLFIND_DESTDIR" (string-append out "/lib/ocaml/site-lib"))
359+
               (setenv "OCAMLFIND_LDCONF" "ignore")
360+
               #t))))))
361+
    (native-inputs
362+
     `(("ocaml" ,ocaml-fix)
363+
       ("findlib" ,ocaml-findlib-fix)))
364+
    (home-page "")
365+
    (synopsis "")
366+
    (description "")
367+
    (license license:lgpl2.1+)))
368+
263369
(define-public ocaml-menhir-fix
264370
  (package
265371
    (inherit ocaml-menhir)

272378
                    "menhir-" version ".tar.gz"))
273379
              (sha256
274380
               (base32
275-
                "0qffci9qxgfabzyalx851q994yykl4n9ylr4vbplsm6is1padjh0"))))))
381+
                "0qffci9qxgfabzyalx851q994yykl4n9ylr4vbplsm6is1padjh0"))))
382+
    (inputs
383+
     `(("ocaml" ,ocaml-fix)
384+
       ("ocamlbuild" ,ocaml-build)))))
276385
277386
(define-public compcert
278387
  (package

295404
                             (assoc-ref outputs "out"))))))
296405
       #:tests? #f))
297406
    (native-inputs
298-
     `(("ocaml" ,ocaml)
407+
     `(("ocaml" ,ocaml-fix)
299408
       ("coq" ,coq-fix)))
300409
    (inputs
301410
     `(("menhir" ,ocaml-menhir-fix)))