1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014, 2015, 2017, 2020 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
5 ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
6 ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
7 ;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages pciutils)
25 #:use-module (guix gexp)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix utils)
30 #:use-module (guix git-download)
31 #:use-module (guix build-system gnu)
32 #:use-module (gnu packages)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages pkg-config)
35 #:use-module (gnu packages hurd)
36 #:use-module (gnu packages linux)
37 #:use-module (gnu packages base))
42 (version "0.357") ;updated monthly
46 (url "https://github.com/vcrhonek/hwdata")
47 (commit (string-append "v" version))))
48 (file-name (git-file-name name version))
51 "0kvxpdx14w2myqm3dikjvr2mr4j6767y4v5j8v7kffwvcv0ga9gv"))))
52 (build-system gnu-build-system)
53 (outputs '("out" "iab" "oui" "pci" "pnp" "usb"))
55 ;; Tests require pciutils, python, podman. Disable to avoid recursive dep.
58 ;; Do not cross-compile, since the package only contains data.
60 #:configure-flags #~(list (string-append "--datadir=" #$output "/share"))
62 #~(modify-phases %standard-phases
65 (install-file "iab.txt" (string-append #$output:iab "/share/hwdata"))
66 (install-file "oui.txt" (string-append #$output:oui "/share/hwdata"))
67 (install-file "pci.ids" (string-append #$output:pci "/share/hwdata"))
68 (install-file "pnp.ids" (string-append #$output:pnp "/share/hwdata"))
69 (install-file "usb.ids" (string-append #$output:usb "/share/hwdata")))))))
70 (home-page "https://github.com/vcrhonek/hwdata")
71 (synopsis "Hardware identification and configuration data")
72 (description "@code{hwdata} contains various hardware identification and
73 configuration data, such as the @file{pci.ids} and @file{usb.ids} databases.
74 Each database is contained in a specific package output, such as the
75 @code{pci} output for @file{pci.ids}, the @code{usb} output for
76 @file{usb.ids}, etc.")
77 (license (list license:gpl2+
78 license:expat)))) ;XFree86 1.0
80 (define-public pciutils
87 "mirror://kernel.org/software/utils/pciutils/pciutils-"
89 (patches (search-patches "pciutils-hurd-configure.patch"))
92 "1ss0rnfsx8gvqjxaji4mvbhf9xyih4cadmgadbwwv8mnx1xvjh4x"))))
93 (build-system gnu-build-system)
96 (modify-phases %standard-phases
98 (lambda* (#:key outputs #:allow-other-keys)
99 ;; There's no 'configure' script, just a raw makefile.
100 (substitute* "Makefile"
101 ,@(if (%current-target-system)
102 `((("^CROSS_COMPILE=.*$")
103 (string-append "CROSS_COMPILE="
104 ,(%current-target-system) "-"
107 (string-append "HOST="
108 ,(gnu-triplet->nix-system
109 (%current-target-system)) "\n"))
110 ;; Disable 'install' strip option, that would fail when
111 ;; we are cross-compiling.
116 (string-append "PREFIX := " (assoc-ref outputs "out")
119 ;; By default the thing tries to automatically
120 ;; determine whether to use $prefix/man or
121 ;; $prefix/share/man, and wrongly so.
122 (string-append "MANDIR := " (assoc-ref outputs "out")
126 ;; Build libpciutils.so.
129 ;; Ask for zlib support, for 'pci.ids.gz' decompression.
133 ;; Installation directory of 'pci.ids.gz'.
134 "IDSDIR = $(SHAREDIR)/hwdata\n"))))
136 (lambda* (#:key outputs #:allow-other-keys)
137 ;; Install the commands, library, and .pc files.
138 (invoke "make" "install" "install-lib")))
141 '((add-after 'unpack 'apply-hurd-patch
142 (lambda* (#:key inputs #:allow-other-keys)
143 (let ((patch (assoc-ref inputs "hurd-patch")))
144 (invoke "patch" "-p1" "--batch" "-i"
148 ;; Make sure programs have an RPATH so they can find libpciutils.so.
149 #:make-flags (list (string-append "LDFLAGS=-Wl,-rpath="
150 (assoc-ref %outputs "out") "/lib"))
155 (list which pkg-config))
157 `(,@(if (not (hurd-target?))
161 `(("hurd-patch" ,(search-patch "pciutils-hurd-fix.patch")))
164 (home-page "https://mj.ucw.cz/sw/pciutils/")
165 (synopsis "Programs for inspecting and manipulating PCI devices")
167 "The PCI Utilities are a collection of programs for inspecting and
168 manipulating configuration of PCI devices, all based on a common portable
169 library libpci which offers access to the PCI configuration space on a variety
170 of operating systems. This includes the @command{lspci} and @command{setpci}
172 (license license:gpl2+)))