* [bug#73260] [PATCH 2/3] gnu: Add libguestfs-minimal.
2024-09-14 21:20 ` [bug#73260] [PATCH 1/3] gnu: Add hivex Giacomo Leidi via Guix-patches via
@ 2024-09-14 21:20 ` Giacomo Leidi via Guix-patches via
2024-09-14 21:20 ` [bug#73260] [PATCH 3/3] gnu: Add libguestfs Giacomo Leidi via Guix-patches via
1 sibling, 0 replies; 5+ messages in thread
From: Giacomo Leidi via Guix-patches via @ 2024-09-14 21:20 UTC (permalink / raw)
To: 73260; +Cc: Giacomo Leidi
* gnu/packages/virtualization.scm (libguestfs-minimal): New variable.
* gnu/packages/patches/libguestfs-syms.patch: Add file.
* gnu/local.mk: Add it.
Change-Id: Ide22707724ecd41145243c9f41adc3f5557c593e
---
gnu/local.mk | 1 +
gnu/packages/patches/libguestfs-syms.patch | 26 +++++
gnu/packages/virtualization.scm | 128 +++++++++++++++++++++
3 files changed, 155 insertions(+)
create mode 100644 gnu/packages/patches/libguestfs-syms.patch
diff --git a/gnu/local.mk b/gnu/local.mk
index fcdf174099..74d77ea4a7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1597,6 +1597,7 @@ dist_patch_DATA = \
%D%/packages/patches/libgeotiff-fix-tests-with-proj-9.3.0.patch \
%D%/packages/patches/libgeotiff-fix-tests-with-proj-9.3.1.patch \
%D%/packages/patches/libgeotiff-fix-tests-on-i386.patch \
+ %D%/packages/patches/libguestfs-syms.patch \
%D%/packages/patches/libobjc2-unbundle-robin-map.patch \
%D%/packages/patches/libvirt-add-install-prefix.patch \
%D%/packages/patches/libziparchive-add-includes.patch \
diff --git a/gnu/packages/patches/libguestfs-syms.patch b/gnu/packages/patches/libguestfs-syms.patch
new file mode 100644
index 0000000000..a4308eef5f
--- /dev/null
+++ b/gnu/packages/patches/libguestfs-syms.patch
@@ -0,0 +1,26 @@
+diff -urN a/lib/Makefile.am b/lib/Makefile.am
+--- a/lib/Makefile.am 2023-07-20 17:35:16.489080853 +0200
++++ b/lib/Makefile.am 2023-07-20 17:35:47.305793499 +0200
+@@ -160,8 +160,7 @@
+ # Force libtool to name the library 'libguestfs.so.0.$(MAX_PROC_NR).0'.
+ # Include the version script to limit which symbols are exported.
+ libguestfs_la_LDFLAGS = \
+- -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR) \
+- $(VERSION_SCRIPT_FLAGS)$(srcdir)/libguestfs.syms
++ -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
+
+ if HAVE_FUSE
+ # XXX Unfortunately FUSE_CFLAGS defines _FILE_OFFSET_BITS=64.
+diff -urN a/lib/Makefile.in b/lib/Makefile.in
+--- a/lib/Makefile.in 2023-07-20 17:35:16.489080853 +0200
++++ b/lib/Makefile.in 2023-07-20 17:36:05.474213641 +0200
+@@ -1109,8 +1109,7 @@
+ # Force libtool to name the library 'libguestfs.so.0.$(MAX_PROC_NR).0'.
+ # Include the version script to limit which symbols are exported.
+ libguestfs_la_LDFLAGS = \
+- -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR) \
+- $(VERSION_SCRIPT_FLAGS)$(srcdir)/libguestfs.syms
++ -version-info $(MAX_PROC_NR):0:$(MAX_PROC_NR)
+
+ @HAVE_LIBVIRT_TRUE@libvirt_is_version_SOURCES = libvirt-is-version.c
+ @HAVE_LIBVIRT_TRUE@libvirt_is_version_LDADD = \
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 60f17ea630..8abc64527b 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -59,6 +59,7 @@ (define-module (gnu packages virtualization)
#:use-module (gnu packages admin)
#:use-module (gnu packages assembly)
#:use-module (gnu packages attr)
+ #:use-module (gnu packages augeas)
#:use-module (gnu packages autotools)
#:use-module (gnu packages backup)
#:use-module (gnu packages base)
@@ -66,11 +67,13 @@ (define-module (gnu packages virtualization)
#:use-module (gnu packages bison)
#:use-module (gnu packages bootloaders)
#:use-module (gnu packages build-tools)
+ #:use-module (gnu packages cdrom)
#:use-module (gnu packages check)
#:use-module (gnu packages cluster)
#:use-module (gnu packages cmake)
#:use-module (gnu packages compression)
#:use-module (gnu packages containers)
+ #:use-module (gnu packages cpio)
#:use-module (gnu packages cross-base)
#:use-module (gnu packages crypto)
#:use-module (gnu packages cryptsetup)
@@ -83,6 +86,7 @@ (define-module (gnu packages virtualization)
#:use-module (gnu packages documentation)
#:use-module (gnu packages elf)
#:use-module (gnu packages figlet)
+ #:use-module (gnu packages file)
#:use-module (gnu packages firmware)
#:use-module (gnu packages flex)
#:use-module (gnu packages fonts)
@@ -95,6 +99,7 @@ (define-module (gnu packages virtualization)
#:use-module (gnu packages gnome)
#:use-module (gnu packages gnupg)
#:use-module (gnu packages golang)
+ #:use-module (gnu packages gperf)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages gtk)
#:use-module (gnu packages haskell)
@@ -3020,3 +3025,126 @@ (define-public hivex
file available through a C API, or through a separate program to export the
hive as XML.")
(license license:lgpl2.1)))
+
+(define-public libguestfs-minimal
+ (package
+ (name "libguestfs-minimal")
+ (version "1.53.6")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://libguestfs.org/download/"
+ (version-major+minor version)
+ "-stable/libguestfs-" version ".tar.gz"))
+ (sha256
+ (base32
+ "0vssarc3n4kv26fyjmkrrcvh55v41fhycba43pij3rc2izl72s2y"))
+ (patches
+ (search-patches "libguestfs-syms.patch"))))
+ (build-system gnu-build-system)
+ (arguments
+ (list #:configure-flags
+ #~(list "--disable-appliance"
+ "--disable-daemon"
+ "--disable-static"
+ "--with-distro=\"Guix System\"")
+ #:make-flags #~'("REALLY_INSTALL=yes")
+ #:phases
+ #~(let* ((lib/ocaml (string-append #$output "/lib/ocaml")))
+ (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")))
+ (replace 'check
+ (lambda* (#:key tests? make-flags #:allow-other-keys)
+ (when tests?
+ (apply invoke `("make" ,@make-flags "check-direct")))))
+ (add-before 'install 'set-rpath
+ (lambda _
+ (for-each
+ (lambda (sofile)
+ (invoke "ls" "-la" "ocaml/")
+ ;; 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"))))
+ (replace 'install
+ (lambda* (#:key make-flags #:allow-other-keys)
+ (mkdir-p "temp-build-dir")
+ (apply invoke `("make" ,@make-flags "INSTALLDIRS=vendor"
+ "install"))))
+ (add-after 'install 'wrap-binaries
+ (lambda _
+ (let ((bin (string-append #$output "/bin")))
+ (for-each
+ (lambda (binary)
+ (use-modules (srfi srfi-1))
+ (wrap-program binary
+ `("PERL5LIB" ":" prefix
+ (,(string-append #$output
+ "/lib/perl5/site_perl")))
+ `("PATH" ":" prefix
+ ,(search-path-as-list
+ '("bin")
+ (map second
+ '#$(package-inputs this-package))))))
+ (find-files bin)))))
+ (replace 'validate-documentation-location
+ (lambda _
+ (let ((man-dir
+ (string-append #$output "/man"))
+ (info-dir
+ (string-append #$output "/info")))
+ (for-each (lambda (d)
+ (invoke "rm" "-rf" d))
+ (list man-dir info-dir)))))))))
+ (native-inputs (list autoconf
+ automake
+ augeas
+ bison
+ cpio
+ flex
+ gettext-minimal
+ gperf
+ libtool
+ ocaml
+ ocaml-findlib
+ ncurses
+ patchelf
+ perl
+ perl-getopt-long
+ perl-module-build
+ pkg-config
+ po4a
+ xorriso
+ xz
+ zstd))
+ (inputs
+ (list file
+ fuse
+ jansson
+ hivex
+ libtirpc
+ pcre2
+ readline
+ qemu))
+ (home-page "https://libguestfs.org/")
+ (synopsis "Access and modify virtual machine disk images")
+ (description
+ "@code{libguestfs} is a set of tools for accessing and modifying virtual
+machine (VM) disk images. You can use this for viewing and editing files inside
+guests, scripting changes to VMs, monitoring disk used/free statistics, creating
+guests, P2V, V2V, performing backups, cloning VMs, building VMs, formatting
+disks, resizing disks, and much more.")
+ (license (list license:gpl2+ license:lgpl2.1+))))
--
2.46.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [bug#73260] [PATCH 3/3] gnu: Add libguestfs.
2024-09-14 21:20 ` [bug#73260] [PATCH 1/3] gnu: Add hivex Giacomo Leidi via Guix-patches via
2024-09-14 21:20 ` [bug#73260] [PATCH 2/3] gnu: Add libguestfs-minimal Giacomo Leidi via Guix-patches via
@ 2024-09-14 21:20 ` Giacomo Leidi via Guix-patches via
1 sibling, 0 replies; 5+ messages in thread
From: Giacomo Leidi via Guix-patches via @ 2024-09-14 21:20 UTC (permalink / raw)
To: 73260; +Cc: Giacomo Leidi
* gnu/packages/virtualization.scm (libguestfs): New variable.
Change-Id: I99243550a7a6c9d787fa1a67e54acefd3deeaf1f
---
gnu/packages/virtualization.scm | 39 +++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index 8abc64527b..ce541ec8a0 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -59,6 +59,7 @@ (define-module (gnu packages virtualization)
#:use-module (gnu packages admin)
#:use-module (gnu packages assembly)
#:use-module (gnu packages attr)
+ #:use-module (gnu packages apparmor)
#:use-module (gnu packages augeas)
#:use-module (gnu packages autotools)
#:use-module (gnu packages backup)
@@ -79,6 +80,7 @@ (define-module (gnu packages virtualization)
#:use-module (gnu packages cryptsetup)
#:use-module (gnu packages curl)
#:use-module (gnu packages cyrus-sasl)
+ #:use-module (gnu packages dbm)
#:use-module (gnu packages debian)
#:use-module (gnu packages disk)
#:use-module (gnu packages dns)
@@ -102,6 +104,7 @@ (define-module (gnu packages virtualization)
#:use-module (gnu packages gperf)
#:use-module (gnu packages graphviz)
#:use-module (gnu packages gtk)
+ #:use-module (gnu packages java)
#:use-module (gnu packages haskell)
#:use-module (gnu packages haskell-apps)
#:use-module (gnu packages haskell-check)
@@ -112,6 +115,7 @@ (define-module (gnu packages virtualization)
#:use-module (gnu packages libbsd)
#:use-module (gnu packages libusb)
#:use-module (gnu packages linux)
+ #:use-module (gnu packages lua)
#:use-module (gnu packages m4)
#:use-module (gnu packages man)
#:use-module (gnu packages multiprecision)
@@ -3148,3 +3152,38 @@ (define-public libguestfs-minimal
guests, P2V, V2V, performing backups, cloning VMs, building VMs, formatting
disks, resizing disks, and much more.")
(license (list license:gpl2+ license:lgpl2.1+))))
+
+(define-public libguestfs
+ (package
+ (inherit libguestfs-minimal)
+ (name "libguestfs")
+ (arguments
+ (substitute-keyword-arguments (package-arguments libguestfs-minimal)
+ ((#:configure-flags flags)
+ #~(cons (string-append "--with-python-installdir="
+ #$output "/lib/python"
+ #$(version-major+minor
+ (package-version python))
+ "/site-packages")
+ #$flags))))
+ (native-inputs
+ (modify-inputs (package-native-inputs libguestfs-minimal)
+ (prepend cdrtools
+ gobject-introspection
+ lua
+ `(,openjdk "jdk")
+ python
+ util-linux)))
+ (inputs
+ (modify-inputs (package-inputs libguestfs-minimal)
+ (prepend acl
+ bdb
+ gmp
+ libapparmor
+ libcap
+ libcap-ng
+ libconfig
+ libvirt
+ libxcrypt
+ numactl
+ yajl)))))
--
2.46.0
^ permalink raw reply related [flat|nested] 5+ messages in thread