[bug#78231] ocaml: binsec: Wrap program to set OCAMLPATH

Message ID 739a1da5e980801aa40d3e81d84d30ba633bae70.1746283105.git.soeren@soeren-tempel.net
State New
Headers
Series [bug#78231] ocaml: binsec: Wrap program to set OCAMLPATH |

Commit Message

Sören Tempel May 3, 2025, 2:38 p.m. UTC
  From: Sören Tempel <soeren@soeren-tempel.net>

Otherwise, dune plugins cannot be loaded which results in some command
line options to not work correctly. For example, binsec --help errors
with "The library "binsec.sse.checkct" can't be found in the search
paths". To fix this, this patch adds a wrap-programs phase.

Fixes https://issues.guix.gnu.org/69996

* gnu/packages/ocaml.scm (binsec) <arguments>: Add wrap-programs phase.
---
 gnu/packages/ocaml.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)


base-commit: 415e3d98d6faf5fd3d1b7b3daa2f20636e4ff822
  

Patch

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index a5632c6ad1..e86f59d2b3 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -1419,6 +1419,17 @@  (define-public binsec
        (sha256
         (base32 "1szfqb6rj19w2jdyaxdgy3plhgr7picijf7l4k5qq80kna2h0zm8"))))
     (build-system dune-build-system)
+    (arguments
+      (list #:phases
+            #~(modify-phases %standard-phases
+                (add-after 'install 'wrap-programs
+                  (lambda _
+                    (let ((ocamlpath
+                            `(,(string-append #$output "/lib/ocaml/site-lib")
+                               ,@(search-path-as-string->list (getenv "OCAMLPATH")))))
+                      (wrap-program (string-append #$output "/bin/" "binsec")
+                                    `("OCAMLPATH" ":" prefix ,ocamlpath))))))))
+    (inputs (list bash-minimal))
     (native-inputs (list gmp ocaml-qcheck ocaml-ounit2))
     (propagated-inputs (list dune-site
                              ocaml-base