(use-modules (guix packages) (gnu packages) (gnu packages gtk) (gnu packages glib) (guix gexp)
(gnu packages gnome) (gnu packages xml) (gnu packages virtualization)
(gnu packages pkg-config) (guix git-download) (guix build-system gnu)
(guix build-system meson) (gnu packages compression) (ice-9 match)
(guix monads) (guix store) (guix derivations)
((guix licenses) #:prefix license:))
(define <gexp-input> (@@ (guix gexp) <gexp-input>))
(define-gexp-compiler gexp-input-compiler <gexp-input>
compiler => (lambda (input system target)
(lower-object (gexp-input-thing input) system
#:target
(and (not (gexp-input-native? input)) target)))
expander => (lambda (object lowered output)
(derivation->output-path lowered (gexp-input-output object))))
(define-public hwdata
(package
(name "hwdata")
(version "0.356")
(source (origin
(method git-fetch)
(uri (git-reference
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32
"0m04d93dwiplwp9v74nhnc0hyi2n007mylkg8f0frb46z5qjrpl3"))))
(build-system gnu-build-system)
(outputs '("out" "iab" "oui" "pci" "pnp" "usb"))
(native-inputs (list gzip))
(arguments
;; Tests require pciutils, python, podman. Disable to avoid recursive dep.
(list
#:tests? #f
#:configure-flags #~(list (string-append "--datadir=" #$output "/share"))
#:phases
#~(modify-phases %standard-phases
(replace 'install
(lambda _
(install-file "iab.txt" (string-append #$output:iab "/share/hwdata"))
(install-file "oui.txt" (string-append #$output:oui "/share/hwdata"))
(install-file "pci.ids" (string-append #$output:pci "/share/hwdata"))
(install-file "pnp.ids" (string-append #$output:pnp "/share/hwdata"))
(install-file "usb.ids" (string-append #$output:usb "/share/hwdata")))))))
(synopsis "Hardware identification and configuration data")
(description "@code{hwdata} contains various hardware identification and
configuration data, such as the @file{pci.ids} and @file{usb.ids} databases.")
(license (list license:gpl2+
license:expat)))) ;XFree86 1.0
(define* (package-input-list->build-input-list inputs native?)
"Expand INPUTS, a list of input tuples, into a list of name/<gexp-input>
tulples."
#~'#$(map (match-lambda
((name object output)
#~(#$name . #$(gexp-input object output #:native? native?)))
((name object) #~(#$name . #$object)))
inputs))
(define-syntax this-package-input-list
(identifier-syntax
(package-input-list->build-input-list
(append (package-inputs this-package)
(package-propagated-inputs this-package))
#false)))
(define-syntax this-package-native-input-list
(identifier-syntax
(package-input-list->build-input-list
(package-native-inputs this-package) #true)))
(define libosinfo-new
(package
(inherit (specification->package "libosinfo"))
(arguments
(list #:configure-flags
#~(let* ((inputs #$this-package-native-input-list)
(usb.ids (search-input-file inputs "/share/hwdata/usb.ids"))
(pci.ids (search-input-file inputs "/share/hwdata/pci.ids")))
(list (string-append "-Dwith-usb-ids-path=" usb.ids)
(string-append "-Dwith-pci-ids-path=" pci.ids)))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-osinfo-path
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "osinfo/osinfo_loader.c"
(("path = DATA_DIR.*")
(string-append "path = \"" (search-input-directory inputs "/share/osinfo") "\";"))))))))
(inputs
(list libsoup-minimal-2 libxml2 libxslt osinfo-db))
(native-inputs
(list `(,glib "bin")
gobject-introspection
gtk-doc/stable
vala
intltool
pkg-config
`(,hwdata "pci")
`(,hwdata "usb")))))
libosinfo-new