unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#50283] HwInfo
@ 2021-08-30 19:31 Raghav Gururajan via Guix-patches via
  2021-08-30 19:35 ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-08-30 19:31 UTC (permalink / raw)
  To: 50283


[-- Attachment #1.1.1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2649 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu.
  2021-08-30 19:31 [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
@ 2021-08-30 19:35 ` Raghav Gururajan via Guix-patches via
  2021-08-30 19:35   ` [bug#50283] [PATCH v1 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
  2021-08-30 23:13   ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu pelzflorian (Florian Pelz)
  2021-08-30 22:27 ` [bug#50283] [PATCH v2 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-08-30 19:35 UTC (permalink / raw)
  To: 50283; +Cc: Raghav Gururajan

* gnu/packages/virtualization.scm (libx86emu): New variable.
---
 gnu/packages/virtualization.scm | 52 +++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)

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





^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#50283] [PATCH v1 2/2] gnu: Add hwinfo.
  2021-08-30 19:35 ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
@ 2021-08-30 19:35   ` Raghav Gururajan via Guix-patches via
  2021-08-30 23:13   ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu pelzflorian (Florian Pelz)
  1 sibling, 0 replies; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-08-30 19:35 UTC (permalink / raw)
  To: 50283; +Cc: Raghav Gururajan

* gnu/packages/hardware.scm (hwinfo): New variable.
---
 gnu/packages/hardware.scm | 85 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 85 insertions(+)

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





^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#50283] [PATCH v2 1/2] gnu: Add libx86emu.
  2021-08-30 19:31 [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
  2021-08-30 19:35 ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
@ 2021-08-30 22:27 ` Raghav Gururajan via Guix-patches via
  2021-08-30 22:27   ` [bug#50283] [PATCH v2 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
  2021-08-30 23:33 ` [bug#50283] [PATCH v3 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-08-30 22:27 UTC (permalink / raw)
  To: 50283; +Cc: Raghav Gururajan, phodina, Vincent Legoll

* 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(+)

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





^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#50283] [PATCH v2 2/2] gnu: Add hwinfo.
  2021-08-30 22:27 ` [bug#50283] [PATCH v2 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
@ 2021-08-30 22:27   ` Raghav Gururajan via Guix-patches via
  0 siblings, 0 replies; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-08-30 22:27 UTC (permalink / raw)
  To: 50283; +Cc: Raghav Gururajan, phodina

* 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(+)

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





^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu.
  2021-08-30 19:35 ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
  2021-08-30 19:35   ` [bug#50283] [PATCH v1 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
@ 2021-08-30 23:13   ` pelzflorian (Florian Pelz)
  2021-08-30 23:27     ` [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
  1 sibling, 1 reply; 18+ messages in thread
From: pelzflorian (Florian Pelz) @ 2021-08-30 23:13 UTC (permalink / raw)
  To: Raghav Gururajan; +Cc: 50283

Hi Raghav,

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

This is the third time someone submits libx86emu. :D

https://issues.guix.gnu.org/49934

https://issues.guix.gnu.org/45744.

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




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] HwInfo
  2021-08-30 23:13   ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu pelzflorian (Florian Pelz)
@ 2021-08-30 23:27     ` Raghav Gururajan via Guix-patches via
  2021-08-31  9:35       ` pelzflorian (Florian Pelz)
  0 siblings, 1 reply; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-08-30 23:27 UTC (permalink / raw)
  To: pelzflorian (Florian Pelz); +Cc: 50283


[-- Attachment #1.1.1: Type: text/plain, Size: 526 bytes --]

Hi Florian!

> 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.

> 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 #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2649 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] [PATCH v3 1/2] gnu: Add libx86emu.
  2021-08-30 19:31 [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
  2021-08-30 19:35 ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
  2021-08-30 22:27 ` [bug#50283] [PATCH v2 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
@ 2021-08-30 23:33 ` Raghav Gururajan via Guix-patches via
  2021-08-30 23:33   ` [bug#50283] [PATCH v3 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
  2021-09-18 12:59 ` [bug#50283] Patch status phodina via Guix-patches via
  2021-10-01 23:30 ` [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
  4 siblings, 1 reply; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-08-30 23:33 UTC (permalink / raw)
  To: 50283; +Cc: Raghav Gururajan, Petr Hodina, Vincent Legoll

* 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(+)

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





^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#50283] [PATCH v3 2/2] gnu: Add hwinfo.
  2021-08-30 23:33 ` [bug#50283] [PATCH v3 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
@ 2021-08-30 23:33   ` Raghav Gururajan via Guix-patches via
  2021-08-31 11:18     ` phodina via Guix-patches via
  0 siblings, 1 reply; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-08-30 23:33 UTC (permalink / raw)
  To: 50283; +Cc: Raghav Gururajan, Petr Hodina

* 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(+)

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





^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#50283] HwInfo
  2021-08-30 23:27     ` [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
@ 2021-08-31  9:35       ` pelzflorian (Florian Pelz)
  2021-08-31  9:41         ` pelzflorian (Florian Pelz)
  0 siblings, 1 reply; 18+ messages in thread
From: pelzflorian (Florian Pelz) @ 2021-08-31  9:35 UTC (permalink / raw)
  To: Raghav Gururajan; +Cc: 50283

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>?

On Mon, Aug 30, 2021 at 07:27:33PM -0400, Raghav Gururajan wrote:
> > 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
<https://directory.fsf.org/wiki/License:Modified_X11> except for the
licensor’s name, so I thought it best be specified as x11-style.

Regards,
Florian




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] HwInfo
  2021-08-31  9:35       ` pelzflorian (Florian Pelz)
@ 2021-08-31  9:41         ` pelzflorian (Florian Pelz)
  2021-08-31  9:48           ` pelzflorian (Florian Pelz)
  0 siblings, 1 reply; 18+ messages in thread
From: pelzflorian (Florian Pelz) @ 2021-08-31  9:41 UTC (permalink / raw)
  To: Raghav Gururajan; +Cc: 50283

On Tue, Aug 31, 2021 at 11:35:44AM +0200, pelzflorian (Florian Pelz) wrote:
> 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




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] HwInfo
  2021-08-31  9:41         ` pelzflorian (Florian Pelz)
@ 2021-08-31  9:48           ` pelzflorian (Florian Pelz)
  0 siblings, 0 replies; 18+ messages in thread
From: pelzflorian (Florian Pelz) @ 2021-08-31  9:48 UTC (permalink / raw)
  To: Raghav Gururajan; +Cc: 50283

On Tue, Aug 31, 2021 at 11:41:36AM +0200, pelzflorian (Florian Pelz) wrote:
> @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




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] [PATCH v3 2/2] gnu: Add hwinfo.
  2021-08-30 23:33   ` [bug#50283] [PATCH v3 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
@ 2021-08-31 11:18     ` phodina via Guix-patches via
  2021-09-01  1:28       ` Raghav Gururajan via Guix-patches via
  0 siblings, 1 reply; 18+ messages in thread
From: phodina via Guix-patches via @ 2021-08-31 11:18 UTC (permalink / raw)
  To: Raghav Gururajan; +Cc: 50283

Hi Raghav,

thanks for the patches!

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

PH





^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] [PATCH v3 2/2] gnu: Add hwinfo.
  2021-08-31 11:18     ` phodina via Guix-patches via
@ 2021-09-01  1:28       ` Raghav Gururajan via Guix-patches via
  0 siblings, 0 replies; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-09-01  1:28 UTC (permalink / raw)
  To: phodina; +Cc: 50283


[-- Attachment #1.1.1: Type: text/plain, Size: 294 bytes --]

Hi Petr!

> thanks for the patches!

:)

> 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 #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2649 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] Patch status
  2021-08-30 19:31 [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
                   ` (2 preceding siblings ...)
  2021-08-30 23:33 ` [bug#50283] [PATCH v3 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
@ 2021-09-18 12:59 ` phodina via Guix-patches via
  2021-10-01 23:30 ` [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
  4 siblings, 0 replies; 18+ messages in thread
From: phodina via Guix-patches via @ 2021-09-18 12:59 UTC (permalink / raw)
  To: 50283@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 41 bytes --]

Hi Raghav!

Could I be of any assistance?

[-- Attachment #2: Type: text/html, Size: 84 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] HwInfo
  2021-08-30 19:31 [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
                   ` (3 preceding siblings ...)
  2021-09-18 12:59 ` [bug#50283] Patch status phodina via Guix-patches via
@ 2021-10-01 23:30 ` Raghav Gururajan via Guix-patches via
  4 siblings, 0 replies; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2021-10-01 23:30 UTC (permalink / raw)
  To: 50283


[-- Attachment #1.1.1: Type: text/plain, Size: 48 bytes --]

libx86emu and hwinfo are now merged to master.

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 2649 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] HwInfo
  2021-12-25 21:17 ` Raghav Gururajan via Guix-patches via
@ 2022-06-23 15:35   ` Maxim Cournoyer
  2022-06-24  8:31     ` Raghav Gururajan via Guix-patches via
  0 siblings, 1 reply; 18+ messages in thread
From: Maxim Cournoyer @ 2022-06-23 15:35 UTC (permalink / raw)
  To: Raghav Gururajan; +Cc: Ricardo Wurmus, 49934-done, 50283-done

Hi,

Raghav Gururajan <rg@raghavgururajan.name> writes:

> Hi Ricardo!
>
>> --8<---------------cut here---------------start------------->8---
>> (substitute* "hw-probe.pl"
>>    (("Cmd\\(\"([^\"]+)" _ command)
>>     (string-append "Cmd(\"" (which command))))
>> --8<---------------cut here---------------end--------------->8---
>
> Thanks for the snippet and explanation.
>
> I am wondering these,
> [1] Does require import of specific modules?

No.  `which', the Scheme procedure, is part of (guix build utils).

> [2] If `(which command)`'s output is empty, will it return #f?

Yes, and I agree that's a problem.

Fortunately, the recently added search-input-file more usefully raises
an error when the file it is looking for doesn't exist, so I used that.

It was a bit painful to hunt all the commands but in the end it works
beautifully!  I pushed the result as
3611f99affc4d2edcf4141e3022dd0d2a0b04068.

Closing, thanks!

Maxim




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#50283] HwInfo
  2022-06-23 15:35   ` [bug#50283] HwInfo Maxim Cournoyer
@ 2022-06-24  8:31     ` Raghav Gururajan via Guix-patches via
  0 siblings, 0 replies; 18+ messages in thread
From: Raghav Gururajan via Guix-patches via @ 2022-06-24  8:31 UTC (permalink / raw)
  To: Maxim Cournoyer; +Cc: Ricardo Wurmus, 49934-done, 50283-done


[-- Attachment #1.1: Type: text/plain, Size: 420 bytes --]

Maxim,

> Yes, and I agree that's a problem.
> 
> Fortunately, the recently added search-input-file more usefully raises
> an error when the file it is looking for doesn't exist, so I used that.
> 
> It was a bit painful to hunt all the commands but in the end it works
> beautifully!  I pushed the result as
> 3611f99affc4d2edcf4141e3022dd0d2a0b04068.
> 
> Closing, thanks!

Thank a lot.

Regards,
RG.

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-06-24  8:39 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30 19:31 [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
2021-08-30 19:35 ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
2021-08-30 19:35   ` [bug#50283] [PATCH v1 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
2021-08-30 23:13   ` [bug#50283] [PATCH v1 1/2] gnu: Add libx86emu pelzflorian (Florian Pelz)
2021-08-30 23:27     ` [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
2021-08-31  9:35       ` pelzflorian (Florian Pelz)
2021-08-31  9:41         ` pelzflorian (Florian Pelz)
2021-08-31  9:48           ` pelzflorian (Florian Pelz)
2021-08-30 22:27 ` [bug#50283] [PATCH v2 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
2021-08-30 22:27   ` [bug#50283] [PATCH v2 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
2021-08-30 23:33 ` [bug#50283] [PATCH v3 1/2] gnu: Add libx86emu Raghav Gururajan via Guix-patches via
2021-08-30 23:33   ` [bug#50283] [PATCH v3 2/2] gnu: Add hwinfo Raghav Gururajan via Guix-patches via
2021-08-31 11:18     ` phodina via Guix-patches via
2021-09-01  1:28       ` Raghav Gururajan via Guix-patches via
2021-09-18 12:59 ` [bug#50283] Patch status phodina via Guix-patches via
2021-10-01 23:30 ` [bug#50283] HwInfo Raghav Gururajan via Guix-patches via
  -- strict thread matches above, loose matches on Subject: below --
2021-12-16  5:53 [bug#49934] Hw-Probe Ricardo Wurmus
2021-12-25 21:17 ` Raghav Gururajan via Guix-patches via
2022-06-23 15:35   ` [bug#50283] HwInfo Maxim Cournoyer
2022-06-24  8:31     ` Raghav Gururajan via Guix-patches via

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).