HwInfo

OpenSubmitted by Raghav Gururajan.
Details
3 participants
  • pelzflorian (Florian Pelz)
  • phodina
  • Raghav Gururajan
Owner
unassigned
Severity
normal
Merged with
R
R
Raghav Gururajan wrote on 30 Aug 2021 21:31
(address . guix-patches@gnu.org)
2c8e9e9d-c492-ea37-3414-c38e8bc4b2a1@raghavgururajan.name
R
R
Raghav Gururajan wrote on 30 Aug 2021 21:35
[PATCH v1 1/2] gnu: Add libx86emu.
(address . 50283@debbugs.gnu.org)(name . Raghav Gururajan)(address . rg@raghavgururajan.name)
20210830193525.2288-1-rg@raghavgururajan.name
* gnu/packages/virtualization.scm (libx86emu): New variable.
---
gnu/packages/virtualization.scm | 52 +++++++++++++++++++++++++++++++++
1 file changed, 52 insertions(+)

Toggle diff (65 lines)
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index e952c009b5..6dd5127bc6 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -130,6 +130,58 @@
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match))
 
+(define-public libx86emu
+  (package
+    (name "libx86emu")
+    (version "3.1")
+    (home-page "https://github.com/wfeldt/libx86emu")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url home-page)
+         (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "104xqc6nj9rpi7knl3dfqvasf087hlz2n5yndb1iycw35a6j509b"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (include (string-append out "/include"))
+                    (lib (string-append out "/lib")))
+               ;; Remove unnecessary variables and
+               ;; correct the values of version and prefix.
+               (substitute* (find-files "." "Makefile")
+                 (("GIT2LOG.*=.*$") "")
+                 (("GITDEPS.*=.*$") "")
+                 (("VERSION.*=.*$")
+                  (string-append "VERSION := "
+                                 ,version "\n"))
+                 (("BRANCH.*=.*$") "")
+                 (("PREFIX.*=.*$")
+                  (string-append "PREFIX := " out "\n"))
+                 (("MAJOR_VERSION.*=.*$")
+                  (string-append "MAJOR_VERSION := "
+                                 ,(version-major version) "\n"))
+                 (("LIBDIR.*=.*$")
+                  (string-append "LIBDIR = " lib "\n"))
+                 (("/usr/include") include)))))
+         (delete 'configure))))         ; no configure script
+    (native-inputs
+     `(("nasm" ,nasm)
+       ("perl" ,perl)))
+    (synopsis "ISA x86 emulation library")
+    (description "Libx86emu is a small library to emulate x86 instructions.  The
+focus here is not a complete emulation but to cover enough for typical
+firmware blobs.")
+    (license license:isc)))
+
 (define (qemu-patch commit file-name sha256-bv)
   "Return an origin for COMMIT."
   (origin
-- 
2.33.0
R
R
Raghav Gururajan wrote on 30 Aug 2021 21:35
[PATCH v1 2/2] gnu: Add hwinfo.
(address . 50283@debbugs.gnu.org)(name . Raghav Gururajan)(address . rg@raghavgururajan.name)
20210830193525.2288-2-rg@raghavgururajan.name
* gnu/packages/hardware.scm (hwinfo): New variable.
---
gnu/packages/hardware.scm | 85 +++++++++++++++++++++++++++++++++++++++
1 file changed, 85 insertions(+)

Toggle diff (112 lines)
diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index ff21c9c724..d7be7bf3cb 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -31,6 +31,7 @@
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
@@ -49,6 +50,7 @@
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages virtualization)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
@@ -66,6 +68,89 @@
 ;; This is a module for packages related to physical hardware that don't (yet)
 ;; have a more specific home like gps.scm, security-token.scm, &c.
 
+(define-public hwinfo
+  (package
+    (name "hwinfo")
+    (version "21.76")
+    (home-page "https://github.com/openSUSE/hwinfo")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url home-page)
+         (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1910wzpdyp1ma1z2v0dripaljgrpl7vjq0f6b7qq9y220899hihb"))
+       (modules
+        '((guix build utils)))
+       (snippet
+        `(begin
+           ;; Create version file.
+           (call-with-output-file "VERSION"
+             (lambda (port)
+               (format port ,version)))
+           #t))))
+    (build-system gnu-build-system)
+    (outputs '("out" "dev"))
+    (arguments
+     `(#:tests? #f                      ; no test-suite available
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (dev (assoc-ref outputs "dev"))
+                    (include (string-append dev "/include"))
+                    (lib (string-append dev "/lib"))
+                    (sbin (string-append out "/sbin"))
+                    (share (string-append out "/share")))
+               ;; Remove unnecessary variables and
+               ;; correct values for version and prefix.
+               (substitute* "Makefile"
+                 (("GIT2LOG.*\\:=.*$") "")
+                 (("GITDEPS.*\\:=.*$") "")
+                 (("BRANCH.*\\:=.*$") "")
+                 (("VERSION.*\\:=.*$")
+                  (string-append "VERSION := " ,version "\n"))
+                 (("LIBDIR.*\\?=.*$")
+                  (string-append "LIBDIR ?= " lib "\n"))
+                 (("/usr/include") include)
+                 (("/(usr|var)/(lib|lib64)") lib)
+                 (("/usr/sbin") sbin)
+                 (("/usr/share") share)
+                 (("\\$\\(DESTDIR\\)/sbin ") ""))
+               ;; Add output "dev" to the run-path.
+               (substitute* "Makefile.common"
+                 (("-Lsrc")
+                  (string-append "-Lsrc " "-Wl,-rpath=" lib)))
+               ;; Correct program name of the lexical analyzer.
+               (substitute* "src/isdn/cdb/Makefile"
+                 (("lex isdn_cdb.lex") "flex isdn_cdb.lex"))
+               ;; Patch pkgconfig file to point to output "dev".
+               (substitute* "hwinfo.pc.in"
+                 (("/usr") dev)))))
+         (delete 'configure)
+         (add-before 'build 'set-env
+           (lambda _
+             (setenv "CC" ,(cc-for-target))))
+         (replace 'build
+           (lambda _
+             (invoke "make" "shared"))))))
+    (native-inputs
+     `(("flex" ,flex)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("libx86emu" ,libx86emu)
+       ("util-linux:lib" ,util-linux "lib")))
+    (synopsis "Hardware information tool")
+    (description "HwInfo is used to probe for the hardware present in the system.
+It can be used to generate a system overview log which can be later used for
+support.")
+    (license license:gpl2+)))
+
 (define-public ddcutil
   (package
     (name "ddcutil")
-- 
2.33.0
R
R
Raghav Gururajan wrote on 30 Aug 2021 22:33
(no subject)
(address . control@debbugs.gnu.org)
f35fbbbb-e552-4e27-0a5f-501c85bed433@raghavgururajan.name
merge 49934 50283
Attachment: OpenPGP_signature
R
R
Raghav Gururajan wrote on 31 Aug 2021 00:27
[PATCH v2 1/2] gnu: Add libx86emu.
(address . 50283@debbugs.gnu.org)
20210830222712.14136-1-rg@raghavgururajan.name
* gnu/packages/virtualization.scm (libx86emu): New variable.

Co-authored-by: Petr Hodina <phodina@protonmail.com>
Co-authored-by: Vincent Legoll <vincent.legoll@gmail.com>
---
gnu/packages/virtualization.scm | 71 +++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)

Toggle diff (91 lines)
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index e952c009b5..e1954ceb71 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -20,6 +20,9 @@
 ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2021 Dion Mendel <guix@dm9.info>
+;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -130,6 +133,74 @@
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match))
 
+(define-public libx86emu
+  (package
+    (name "libx86emu")
+    (version "3.1")
+    (home-page "https://github.com/wfeldt/libx86emu")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url home-page)
+         (commit version)))
+       (file-name (git-file-name name version))
+       (modules
+        '((guix build utils)))
+       (snippet
+        `(begin
+           ;; Remove git2log program file.
+           (delete-file "git2log")
+           ;; Remove variables that depends on git2log.
+           (substitute* "Makefile"
+             (("GIT2LOG.*=.*$") "")
+             (("GITDEPS.*=.*$") "")
+             (("BRANCH.*=.*$") ""))
+           #t))
+       (sha256
+        (base32 "104xqc6nj9rpi7knl3dfqvasf087hlz2n5yndb1iycw35a6j509b"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (include (string-append out "/include"))
+                    (lib (string-append out "/lib")))
+               ;; Correct the values of version and install directories.
+               (substitute* "Makefile"
+                 (("VERSION.*=.*$")
+                  (string-append "VERSION := "
+                                 ,version "\n"))
+                 (("PREFIX.*=.*$")
+                  (string-append "PREFIX := " out "\n"))
+                 (("MAJOR_VERSION.*=.*$")
+                  (string-append "MAJOR_VERSION := "
+                                 ,(version-major version) "\n"))
+                 (("LIBDIR.*=.*$")
+                  (string-append "LIBDIR = " lib "\n"))
+                 (("/usr/include") include)))))
+         (delete 'configure))))         ; no configure script
+    (native-inputs
+     `(("nasm" ,nasm)
+       ("perl" ,perl)))
+    (synopsis "Library for x86 emulation")
+    (description "Libx86emu is a small library to emulate x86 instructions.  The
+focus here is not a complete emulation but to cover enough for typical
+firmware blobs.  You can,
+@enumerate
+@item intercept any memory access or directly map real memory ranges
+@item intercept any i/o access, map real i/o ports, or block any real i/o
+@item intercept any interrupt
+@item provides a hook to run after each instruction
+@item recognize a special x86 instruction that can trigger logging
+@item use integrated logging
+@end enumerate")
+    (license license:isc)))
+
 (define (qemu-patch commit file-name sha256-bv)
   "Return an origin for COMMIT."
   (origin
-- 
2.33.0
R
R
Raghav Gururajan wrote on 31 Aug 2021 00:27
[PATCH v2 2/2] gnu: Add hwinfo.
(address . 50283@debbugs.gnu.org)
20210830222712.14136-2-rg@raghavgururajan.name
* gnu/packages/hardware.scm (hwinfo): New variable.

Co-authored-by: Petr Hodina <phodina@protonmail.com>
---
gnu/packages/hardware.scm | 109 ++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)

Toggle diff (143 lines)
diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index ff21c9c724..d000ab8ce6 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -5,6 +5,8 @@
 ;;; Copyright © 2021 Evgeny Pisemsky <evgeny@pisemsky.com>
 ;;; Copyright © 2021 Léo Le Bouter <lle-bout@zaclys.net>
 ;;; Copyright © 2021 Denis Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +33,7 @@
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
@@ -49,6 +52,7 @@
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages virtualization)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
@@ -66,6 +70,111 @@
 ;; This is a module for packages related to physical hardware that don't (yet)
 ;; have a more specific home like gps.scm, security-token.scm, &c.
 
+(define-public hwinfo
+  (package
+    (name "hwinfo")
+    (version "21.76")
+    (home-page "https://github.com/openSUSE/hwinfo")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url home-page)
+         (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1910wzpdyp1ma1z2v0dripaljgrpl7vjq0f6b7qq9y220899hihb"))
+       (modules
+        '((guix build utils)))
+       (snippet
+        `(begin
+           ;; Remove git2log program file.
+           (delete-file "git2log")
+           ;; Remove variables that depends on git2log.
+           (substitute* "Makefile"
+             (("GIT2LOG.*\\:=.*$") "")
+             (("GITDEPS.*\\:=.*$") "")
+             (("BRANCH.*\\:=.*$") ""))
+           ;; Create version file.
+           (call-with-output-file "VERSION"
+             (lambda (port)
+               (format port ,version)))
+           #t))))
+    (build-system gnu-build-system)
+    (outputs '("out" "dev" "doc"))
+    (arguments
+     `(#:tests? #f                      ; no test-suite available
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (dev (assoc-ref outputs "dev"))
+                    (doc (assoc-ref outputs "doc"))
+                    (incl-dir (string-append dev "/include"))
+                    (lib-dir (string-append dev "/lib"))
+                    (sbin-dir (string-append out "/sbin"))
+                    (share-dir (string-append out "/share"))
+                    (doc-dir (string-append doc "/share/doc")))
+               ;; Generate HTML documentation in the output "doc".
+               (mkdir-p doc-dir)
+               (substitute* "doc/libhd.doxy"
+                 (("OUTPUT_DIRECTORY.*=.*libhd")
+                  (string-append "OUTPUT_DIRECTORY = " doc-dir "/libhd")))
+               ;; Correct values of the version and install directories.
+               (substitute* "Makefile"
+                 (("VERSION.*\\:=.*$")
+                  (string-append "VERSION := " ,version "\n"))
+                 (("LIBDIR.*\\?=.*$")
+                  (string-append "LIBDIR ?= " lib-dir "\n"))
+                 (("/usr/include") incl-dir)
+                 (("/(usr|var)/(lib|lib64)") lib-dir)
+                 (("/usr/sbin") sbin-dir)
+                 (("/usr/share") share-dir)
+                 (("\\$\\(DESTDIR\\)/sbin ") ""))
+               ;; Add output "dev" to the run-path.
+               (substitute* "Makefile.common"
+                 (("-Lsrc")
+                  (string-append "-Lsrc " "-Wl,-rpath=" lib-dir)))
+               ;; Correct program name of the lexical analyzer.
+               (substitute* "src/isdn/cdb/Makefile"
+                 (("lex isdn_cdb.lex") "flex isdn_cdb.lex"))
+               ;; Patch pkgconfig file to point to output "dev".
+               (substitute* "hwinfo.pc.in"
+                 (("/usr") dev)))))
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (setenv "CC" ,(cc-for-target))
+             (invoke "make" "shared")
+             (invoke "make" "doc")))
+         (add-after 'install 'install-manpages
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (man-dir (string-append out "/share/man"))
+                    (man1-dir (string-append man-dir "/man1"))
+                    (man8-dir (string-append man-dir "/man8")))
+               (for-each
+                (lambda (x) (install-file x man1-dir))
+                (find-files "doc" "\\.1$"))
+               (for-each
+                (lambda (y) (install-file y man8-dir))
+                (find-files "doc" "\\.8$"))))))))
+    (native-inputs
+     `(("doxygen" ,doxygen)
+       ("flex" ,flex)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("libx86emu" ,libx86emu)
+       ("util-linux:lib" ,util-linux "lib")))
+    (synopsis "Hardware information tool")
+    (description "HwInfo is used to probe for the hardware present in the system.
+It can be used to generate a system overview log which can be later used for
+support.")
+    (license license:gpl2+)))
+
 (define-public ddcutil
   (package
     (name "ddcutil")
-- 
2.33.0
P
P
pelzflorian (Florian Pelz) wrote on 31 Aug 2021 01:13
Re: [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu.
(name . Raghav Gururajan)(address . rg@raghavgururajan.name)(address . 50283@debbugs.gnu.org)
20210830231323.e2ybja6ui5xmal6t@pelzflorian.localdomain
Hi Raghav,

On Mon, Aug 30, 2021 at 03:35:24PM -0400, Raghav Gururajan via Guix-patches via wrote:
Toggle quote (4 lines)
> * gnu/packages/virtualization.scm (libx86emu): New variable.
> […]
> + (license license:isc)))

This is the third time someone submits libx86emu. :D



Your patch looks good (I am not very familiar with packaging habits
and have not tested though), but isn’t this license:x11-style?

Regards,
Florian
R
R
Raghav Gururajan wrote on 31 Aug 2021 01:27
Re: HwInfo
(name . pelzflorian (Florian Pelz))(address . pelzflorian@pelzflorian.de)(address . 50283@debbugs.gnu.org)
fae81651-2457-ca7e-f2e6-17b624a250f1@raghavgururajan.name
Hi Florian!

Toggle quote (6 lines)
> This is the third time someone submits libx86emu. :D
>
> https://issues.guix.gnu.org/49934
>
> https://issues.guix.gnu.org/45744.

Yeah, I was informed in IRC after I sent this patch-set.

I have combined the patches into one and sent v2 to this thread.

Toggle quote (3 lines)
> Your patch looks good (I am not very familiar with packaging habits
> and have not tested though), but isn’t this license:x11-style?

The wordings coincide with ISC and expat. Should I mention non-copyleft
instead?

Regards,
RG.
Attachment: OpenPGP_signature
R
R
Raghav Gururajan wrote on 31 Aug 2021 01:33
[PATCH v3 2/2] gnu: Add hwinfo.
(address . 50283@debbugs.gnu.org)
20210830233353.19811-2-rg@raghavgururajan.name
* gnu/packages/hardware.scm (hwinfo): New variable.

Co-authored-by: Petr Hodina <phodina@protonmail.com>
---
gnu/packages/hardware.scm | 109 ++++++++++++++++++++++++++++++++++++++
1 file changed, 109 insertions(+)

Toggle diff (143 lines)
diff --git a/gnu/packages/hardware.scm b/gnu/packages/hardware.scm
index ff21c9c724..d000ab8ce6 100644
--- a/gnu/packages/hardware.scm
+++ b/gnu/packages/hardware.scm
@@ -5,6 +5,8 @@
 ;;; Copyright © 2021 Evgeny Pisemsky <evgeny@pisemsky.com>
 ;;; Copyright © 2021 Léo Le Bouter <lle-bout@zaclys.net>
 ;;; Copyright © 2021 Denis Carikli <GNUtoo@cyberdimension.org>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -31,6 +33,7 @@
   #:use-module (gnu packages crypto)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages documentation)
+  #:use-module (gnu packages flex)
   #:use-module (gnu packages gcc)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
@@ -49,6 +52,7 @@
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages tls)
+  #:use-module (gnu packages virtualization)
   #:use-module (gnu packages web)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xml)
@@ -66,6 +70,111 @@
 ;; This is a module for packages related to physical hardware that don't (yet)
 ;; have a more specific home like gps.scm, security-token.scm, &c.
 
+(define-public hwinfo
+  (package
+    (name "hwinfo")
+    (version "21.76")
+    (home-page "https://github.com/openSUSE/hwinfo")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url home-page)
+         (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "1910wzpdyp1ma1z2v0dripaljgrpl7vjq0f6b7qq9y220899hihb"))
+       (modules
+        '((guix build utils)))
+       (snippet
+        `(begin
+           ;; Remove git2log program file.
+           (delete-file "git2log")
+           ;; Remove variables that depends on git2log.
+           (substitute* "Makefile"
+             (("GIT2LOG.*\\:=.*$") "")
+             (("GITDEPS.*\\:=.*$") "")
+             (("BRANCH.*\\:=.*$") ""))
+           ;; Create version file.
+           (call-with-output-file "VERSION"
+             (lambda (port)
+               (format port ,version)))
+           #t))))
+    (build-system gnu-build-system)
+    (outputs '("out" "dev" "doc"))
+    (arguments
+     `(#:tests? #f                      ; no test-suite available
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (dev (assoc-ref outputs "dev"))
+                    (doc (assoc-ref outputs "doc"))
+                    (incl-dir (string-append dev "/include"))
+                    (lib-dir (string-append dev "/lib"))
+                    (sbin-dir (string-append out "/sbin"))
+                    (share-dir (string-append out "/share"))
+                    (doc-dir (string-append doc "/share/doc")))
+               ;; Generate HTML documentation in the output "doc".
+               (mkdir-p doc-dir)
+               (substitute* "doc/libhd.doxy"
+                 (("OUTPUT_DIRECTORY.*=.*libhd")
+                  (string-append "OUTPUT_DIRECTORY = " doc-dir "/libhd")))
+               ;; Correct values of the version and install directories.
+               (substitute* "Makefile"
+                 (("VERSION.*\\:=.*$")
+                  (string-append "VERSION := " ,version "\n"))
+                 (("LIBDIR.*\\?=.*$")
+                  (string-append "LIBDIR ?= " lib-dir "\n"))
+                 (("/usr/include") incl-dir)
+                 (("/(usr|var)/(lib|lib64)") lib-dir)
+                 (("/usr/sbin") sbin-dir)
+                 (("/usr/share") share-dir)
+                 (("\\$\\(DESTDIR\\)/sbin ") ""))
+               ;; Add output "dev" to the run-path.
+               (substitute* "Makefile.common"
+                 (("-Lsrc")
+                  (string-append "-Lsrc " "-Wl,-rpath=" lib-dir)))
+               ;; Correct program name of the lexical analyzer.
+               (substitute* "src/isdn/cdb/Makefile"
+                 (("lex isdn_cdb.lex") "flex isdn_cdb.lex"))
+               ;; Patch pkgconfig file to point to output "dev".
+               (substitute* "hwinfo.pc.in"
+                 (("/usr") dev)))))
+         (delete 'configure)
+         (replace 'build
+           (lambda _
+             (setenv "CC" ,(cc-for-target))
+             (invoke "make" "shared")
+             (invoke "make" "doc")))
+         (add-after 'install 'install-manpages
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (man-dir (string-append out "/share/man"))
+                    (man1-dir (string-append man-dir "/man1"))
+                    (man8-dir (string-append man-dir "/man8")))
+               (for-each
+                (lambda (x) (install-file x man1-dir))
+                (find-files "doc" "\\.1$"))
+               (for-each
+                (lambda (y) (install-file y man8-dir))
+                (find-files "doc" "\\.8$"))))))))
+    (native-inputs
+     `(("doxygen" ,doxygen)
+       ("flex" ,flex)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("libx86emu" ,libx86emu)
+       ("util-linux:lib" ,util-linux "lib")))
+    (synopsis "Hardware information tool")
+    (description "HwInfo is used to probe for the hardware present in the system.
+It can be used to generate a system overview log which can be later used for
+support.")
+    (license license:gpl2+)))
+
 (define-public ddcutil
   (package
     (name "ddcutil")
-- 
2.33.0
R
R
Raghav Gururajan wrote on 31 Aug 2021 01:33
[PATCH v3 1/2] gnu: Add libx86emu.
(address . 50283@debbugs.gnu.org)
20210830233353.19811-1-rg@raghavgururajan.name
* gnu/packages/virtualization.scm (libx86emu): New variable.

Co-authored-by: Petr Hodina <phodina@protonmail.com>
Co-authored-by: Vincent Legoll <vincent.legoll@gmail.com>
---
gnu/packages/virtualization.scm | 71 +++++++++++++++++++++++++++++++++
1 file changed, 71 insertions(+)

Toggle diff (91 lines)
diff --git a/gnu/packages/virtualization.scm b/gnu/packages/virtualization.scm
index e952c009b5..5901524269 100644
--- a/gnu/packages/virtualization.scm
+++ b/gnu/packages/virtualization.scm
@@ -20,6 +20,9 @@
 ;;; Copyright © 2021 Leo Famulari <leo@famulari.name>
 ;;; Copyright © 2021 Pierre Langlois <pierre.langlois@gmx.com>
 ;;; Copyright © 2021 Dion Mendel <guix@dm9.info>
+;;; Copyright © 2021 Vincent Legoll <vincent.legoll@gmail.com>
+;;; Copyright © 2021 Petr Hodina <phodina@protonmail.com>
+;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -130,6 +133,74 @@
   #:use-module (srfi srfi-26)
   #:use-module (ice-9 match))
 
+(define-public libx86emu
+  (package
+    (name "libx86emu")
+    (version "3.1")
+    (home-page "https://github.com/wfeldt/libx86emu")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url home-page)
+         (commit version)))
+       (file-name (git-file-name name version))
+       (modules
+        '((guix build utils)))
+       (snippet
+        `(begin
+           ;; Remove git2log program file.
+           (delete-file "git2log")
+           ;; Remove variables that depends on git2log.
+           (substitute* "Makefile"
+             (("GIT2LOG.*=.*$") "")
+             (("GITDEPS.*=.*$") "")
+             (("BRANCH.*=.*$") ""))
+           #t))
+       (sha256
+        (base32 "104xqc6nj9rpi7knl3dfqvasf087hlz2n5yndb1iycw35a6j509b"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (include (string-append out "/include"))
+                    (lib (string-append out "/lib")))
+               ;; Correct the values of version and install directories.
+               (substitute* "Makefile"
+                 (("VERSION.*=.*$")
+                  (string-append "VERSION := "
+                                 ,version "\n"))
+                 (("PREFIX.*=.*$")
+                  (string-append "PREFIX := " out "\n"))
+                 (("MAJOR_VERSION.*=.*$")
+                  (string-append "MAJOR_VERSION := "
+                                 ,(version-major version) "\n"))
+                 (("LIBDIR.*=.*$")
+                  (string-append "LIBDIR = " lib "\n"))
+                 (("/usr/include") include)))))
+         (delete 'configure))))         ; no configure script
+    (native-inputs
+     `(("nasm" ,nasm)
+       ("perl" ,perl)))
+    (synopsis "Library for x86 emulation")
+    (description "Libx86emu is a small library to emulate x86 instructions.  The
+focus here is not a complete emulation but to cover enough for typical
+firmware blobs.  You can,
+@enumerate
+@item intercept any memory access or directly map real memory ranges
+@item intercept any i/o access, map real i/o ports, or block any real i/o
+@item intercept any interrupt
+@item provides a hook to run after each instruction
+@item recognize a special x86 instruction that can trigger logging
+@item use integrated logging
+@end enumerate")
+    (license (license:non-copyleft "file:///LICENSE"))))
+
 (define (qemu-patch commit file-name sha256-bv)
   "Return an origin for COMMIT."
   (origin
-- 
2.33.0
P
P
pelzflorian (Florian Pelz) wrote on 31 Aug 2021 11:35
Re: HwInfo
(name . Raghav Gururajan)(address . rg@raghavgururajan.name)(address . 50283@debbugs.gnu.org)
20210831093536.nefel7is5l5crsk4@pelzflorian.localdomain
Thank you for merging the others’ patches.

Could you change the grammar of the description as I wrote at

On Mon, Aug 30, 2021 at 07:27:33PM -0400, Raghav Gururajan wrote:
Toggle quote (4 lines)
> > but isn’t this license:x11-style?
> The wordings coincide with ISC and expat. Should I mention non-copyleft
> instead?

The wording is the same as
licensor’s name, so I thought it best be specified as x11-style.

Regards,
Florian
P
P
pelzflorian (Florian Pelz) wrote on 31 Aug 2021 11:41
(name . Raghav Gururajan)(address . rg@raghavgururajan.name)(address . 50283@debbugs.gnu.org)
20210831094124.mlczfrwdfsl6dtez@pelzflorian.localdomain
On Tue, Aug 31, 2021 at 11:35:44AM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (5 lines)
> Thank you for merging the others’ patches.
>
> Could you change the grammar of the description as I wrote at
> <https://issues.guix.gnu.org/49934#5>?

Oh you did, sorry. It looks good to me except I did not notice maybe
instead of

You can,
@enumerate
[…]
@item provides a hook yo run after each instruction

it should be

You can <--- no comma
@enumerate
[…]
@item add a hook yo run after each instruction


Regards,
Florian
P
P
pelzflorian (Florian Pelz) wrote on 31 Aug 2021 11:48
Re: [bug#50283] HwInfo
(name . Raghav Gururajan)(address . rg@raghavgururajan.name)(address . 50283@debbugs.gnu.org)
20210831094748.aaw3u625bpaiibpe@pelzflorian.localdomain
On Tue, Aug 31, 2021 at 11:41:36AM +0200, pelzflorian (Florian Pelz) wrote:
Toggle quote (2 lines)
> @item add a hook yo run after each instruction

Oops I made a typo “to run” not “yo run”. Funny typo of mine. You
did not mistype. Yo would be in the wrong language register.

Regards,
Florian
P
P
phodina wrote on 31 Aug 2021 13:18
Re: [PATCH v3 2/2] gnu: Add hwinfo.
(name . Raghav Gururajan)(address . rg@raghavgururajan.name)(address . 50283@debbugs.gnu.org)
Sv4MDv5eLZBT7eCXsZgrOkx1PakFEtMDhUD4ull4T1gFy2y6bR8UIw00BhVqciqzr_78Rd3DZ0_k5tq-bbrhy4DwFHSp-Q0XeGXurt_dXgg=@protonmail.com
Hi Raghav,

thanks for the patches!

Just what about hw-probe package? Should I create a new version of the patch?

PH
R
R
Raghav Gururajan wrote on 1 Sep 2021 03:28
(name . phodina)(address . phodina@protonmail.com)(address . 50283@debbugs.gnu.org)
249ea81f-ba89-b0e5-4874-dad0d0e54e19@raghavgururajan.name
Hi Petr!

Toggle quote (2 lines)
> thanks for the patches!

:)

Toggle quote (2 lines)
> Just what about hw-probe package? Should I create a new version of the patch?

I have the hw-probe package in my local machine, which requires some
refinement. Once libx86emu and hwinfo are merged, we'll focus on hw-probe.

Regards,
RG.
Attachment: OpenPGP_signature
P
P
phodina wrote on 18 Sep 2021 14:59
Patch status
(name . 50283@debbugs.gnu.org)(address . 50283@debbugs.gnu.org)
r6htiw9Wkn2l4TCUkL80MwD65NT0V2gmB4ov1UmGNu_4Xuvh0caU6XeurAa1wMimhLeCJTBc7XnFjZ4uTZisXRaCUOdNbBZQ0bmanC6S2u8=@protonmail.com
Hi Raghav!

Could I be of any assistance?
Attachment: file
R
R
Raghav Gururajan wrote on 2 Oct 2021 01:30
Re: HwInfo
(address . 50283@debbugs.gnu.org)
10166a56-d8bd-821e-cda3-dbb7a53afb81@raghavgururajan.name
libx86emu and hwinfo are now merged to master.
Attachment: OpenPGP_signature
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send email to 50283@debbugs.gnu.org