unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Morgan.J.Smith@outlook.com
To: 44040@debbugs.gnu.org
Cc: Morgan Smith <Morgan.J.Smith@outlook.com>
Subject: [bug#44040] [PATCH 1/2] gnu: Add ocaml-hivex.
Date: Fri, 16 Oct 2020 16:00:51 -0400	[thread overview]
Message-ID: <DM5PR1001MB2105E82B91C9FE8D14CC119DC5030@DM5PR1001MB2105.namprd10.prod.outlook.com> (raw)
In-Reply-To: <DM5PR1001MB21056B37F10D88430FA3C3DAC5030@DM5PR1001MB2105.namprd10.prod.outlook.com>

From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/ocaml.scm (ocaml-hivex): New variable.
---
 gnu/packages/ocaml.scm | 104 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 4cc530509a..88c7f3c1d3 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2019 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2020 Brett Gilio <brettg@gnu.org>
 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2020 Morgan Smith <Morgan.J.Smith@outlook.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -47,6 +48,8 @@
   #:use-module (gnu packages ghostscript)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
+  #:use-module (gnu packages gperf)
+  #:use-module (gnu packages gettext)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libffi)
@@ -68,6 +71,7 @@
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages version-control)
   #:use-module (gnu packages virtualization)
   #:use-module (gnu packages web-browsers)
   #:use-module (gnu packages xml)
@@ -2831,6 +2835,106 @@ writing to these structures, and they are accessed via the Bigarray module.")
     (description "Hex is a minimal library providing hexadecimal converters.")
     (license license:isc)))
 
+(define-public ocaml-hivex
+  (package
+    (name "ocaml-hivex")
+    ;; Make sure to update the gnulib input to the commit upstream uses when
+    ;; updating this package
+    (version "1.3.19")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/libguestfs/hivex")
+                    (commit version)))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1gw59ac6z4fbg0flajnsh6d25h75pnk4605d5rw9rv0bvhfvway5"))))
+    (build-system ocaml-build-system)
+    (arguments
+     `(;; XXX: I'm not sure why runpath validation doesn't work
+       #:validate-runpath? #f
+       #:configure-flags
+       (list (string-append "CONFIG_SHELL="
+                            (assoc-ref %build-inputs "bash") "/bin/bash")
+             (string-append "SHELL="
+                            (assoc-ref %build-inputs "bash") "/bin/bash"))
+       #:test-target "check"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'unpack-gnulib
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((gnulib (assoc-ref inputs "gnulib")))
+               ;; Upstream gnulib is cloned into this directory as a submodule
+               (copy-recursively gnulib ".gnulib")
+               #t)))
+         ;; Autogen calls bootstrap and then generates a configure script
+         (add-before 'configure 'autogen
+           (lambda _
+             (chmod "configure.ac" #o644)
+             (invoke "./autogen.sh")
+             #t))
+         (add-before 'autogen 'fix-bootstrap
+           (lambda _
+             ;; Stop bootstrap from cloning gnulib
+             (substitute* "bootstrap"
+               (("^git.*$") ""))
+             #t))
+         (add-before 'autogen 'fix-autogen.sh
+           (lambda _
+             (substitute* "autogen.sh"
+               ;; Forces bootstrap to run
+               (("git submodule status") "echo false")
+               ;; Don't run configure yet
+               (("^.*configure.*$") "echo\n"))
+             #t))
+         (add-after 'autogen 'patch-configure-and-build-aux
+           (lambda* (#:key native-inputs inputs outputs #:allow-other-keys)
+             (patch-shebang "configure")
+             ;; Hard code paths to ld and file in the configure script
+             (substitute* "configure"
+               (("/usr/bin/ld")
+                (string-append (assoc-ref inputs "ld-wrapper") "/bin/ld"))
+               (("/usr/bin/file")
+                (string-append (assoc-ref inputs "file") "/bin/file")))
+             #t))
+         (add-before 'install 'patch-ocaml-installdir
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               ;; Force ocaml installdir to be correct
+               (substitute* "ocaml/Makefile"
+                 (("\\$\\(DESTDIR\\)\\$\\(OCAMLLIB\\)")
+                  (string-append
+                   out "/lib/ocaml/site-lib"))))
+             #t)))))
+    (native-inputs
+     `(("autoconf" ,autoconf)
+       ("automake" ,automake)
+       ("gperg" ,gperf)
+       ("libtool" ,libtool)
+       ("pkg-config" ,pkg-config)
+       ("gnulib"
+        ;; This is the commit upstream uses
+        ,(let ((commit "5e50baa16ef90204d9048a9e2f23c5a538955121"))
+           (origin
+             (method git-fetch)
+             (uri (git-reference
+                   (url "git://git.savannah.gnu.org/gnulib.git")
+                   (commit commit)))
+             (sha256
+              (base32 "0clx0gq6mmm4dkzp5pqh02cbzggnc3ba491qb79brpxcrjri1pnd"))
+             (file-name (git-file-name "gnulib" commit)))))))
+    (inputs
+     `(("perl" ,perl)
+       ("sed" ,sed)
+       ("gettext" ,gettext-minimal)))
+    (home-page "https://github.com/libguestfs/hivex")
+    (synopsis "Library for reading and writing Windows Registry \"hive\"
+binary files")
+    (description "This library reads Windows NT registry files (ie. not
+Windows 3.1 or Windows 95/98/ME).")
+    (license license:lgpl2.1)))
+
 (define-public ocaml4.07-ezjsonm
   (package
     (name "ocaml4.07-ezjsonm")
-- 
2.28.0





  reply	other threads:[~2020-10-16 20:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-16 19:43 [bug#44040] libguestfs + ocaml-hivex help wanted Morgan Smith
2020-10-16 20:00 ` Morgan.J.Smith [this message]
2020-10-16 20:00 ` [bug#44040] [PATCH 2/2] gnu: Add libguestfs Morgan.J.Smith
2020-10-28 17:19   ` Joshua Branson via Guix-patches via

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=DM5PR1001MB2105E82B91C9FE8D14CC119DC5030@DM5PR1001MB2105.namprd10.prod.outlook.com \
    --to=morgan.j.smith@outlook.com \
    --cc=44040@debbugs.gnu.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).