From 20e11809f7edba2cc2747efa8294bc8267aeab4d Mon Sep 17 00:00:00 2001 From: Jason Conroy Date: Sat, 10 Jan 2026 15:33:41 -0500 Subject: [PATCH] guix: ocaml-build-system: Support installer tool `opaline`. * guix/build/ocaml-build-system.scm (install): Invoke `opaline` when `opam-installer` is not in $PATH. Change-Id: I6271b3acb028b7eb868bc690d14ef76529d1f856 Signed-off-by: Julien Lepiller --- guix/build/ocaml-build-system.scm | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/guix/build/ocaml-build-system.scm b/guix/build/ocaml-build-system.scm index 99111ad300d..c165075f40e 100644 --- a/guix/build/ocaml-build-system.scm +++ b/guix/build/ocaml-build-system.scm @@ -89,13 +89,25 @@ #:allow-other-keys) "Install the given package." (let ((out (assoc-ref outputs "out"))) - (if (and (file-exists? "setup.ml") (not use-make?)) + (cond + ((and (file-exists? "setup.ml") (not use-make?)) (apply invoke "ocaml" "setup.ml" - (string-append "-" install-target) build-flags) - (if (file-exists? "Makefile") - (apply invoke "make" install-target make-flags) - (invoke "opam-installer" "-i" (string-append "--prefix=" out) - (string-append "--libdir=" out "/lib/ocaml/site-lib"))))) + (string-append "-" install-target) build-flags)) + ((file-exists? "Makefile") + (apply invoke "make" install-target make-flags)) + ;; Use either opam-installer or opaline, which both understand + ;; opam's `.install` file format. opam-installer is the standard + ;; platform tool, while opaline is a fallback for packages with + ;; circular dependencies involving opam. + ;; (https://codeberg.org/guix/guix/issues/3588) + ((which "opam-installer") + (invoke "opam-installer" "-i" (string-append "--prefix=" out) + (string-append "--libdir=" out "/lib/ocaml/site-lib"))) + ((which "opaline") + (invoke "opaline" "-prefix" out + "-libdir" (string-append out "/lib/ocaml/site-lib"))) + (else (error (string-append "Either 'opam-installer' or 'opaline' " + "must exist in $PATH at build time."))))) #t) (define* (prepare-install #:key outputs #:allow-other-keys)