gnu: ocaml: Update to 4.02.1.

* gnu/packages/ocaml.scm (ocaml)[version]: Update to 4.02.1.
  [source]: Use 'version-major+minor'.  Use .xz tarball.
  [home-page]: Update URI.
  [license]: gpl2 -> lgpl2.0.
  [inputs]: Add libx11, gcc:lib, and zlib.  Remove perl.
  [native-inputs]: New field, with perl and pkg-config.
  [arguments]: In #:modules, remove (srfi srfi-1), add (web server).  Use
  'modify-phases'.  Enable parallel build.  Add 'patch-/bin/sh-references' and
  'prepare-socket-test' phases.  Rename 'check-after-install' phase to
  'check'.  Use 'with-directory-excursion' in 'check' phase.  Remove unused
  keyword arguments from custom phases.
This commit is contained in:
Mark H Weaver 2015-06-02 22:49:10 -04:00
parent 4a79e256f0
commit 69b8f08cbd
1 changed files with 86 additions and 43 deletions

View File

@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU ;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com> ;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014 Mark H Weaver <mhw@netris.org> ;;; Copyright © 2014, 2015 Mark H Weaver <mhw@netris.org>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -18,11 +18,16 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages ocaml) (define-module (gnu packages ocaml)
#:use-module (guix licenses) #:use-module ((guix licenses) #:hide (zlib))
#:use-module (guix packages) #:use-module (guix packages)
#:use-module (guix download) #:use-module (guix download)
#:use-module (guix utils)
#:use-module (guix build-system gnu) #:use-module (guix build-system gnu)
#:use-module (gnu packages) #:use-module (gnu packages)
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages compression)
#:use-module (gnu packages commencement)
#:use-module (gnu packages xorg)
#:use-module (gnu packages perl) #:use-module (gnu packages perl)
#:use-module (gnu packages python) #:use-module (gnu packages python)
#:use-module (gnu packages ncurses) #:use-module (gnu packages ncurses)
@ -32,56 +37,94 @@
(define-public ocaml (define-public ocaml
(package (package
(name "ocaml") (name "ocaml")
(version "4.00.1") (version "4.02.1")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
(uri (string-append (uri (string-append
"http://caml.inria.fr/pub/distrib/ocaml-4.00/ocaml-" "http://caml.inria.fr/pub/distrib/ocaml-"
version ".tar.gz")) (version-major+minor version)
"/ocaml-" version ".tar.xz"))
(sha256 (sha256
(base32 (base32
"0yp86napnvbi2jgxr6bk1235bmjdclgzrzgq4mhwv87l7dymr3dl")))) "1p7lqvh64xpykh99014mz21q8fs3qyjym2qazhhbq8scwldv1i38"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(native-inputs
`(("perl" ,perl)
("pkg-config" ,pkg-config)))
(inputs
`(("libx11" ,libx11)
("gcc:lib" ,gcc-final "lib") ; for libiberty, needed for objdump support
("zlib" ,zlib))) ; also needed for objdump support
(arguments (arguments
`(#:modules ((guix build gnu-build-system) `(#:modules ((guix build gnu-build-system)
(guix build utils) (guix build utils)
(srfi srfi-1)) (web server))
#:phases (alist-replace #:phases
'configure (modify-phases %standard-phases
(add-after 'unpack 'patch-/bin/sh-references
(lambda* (#:key inputs #:allow-other-keys)
(let* ((sh (string-append (assoc-ref inputs "bash")
"/bin/sh"))
(quoted-sh (string-append "\"" sh "\"")))
(with-fluids ((%default-port-encoding #f))
(for-each (lambda (file)
(substitute* file
(("\"/bin/sh\"")
(begin
(format (current-error-port) "\
patch-/bin/sh-references: ~a: changing `\"/bin/sh\"' to `~a'~%"
file quoted-sh)
quoted-sh))))
(find-files "." "\\.ml$"))
#t))))
(replace 'configure
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
;; OCaml uses "-prefix <prefix>" rather than the usual (let* ((out (assoc-ref outputs "out"))
;; "--prefix=<prefix>". (mandir (string-append out "/share/man")))
(let ((out (assoc-ref outputs "out"))) ;; Custom configure script doesn't recognize
(zero? (system* "./configure" "-prefix" out ;; --prefix=<PREFIX> syntax (with equals sign).
"-mandir" (zero? (system* "./configure"
(string-append out "/share/man"))))) "--prefix" out
(alist-replace "--mandir" mandir)))))
'build (replace 'build
(lambda* (#:key outputs #:allow-other-keys) (lambda _
;; "make" does not do anything, we must use (zero? (system* "make" "-j" (number->string
;; "make world.opt". (parallel-job-count))
(zero? (system* "make" "world.opt"))) "world.opt"))))
(alist-replace (delete 'check)
'check-after-install (add-after 'install 'check
(lambda* (#:key outputs #:allow-other-keys) (lambda _
;; There does not seem to be a "check" or "test" target. (with-directory-excursion "testsuite"
(zero? (system "cd testsuite && make all"))) (zero? (system* "make" "all")))))
(let ((check (assq-ref %standard-phases 'check))) (add-before 'check 'prepare-socket-test
;; OCaml assumes that "make install" is run before (lambda _
;; launching the tests. (format (current-error-port)
(alist-cons-after "Spawning local test web server on port 8080~%")
'install 'check-after-install (when (zero? (primitive-fork))
check (run-server (lambda (request request-body)
(alist-delete 'check %standard-phases)))))))) (values '((content-type . (text/plain)))
(inputs `(("perl" ,perl))) "Hello!"))
(home-page "http://caml.inria.fr/") 'http '(#:port 8080)))
(let ((file "testsuite/tests/lib-threads/testsocket.ml"))
(format (current-error-port)
"Patching ~a to use localhost port 8080~%"
file)
(substitute* file
(("caml.inria.fr") "localhost")
(("80") "8080")
(("HTTP1.0") "HTTP/1.0"))
#t))))))
(home-page "https://ocaml.org/")
(synopsis "The OCaml programming language") (synopsis "The OCaml programming language")
(description (description
"OCaml is a general purpose industrial-strength programming language with "OCaml is a general purpose industrial-strength programming language with
an emphasis on expressiveness and safety. Developed for more than 20 years at an emphasis on expressiveness and safety. Developed for more than 20 years at
Inria it benefits from one of the most advanced type systems and supports Inria it benefits from one of the most advanced type systems and supports
functional, imperative and object-oriented styles of programming.") functional, imperative and object-oriented styles of programming.")
(license (list qpl gpl2)))) ;; The compiler is distributed under qpl1.0 with a change to choice of
;; law: the license is governed by the laws of France. The library is
;; distributed under lgpl2.0.
(license (list qpl lgpl2.0))))
(define-public opam (define-public opam
(package (package