diff mbox series

[bug#73466,v2,11/15] gnu: Add ocaml-cpu.

Message ID 3326e9730d479ebb3a9a26329ea28294eba5f55f.1727335349.git.herman@rimm.ee
State New
Headers show
Series [bug#73466,v2,01/15] gnu: Add ocaml-ppx-yojson-conv-lib. | expand

Commit Message

Herman Rimm Sept. 26, 2024, 7:23 a.m. UTC
* gnu/packages/ocaml.scm (ocaml-cpu): Add variable.

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

Patch

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index bf723e9055..396a546213 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -5142,6 +5142,47 @@  (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 git-fetch)
+        (uri (git-reference
+               (url "https://github.com/UnixJunkie/cpu")
+               (commit (string-append "v" version))))
+        (sha256
+          (base32
+            "1vir6gh1bhvxgj2fcn69c38yhw3jgk7dyikmw789m5ld2csnyjiv"))))
+    (build-system ocaml-build-system)
+    (arguments
+      (list #:tests? #f ; There is 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 "Pin current process to given core")
+    (description
+      "The module installed is called Cpu in order to not conflict with
+the Setcore module that is installed by parmap.  This library can also
+get the number of CPU cores online.")
+    (license license:bsd-3)))
+
 (define-public ocaml-seq
   (package
     (name "ocaml-seq")