unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Giacomo Leidi via Guix-patches via <guix-patches@gnu.org>
To: 73260@debbugs.gnu.org
Cc: Giacomo Leidi <goodoldpaul@autistici.org>
Subject: [bug#73260] [PATCH 1/3] gnu: Add hivex.
Date: Sat, 14 Sep 2024 23:20:56 +0200	[thread overview]
Message-ID: <247263a340d7dedbf4671ebaf75da540e7e62734.1726348858.git.goodoldpaul@autistici.org> (raw)
In-Reply-To: <0e7f7cc7-b6b8-0c97-f175-edd6d85a2eb1@autistici.org>

* gnu/packages/virtualization.scm (hivex): New variable.

Change-Id: I9828d267d5c6f24dc5039ea3b1849248cd9d23fb
---
 gnu/packages/virtualization.scm | 118 ++++++++++++++++++++++++++++++++
 1 file changed, 118 insertions(+)

diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index b076d49985..60f17ea630 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -36,6 +36,7 @@
 ;;; Copyright © 2024 Raven Hallsby <karl@hallsby.com>
 ;;; Copyright © 2024 jgart <jgart@dismail.de>
 ;;; Copyright © 2024 Ashish SHUKLA <ashish.is@lostca.se>
+;;; Copyright © 2024 Giacomo Leidi <goodoldpaul@autistici.org>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -80,6 +81,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages dns)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages elf)
   #:use-module (gnu packages figlet)
   #:use-module (gnu packages firmware)
   #:use-module (gnu packages flex)
@@ -112,6 +114,7 @@ (define-module (gnu packages virtualization)
   #:use-module (gnu packages nettle)
   #:use-module (gnu packages networking)
   #:use-module (gnu packages ninja)
+  #:use-module (gnu packages ocaml)
   #:use-module (gnu packages onc-rpc)
   #:use-module (gnu packages package-management)
   #:use-module (gnu packages pciutils)
@@ -2902,3 +2905,118 @@ (define-public riscv-pk
 supervisor execution environment for tethered RISC-V systems.  It is designed
 to host the RISC-V Linux port.")
     (license license:bsd-3)))
