summary refs log tree commit diff
path: root/gnu/packages/ocaml.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/ocaml.scm')
-rw-r--r--gnu/packages/ocaml.scm135
1 files changed, 135 insertions, 0 deletions
diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 2df16e7cd2..8a91a79c36 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -18,6 +18,7 @@
 ;;; Copyright © 2020 Simon Tournier <zimon.toutoune@gmail.com>
 ;;; Copyright © 2020 divoplade <d@divoplade.fr>
 ;;; Copyright © 2020 pukkamustard <pukkamustard@posteo.net>
+;;; Copyright © 2021 aecepoglu <aecepoglu@fastmail.fm>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -390,6 +391,69 @@ repository-wide uninstallability checks.")
     ;; with static-linking exception
     (license license:lgpl2.1+)))
 
+(define-public ocaml-down
+  (package
+    (name "ocaml-down")
+    (version "0.0.3")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://erratique.ch/software/down/releases/down-"
+                            version ".tbz"))
+        (sha256
+         (base32
+          "1nz2f5j17frgr2vrslcz9klmi6w9sm2vqwwwpi33ngcm3rgmsrlg"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(#:tests? #f ;no tests
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure))
+       #:build-flags
+       (list "build" "--lib-dir"
+             (string-append (assoc-ref %outputs "out") "/lib/ocaml/site-lib"))))
+    (native-inputs
+     `(("ocaml-findlib" ,ocaml-findlib)
+       ("ocamlbuild" ,ocamlbuild)
+       ("ocaml-topkg" ,ocaml-topkg)
+       ("opam" ,opam)))
+    (home-page "https://erratique.ch/software/down")
+    (synopsis "OCaml toplevel (REPL) upgrade")
+    (description "Down is an unintrusive user experience upgrade for the
+@command{ocaml} toplevel (REPL).
+
+Simply load the zero dependency @code{down} library in the @command{ocaml}
+toplevel and you get line edition, history, session support and identifier
+completion and documentation with @command{ocp-index}.
+
+Add this to your @file{~/.ocamlinit}:
+
+@example
+#use \"down.top\"
+@end example
+
+You may also need to add this to your @file{~/.ocamlinit} and declare
+the environment variable @code{OCAML_TOPLEVEL_PATH}:
+
+@example
+let () =
+  try Topdirs.dir_directory (Sys.getenv \"OCAML_TOPLEVEL_PATH\")
+  with Not_found -> ()
+@end example
+
+OR
+
+@example
+let () = String.split_on_char ':' (Sys.getenv \"OCAMLPATH\")
+         |> List.filter (fun x -> Filename.check_suffix x \"/site-lib\")
+         |> List.map (fun x -> x ^ \"/toplevel\")
+         (* remove the line below if you don't want to see the text
+            every time you start the toplevel *)
+         |> List.map (fun x -> Printf.printf \"adding directory %s\\n\" x; x)
+         |> List.iter Topdirs.dir_directory;;
+@end example")
+    (license license:isc)))
+
 (define-public ocaml-opam-file-format
   (package
     (name "ocaml-opam-file-format")
@@ -2362,6 +2426,77 @@ string values and to directly encode characters in OCaml Buffer.t values.")
 the JSON data format.  It can process JSON text without blocking on IO and
 without a complete in-memory representation of the data.")
     (license license:isc)))
+ 
+(define-public ocaml-ocp-indent
+  (package
+    (name "ocaml-ocp-indent")
+    (version "1.8.2")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/OCamlPro/ocp-indent")
+               (commit version)))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "1dvcl108ir9nqkk4mjm9xhhj4p9dx9bmg8bnms54fizs1x3x8ar3"))))
+    (build-system dune-build-system)
+    (arguments
+     `(#:test-target "tests"
+       #:build-flags (list "--profile=release")))
+    (propagated-inputs
+     `(("ocaml-cmdliner" ,ocaml-cmdliner)))
+    (home-page "https://www.typerex.org/ocp-indent.html")
+    (synopsis "Tool to indent OCaml programs")
+    (description
+      "Ocp-indent is based on an approximate, tolerant OCaml parser
+and a simple stack machine.  Presets and configuration options are available,
+with the possibility to set them project-wide.  It supports the most common
+syntax extensions, and it is extensible for others.
+
+This package includes:
+
+@itemize
+@item An indentor program, callable from the command-line or from within editors,
+@item Bindings for popular editors,
+@item A library that can be directly used by editor writers, or just for
+      fault-tolerant and approximate parsing.
+@end itemize")
+    (license license:lgpl2.1)))
+ 
+(define-public ocaml-ocp-index
+  (package
+    (name "ocaml-ocp-index")
+    (version "1.2.1")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/OCamlPro/ocp-index")
+               (commit version)))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "08r7mxdnxmhff37fw4hmrpjgckgi5kaiiiirwp4rmdl594z0h9c8"))))
+    (build-system dune-build-system)
+    (arguments
+     `(#:package "ocp-index"))
+    (propagated-inputs
+     `(("ocaml-ocp-indent" ,ocaml-ocp-indent)
+       ("ocaml-re" ,ocaml-re)
+       ("ocaml-cmdliner" ,ocaml-cmdliner)))
+    (native-inputs
+     `(("ocaml-cppo" ,ocaml-cppo)))
+    (home-page "https://www.typerex.org/ocp-index.html")
+    (synopsis "Lightweight completion and documentation browsing for OCaml libraries")
+    (description "This package includes only the @code{ocp-index} library
+and command-line tool.")
+    ;; All files in libs/ are GNU lgpl2.1
+    ;; For static linking, clause 6 of LGPL is lifted
+    ;; All other files under GNU gpl3
+    (license (list license:gpl3+
+                   license:lgpl2.1+))))
 
 (define-public ocaml-ocurl
   (package