projects/guix·blob java-team · refs

166 lines · 6.8 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2014, 2015, 2017, 2020 Ludovic Courtès <[email protected]>
3;;; Copyright © 2016 Efraim Flashner <[email protected]>
4;;; Copyright © 2018 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2019 Mathieu Othacehe <[email protected]>
6;;; Copyright © 2020, 2023, 2024 Janneke Nieuwenhuizen <[email protected]>
7;;; Copyright © 2022 Brendan Tildesley <[email protected]>
8;;; Copyright © 2022 Marius Bakke <[email protected]>
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages pciutils)
26 #:use-module (guix gexp)
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module ((guix licenses) #:prefix license:)
30 #:use-module (guix utils)
31 #:use-module (guix git-download)
32 #:use-module (guix build-system gnu)
33 #:use-module (gnu packages)
34 #:use-module (gnu packages compression)
35 #:use-module (gnu packages pkg-config)
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.392") ;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 "1kp5gs2ld1a8mcq03w9s7kmwi9fq7s01pkll8namkh2rysh4yfqf"))))
52 (build-system gnu-build-system)
53 (arguments
54 ;; Tests require pciutils, python, podman. Disable to avoid recursive dep.
55 (list
56 #:tests? #f
57 ;; Do not cross-compile, since the package only contains data.
58 #:target #f
59 #:configure-flags #~(list (string-append "--datadir=" #$output "/share"))))
60 (home-page "https://github.com/vcrhonek/hwdata")
61 (synopsis "Hardware identification and configuration data")
62 (description "@code{hwdata} contains various hardware identification and
63configuration data, such as the @file{pci.ids} and @file{usb.ids} databases.
64Each database is contained in a specific package output, such as the
65@code{pci} output for @file{pci.ids}, the @code{usb} output for
66@file{usb.ids}, etc.")
67 (license (list license:gpl2+
68 license:expat)))) ;XFree86 1.0
69
70(define-public pciutils
71 (package
72 (name "pciutils")
73 (version "3.13.0")
74 (source (origin
75 (method url-fetch)
76 (uri (string-append
77 "mirror://kernel.org/software/utils/pciutils/pciutils-"
78 version ".tar.xz"))
79 (sha256
80 (base32
81 "09j9rfjaw2ahdwvvlp7ldjgn522pbbqhh0zm396n60l555w1zwbp"))
82 (patches (search-patches "pciutils-hurd64.patch"))))
83 (build-system gnu-build-system)
84 (arguments
85 (list
86 #:phases
87 #~(modify-phases %standard-phases
88 (add-after 'unpack 'unbundle-pci.ids
89 (lambda* (#:key native-inputs inputs #:allow-other-keys)
90 (copy-file (search-input-file (or native-inputs inputs)
91 "share/hwdata/pci.ids")
92 "pci.ids")))
93 (replace 'configure
94 (lambda _
95 ;; There's no 'configure' script, just a raw makefile.
96 (substitute* "Makefile"
97 #$@(if (%current-target-system)
98 #~((("^CROSS_COMPILE=.*$")
99 (string-append "CROSS_COMPILE="
100 #$(%current-target-system) "-"
101 "\n"))
102 (("^HOST=.*$")
103 (string-append "HOST="
104 #$(gnu-triplet->nix-system
105 (%current-target-system)) "\n"))
106 ;; Disable 'install' strip option, that would fail when
107 ;; we are cross-compiling.
108 (("^STRIP=.*$")
109 "STRIP=\n"))
110 '())
111 (("^PREFIX=.*$")
112 (string-append "PREFIX := " #$output
113 "\n"))
114 (("^MANDIR:=.*$")
115 ;; By default the thing tries to automatically
116 ;; determine whether to use $prefix/man or
117 ;; $prefix/share/man, and wrongly so.
118 (string-append "MANDIR := " #$output
119 "/share/man\n"))
120
121 (("^SHARED=.*$")
122 ;; Build libpciutils.so.
123 "SHARED := yes\n")
124
125 (("^ZLIB=.*$")
126 ;; Ask for zlib support, for 'pci.ids.gz' decompression.
127 "ZLIB := yes\n")
128
129 (("^IDSDIR=.*$")
130 ;; Installation directory of 'pci.ids.gz'.
131 "IDSDIR = $(SHAREDIR)/hwdata\n")
132
133 ;; Do not install the update script nor its man page.
134 ((".*INSTALL.*update-pciids .*") "")
135 (("update-pciids update-pciids.8 ") "")
136 (("(.*INSTALL.*)update-pciids.8(.*)" _ head tail)
137 (string-append head tail)))))
138 (replace 'install
139 (lambda _
140 ;; Install the commands, library, and .pc files.
141 (invoke "make" "install" "install-lib"))))
142
143 ;; Make sure programs have an RPATH so they can find libpciutils.so.
144 #:make-flags
145 #~(list #$(string-append "CC=" (cc-for-target))
146 (string-append "LDFLAGS=-Wl,-rpath=" #$output "/lib"))
147
148 ;; No test suite.
149 #:tests? #f))
150 (native-inputs
151 (list hwdata pkg-config which))
152 (inputs
153 (append
154 (if (not (target-hurd?))
155 (list kmod)
156 '())
157 (list zlib)))
158 (home-page "https://mj.ucw.cz/sw/pciutils/")
159 (synopsis "Programs for inspecting and manipulating PCI devices")
160 (description
161 "The PCI Utilities are a collection of programs for inspecting and
162manipulating configuration of PCI devices, all based on a common portable
163library libpci which offers access to the PCI configuration space on a variety
164of operating systems. This includes the @command{lspci} and @command{setpci}
165commands.")
166 (license license:gpl2+)))