Subject: [PATCH 10/14] gnu: Add ocaml-atd.

From: Garek Dyszel <[email-masked]>
Date: Wed, 05 Oct 2022 13:47:21 -0400

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 4bc159481e..bc876d60a1 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -4955,6 +4955,58 @@ (define-public ocaml-earley
 is also support for writing OCaml syntax extensions in a camlp4 style.")
     (license license:cecill-b)))
 
+(define-public ocaml-atd
+  (package
+    (name "ocaml-atd")
+    (version "2.10.0")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/ahrefs/atd")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "10fgahdigrl01py0k0q2d6a60yps38q96dxhjnzm9jz4g931716l"))))
+    (build-system dune-build-system)
+    (arguments
+     `(#:phases (modify-phases %standard-phases
+                  (replace 'check
+                    (lambda* (#:key tests? #:allow-other-keys)
+                      ;; The dune-build-system does not run "make test" but
+                      ;; "dune runtest test --release".
+                      ;; This project, rather, needs us to run "make test".
+                      ;;
+                      ;; For this package (ocaml-atd), we DO NOT run all the
+                      ;; tests. The atd repository has resources for several
+                      ;; different interfaces (python, scala, etc), but we
+                      ;; don't need to run those tests if we are just
+                      ;; interested in the ocaml interface.
+                      ;; So we stick with just the ocaml tests here.
+                      (when tests?
+                        (invoke "make" "test-ocaml")))))))
+    (propagated-inputs (list ocaml-menhir
+                             ocaml-easy-format
+                             ocaml-odoc
+                             ocaml-re
+                             ocaml-camlp-streams
+                             ocaml-biniou
+                             ocaml-yojson
+                             ocaml-cmdliner))
+    (native-inputs (list ocaml-alcotest
+                         python-pypa-build
+                         python-jsonschema-4.15
+                         python-flake8
+                         python-mypy
+                         python-pytest))
+    (inputs (list python))
+    (home-page "https://github.com/ahrefs/atd")
+    (synopsis "Parser for the ATD data format description language")
+    (description
+     "ATD is an OCaml library providing a parser for the Adjustable Type
+Definitions language.")
+    (license (license:non-copyleft "LICENSE.md"))))
+
 (define-public ocaml-timed
   (package
     (name "ocaml-timed")
-- 
2.37.3