Subject: [bug#73260] Add libguestfs

From: Ludovic Courtès <[email-masked]>
Date: Mon, 30 Sep 2024 19:07:04 +0200

Giacomo Leidi <[email-masked]> skribis:

> * gnu/packages/virtualization.scm (libguestfs-minimal): New variable.
> * gnu/packages/patches/libguestfs-syms.patch: Add file.
> * gnu/local.mk: Add it.
>
> Change-Id: Ide22707724ecd41145243c9f41adc3f5557c593e

[...]

> +++ b/gnu/packages/patches/libguestfs-syms.patch
> @@ -0,0 +1,26 @@
> +diff -urN a/lib/Makefile.am b/lib/Makefile.am

As suggested by ‘guix lint’ :-), please add a couple of lines at the top
explaining what the patch does and what its upstream status is.

[...]

> +               (modify-phases %standard-phases
> +                 (add-after 'unpack 'patch-makefiles
> +                   (lambda _
> +                     (for-each patch-shebang
> +                               (find-files "."))
> +                     (for-each (lambda (makefile)
> +                                 (substitute* "ocaml/Makefile.am"
> +                                   (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
> +                                    lib/ocaml)))
> +                               '("ocaml/Makefile.am"
> +                                 "ocaml/Makefile.in"))))
> +                 (replace 'bootstrap
> +                   (lambda _
> +                     (invoke "autoreconf" "-vif")))

You can arrange to only modify ‘Makefile.in’, in which case the
‘bootstrap’ phase is unnecessary and autotools can be removed from the
inputs.

> +                        ;; The ‘validate-runpath’ phase fails to find libguestfs.so.0.
> +                        (invoke (string-append #$(this-package-native-input "patchelf")
> +                                               "/bin/patchelf")
> +                                "--add-rpath" (string-append #$output "/lib") sofile))
> +                      '("perl/blib/arch/auto/Sys/Guestfs/Guestfs.so"
> +                        "ocaml/dllmlguestfs.so"))))

Same comment as on the previous patch.  :-)