gnu: python-deepmerge: Use pyproject-build-system.
[jackhill/guix/guix.git] / gnu / packages / pciutils.scm
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>
8 ;;;
9 ;;; This file is part of GNU Guix.
10 ;;;
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.
15 ;;;
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.
20 ;;;
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/>.
23
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))
38
39 (define-public hwdata
40 (package
41 (name "hwdata")
42 (version "0.357") ;updated monthly
43 (source (origin
44 (method git-fetch)
45 (uri (git-reference
46 (url "https://github.com/vcrhonek/hwdata")
47 (commit (string-append "v" version))))
48 (file-name (git-file-name name version))
49 (sha256
50 (base32
51 "0kvxpdx14w2myqm3dikjvr2mr4j6767y4v5j8v7kffwvcv0ga9gv"))))
52 (build-system gnu-build-system)
53 (outputs '("out" "iab" "oui" "pci" "pnp" "usb"))
54 (arguments
55 ;; Tests require pciutils, python, podman. Disable to avoid recursive dep.
56 (list
57 #:tests? #f
58 ;; Do not cross-compile, since the package only contains data.
59 #:target #f
60 #:configure-flags #~(list (string-append "--datadir=" #$output "/share"))
61 #:phases
62 #~(modify-phases %standard-phases
63 (replace 'install
64 (lambda _
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
79
80 (define-public pciutils
81 (package
82 (name "pciutils")
83 (version "3.7.0")
84 (source (origin
85 (method url-fetch)
86 (uri (string-append
87 "mirror://kernel.org/software/utils/pciutils/pciutils-"
88 version ".tar.xz"))
89 (patches (search-patches "pciutils-hurd-configure.patch"))
90 (sha256
91 (base32
92 "1ss0rnfsx8gvqjxaji4mvbhf9xyih4cadmgadbwwv8mnx1xvjh4x"))))
93 (build-system gnu-build-system)
94 (arguments
95 `(#:phases
96 (modify-phases %standard-phases
97 (replace 'configure
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) "-"
105 "\n"))
106 (("^HOST=.*$")
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.
112 (("^STRIP=.*$")
113 "STRIP=\n"))
114 '())
115 (("^PREFIX=.*$")
116 (string-append "PREFIX := " (assoc-ref outputs "out")
117 "\n"))
118 (("^MANDIR:=.*$")
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")
123 "/share/man\n"))
124
125 (("^SHARED=.*$")
126 ;; Build libpciutils.so.
127 "SHARED := yes\n")
128 (("^ZLIB=.*$")
129 ;; Ask for zlib support, for 'pci.ids.gz' decompression.
130 "ZLIB := yes\n")
131
132 (("^IDSDIR=.*$")
133 ;; Installation directory of 'pci.ids.gz'.
134 "IDSDIR = $(SHAREDIR)/hwdata\n"))))
135 (replace 'install
136 (lambda* (#:key outputs #:allow-other-keys)
137 ;; Install the commands, library, and .pc files.
138 (invoke "make" "install" "install-lib")))
139
140 ,@(if (hurd-target?)
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"
145 patch)))))
146 '()))
147
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"))
151
152 ;; No test suite.
153 #:tests? #f))
154 (native-inputs
155 (list which pkg-config))
156 (inputs
157 `(,@(if (not (hurd-target?))
158 `(("kmod" ,kmod))
159 '())
160 ,@(if (hurd-target?)
161 `(("hurd-patch" ,(search-patch "pciutils-hurd-fix.patch")))
162 '())
163 ("zlib" ,zlib)))
164 (home-page "https://mj.ucw.cz/sw/pciutils/")
165 (synopsis "Programs for inspecting and manipulating PCI devices")
166 (description
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}
171 commands.")
172 (license license:gpl2+)))