+
+(define-public hivex
+  (package
+    (name "hivex")
+    (version "1.3.24")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://libguestfs.org/download/"
+                                  name "/" name "-" version ".tar.gz"))
+              (sha256
+               (base32
+                "0g0rib62qg81fda8lxsaa7a1ykqy4rl5sq185pdqm9y9xifa8bx5"))))
+    (build-system gnu-build-system)
+    (native-inputs (list automake
+                         autoconf
+                         gettext-minimal
+                         libtool
+                         ocaml
+                         patchelf
+                         pkg-config
+                         perl-io-stringy
+                         python-wrapper
+                         ruby
+                         ruby-rake
+                         ruby-rdoc))
+    (inputs
+     (list bash-minimal
+           libxml2
+           perl
+           readline))
+    (arguments
+     (list
+      #:configure-flags
+      #~(list
+         "--disable-static"
+         "--with-readline"
+         "--disable-rpath")
+      #:phases
+      #~(modify-phases %standard-phases
+          (replace 'bootstrap
+            (lambda _
+              (invoke "autoreconf" "-vif")))
+          (add-after 'unpack 'patch-makefiles
+            (lambda _
+              (let* ((current-system (or #$(%current-target-system)
+                                         #$(%current-system)))
+                     (ocamllib
+                      (string-append #$output "/lib/ocaml/"
+                                     #$(package-version
+                                        (this-package-native-input "ocaml")) "/site-lib"))
+                     (python-installdir
+                      (string-append #$output "/lib/python"
+                                     #$(version-major+minor
+                                        (package-version
+                                         (this-package-native-input
+                                          "python-wrapper")))
+                                     "/site-packages"))
+                     (ruby-version
+                      #$(package-version
+                         (this-package-native-input "ruby")))
+                     (ruby-libdir
+                      (string-append #$output
+                                     "/lib/ruby/site_ruby/"
+                                     ruby-version))
+                     (ruby-archdir
+                      (string-append ruby-libdir "/" current-system)))
+                (substitute* "lib/Makefile.am"
+                  (((string-append "\\$\\(VERSION_SCRIPT_FLAGS\\)"
+                                   "\\$\\(srcdir\\)/hivex\\.syms"))
+                   ""))
+                (substitute* "python/Makefile.am"
+                  (("\\$\\(PYTHON_INSTALLDIR\\)")
+                   python-installdir))
+                (substitute* "ocaml/Makefile.am"
+                  (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
+                   ocamllib))
+                (substitute* "ruby/Makefile.am"
+                  (("\\$\\(DESTDIR\\)\\$\\(RUBY_ARCHDIR\\)")
+                   ruby-archdir)
+                  (("\\$\\(DESTDIR\\)\\$\\(RUBY_LIBDIR\\)")
+                   ruby-libdir)))))
+          (add-before 'install 'set-rpath
+            (lambda _
+              (for-each
+               (lambda (sofile)
+                 ;; The ‘validate-runpath’ phase fails to find libhivex.so.0.
+                 (invoke (string-append #$(this-package-native-input "patchelf")
+                                        "/bin/patchelf")
+                         "--add-rpath" (string-append #$output "/lib") sofile))
+               '("perl/blib/arch/auto/Win/Hivex/Hivex.so"
+                 "ruby/ext/hivex/_hivex.so"))))
+          (add-after 'install 'wrap-binaries
+            (lambda _
+              (let ((hivexregedit
+                     (string-append #$output "/bin/hivexregedit"))
+                    (hivexml
+                     (string-append #$output "/bin/hivexml")))
+                (wrap-program hivexregedit
+                  `("PERL5LIB" ":" prefix
+                    (,(string-append #$output "/lib/perl5/site_perl")))
+                  `("PATH" ":" prefix
+                    (,(string-append #$output "/bin"))))
+                (wrap-program hivexml
+                  `("PATH" ":" prefix
+                    (,(string-append #$output "/bin"))))))))))
+    (home-page "https://github.com/libguestfs/hivex")
+    (synopsis "Windows registry hive extraction library")
+    (description
+     "This package provides a self-contained library for reading and writing
+Windows Registry \"hive\" binary files.  Unlike many other tools in this area,
+it doesn't use the textual @code{.REG} format for output, because parsing that
+is as much trouble as parsing the original binary format.  Instead it makes the
+file available through a C API, or through a separate program to export the
+hive as XML.")
+    (license license:lgpl2.1)))

base-commit: c572cf81f4b322af4280ac2133889c997e39d247
-- 
2.46.0





  reply	other threads:[~2024-09-14 21:22 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-14 21:15 [bug#73260] Add libguestfs paul via Guix-patches via
2024-09-14 21:20 ` Giacomo Leidi via Guix-patches via [this message]
2024-09-14 21:20   ` [bug#73260] [PATCH 2/3] gnu: Add libguestfs-minimal Giacomo Leidi via Guix-patches via
2024-09-30 17:07     ` [bug#73260] Add libguestfs Ludovic Courtès
2024-09-14 21:20   ` [bug#73260] [PATCH 3/3] gnu: " Giacomo Leidi via Guix-patches via
2024-09-30 17:08     ` [bug#73260] " Ludovic Courtès
2024-10-04 22:31       ` paul via Guix-patches via
2024-09-30 17:03   ` Ludovic Courtès
2024-09-16 12:15 ` [bug#73260] Jiri Spacek via Guix-patches
2024-10-04 22:31 ` [bug#73260] [PATCH v2 1/3] gnu: Add hivex Giacomo Leidi via Guix-patches via
2024-10-04 22:31   ` [bug#73260] [PATCH v2 2/3] gnu: Add libguestfs-minimal Giacomo Leidi via Guix-patches via
2024-10-04 22:31   ` [bug#73260] [PATCH v2 3/3] gnu: Add libguestfs Giacomo Leidi via Guix-patches via
2024-10-07 10:40   ` bug#73260: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=247263a340d7dedbf4671ebaf75da540e7e62734.1726348858.git.goodoldpaul@autistici.org \
    --to=guix-patches@gnu.org \
    --cc=73260@debbugs.gnu.org \
    --cc=goodoldpaul@autistici.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).