Subject: [bug#73466] [PATCH 11/16] gnu: Add ocaml-cpu.

From: Herman Rimm <[email-masked]>
Date: Wed, 25 Sep 2024 10:03:07 +0200

* gnu/packages/ocaml.scm (ocaml-cpu): Add variable.

Change-Id: Id7e0251a97b03fcd186637f1d6c6be17b11d96f8
---
 gnu/packages/ocaml.scm | 45 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 329b28ef84..1989a48798 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -5266,6 +5266,51 @@ (define-public ocaml-cppo
 @end enumerate")
     (license license:bsd-3)))
 
+(define-public ocaml-cpu
+  (package
+    (name "ocaml-cpu")
+    (version "2.0.0")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (string-append "https://github.com/UnixJunkie/cpu/archive/"
+                            "v" version ".tar.gz"))
+        (sha256
+          (base32
+            "1aga2cal07nfqgsfgn41gbdb7dyhj5l4967dq6vzpznrbyp2y09q"))))
+    (build-system ocaml-build-system)
+    (arguments
+      (list #:tests? #f ; no test target
+            #:phases
+            #~(modify-phases %standard-phases
+                (add-before 'configure 'create-header
+                  (lambda _
+                    (invoke "autoheader")
+                    ))
+                (add-before 'configure 'fix-/bin/sh
+                  (lambda _
+                    (substitute* "configure"
+                      (("-/bin/sh") (string-append "-" (which "sh"))))))
+                (replace 'install
+                  (lambda* (#:key outputs #:allow-other-keys)
+                    (let* ((out (assoc-ref outputs "out"))
+                           (libdir
+                             (string-append out "/lib/ocaml/site-lib")))
+                      (invoke "dune" "install" "--prefix" out "--libdir"
+                              libdir)))))))
+    (native-inputs (list autoconf dune ocaml))
+    (home-page "https://github.com/UnixJunkie/cpu")
+    (synopsis "Equivalent of the C preprocessor for OCaml programs")
+    (description "Cppo is an equivalent of the C preprocessor for OCaml
+programs.  It allows the definition of simple macros and file inclusion.  Cppo is:
+@enumerate
+@item more OCaml-friendly than @command{cpp}
+@item easy to learn without consulting a manual
+@item reasonably fast
+@item simple to install and to maintain.
+@end enumerate")
+    (license license:bsd-3)))
+
 (define-public ocaml-seq
   (package
     (name "ocaml-seq")
-- 
2.45.2