Commit | Line | Data |
---|---|---|
42422cc2 | 1 | ;;; GNU Guix --- Functional package management for GNU |
3d85c3ec | 2 | ;;; Copyright © 2014, 2015, 2017, 2020 Ludovic Courtès <ludo@gnu.org> |
fb3c8553 | 3 | ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il> |
280b62b0 | 4 | ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
6eae9089 | 5 | ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com> |
22ee7209 | 6 | ;;; Copyright © 2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org> |
42422cc2 LC |
7 | ;;; |
8 | ;;; This file is part of GNU Guix. | |
9 | ;;; | |
10 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
11 | ;;; under the terms of the GNU General Public License as published by | |
12 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
13 | ;;; your option) any later version. | |
14 | ;;; | |
15 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
16 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | ;;; GNU General Public License for more details. | |
19 | ;;; | |
20 | ;;; You should have received a copy of the GNU General Public License | |
21 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
22 | ||
23 | (define-module (gnu packages pciutils) | |
24 | #:use-module (guix packages) | |
25 | #:use-module (guix download) | |
b5b73a82 | 26 | #:use-module ((guix licenses) #:prefix license:) |
6eae9089 | 27 | #:use-module (guix utils) |
42422cc2 | 28 | #:use-module (guix build-system gnu) |
22ee7209 | 29 | #:use-module (gnu packages) |
42422cc2 LC |
30 | #:use-module (gnu packages compression) |
31 | #:use-module (gnu packages pkg-config) | |
22ee7209 | 32 | #:use-module (gnu packages hurd) |
43ec6ca0 | 33 | #:use-module (gnu packages linux) |
ce0614dd | 34 | #:use-module (gnu packages base)) |
42422cc2 LC |
35 | |
36 | (define-public pciutils | |
37 | (package | |
38 | (name "pciutils") | |
def9a2ce | 39 | (version "3.7.0") |
42422cc2 LC |
40 | (source (origin |
41 | (method url-fetch) | |
42 | (uri (string-append | |
43 | "mirror://kernel.org/software/utils/pciutils/pciutils-" | |
fb3c8553 | 44 | version ".tar.xz")) |
22ee7209 | 45 | (patches (search-patches "pciutils-hurd-configure.patch")) |
42422cc2 LC |
46 | (sha256 |
47 | (base32 | |
def9a2ce | 48 | "1ss0rnfsx8gvqjxaji4mvbhf9xyih4cadmgadbwwv8mnx1xvjh4x")))) |
42422cc2 LC |
49 | (build-system gnu-build-system) |
50 | (arguments | |
6eae9089 | 51 | `(#:phases |
0ef7a93d EF |
52 | (modify-phases %standard-phases |
53 | (replace 'configure | |
54 | (lambda* (#:key outputs #:allow-other-keys) | |
55 | ;; There's no 'configure' script, just a raw makefile. | |
56 | (substitute* "Makefile" | |
6eae9089 MO |
57 | ,@(if (%current-target-system) |
58 | `((("^CROSS_COMPILE=.*$") | |
59 | (string-append "CROSS_COMPILE=" | |
60 | ,(%current-target-system) "-" | |
61 | "\n")) | |
62 | (("^HOST=.*$") | |
63 | (string-append "HOST=" | |
64 | ,(gnu-triplet->nix-system | |
65 | (%current-target-system)) "\n")) | |
66 | ;; Disable 'install' strip option, that would fail when | |
67 | ;; we are cross-compiling. | |
68 | (("^STRIP=.*$") | |
69 | "STRIP=\n")) | |
70 | '()) | |
0ef7a93d EF |
71 | (("^PREFIX=.*$") |
72 | (string-append "PREFIX := " (assoc-ref outputs "out") | |
73 | "\n")) | |
74 | (("^MANDIR:=.*$") | |
75 | ;; By default the thing tries to automatically | |
76 | ;; determine whether to use $prefix/man or | |
77 | ;; $prefix/share/man, and wrongly so. | |
78 | (string-append "MANDIR := " (assoc-ref outputs "out") | |
79 | "/share/man\n")) | |
841e06af | 80 | |
0ef7a93d EF |
81 | (("^SHARED=.*$") |
82 | ;; Build libpciutils.so. | |
83 | "SHARED := yes\n") | |
84 | (("^ZLIB=.*$") | |
841e06af LC |
85 | ;; Ask for zlib support, for 'pci.ids.gz' decompression. |
86 | "ZLIB := yes\n") | |
87 | ||
88 | (("^IDSDIR=.*$") | |
89 | ;; Installation directory of 'pci.ids.gz'. | |
90 | "IDSDIR = $(SHAREDIR)/hwdata\n")) | |
91 | #t)) | |
0ef7a93d EF |
92 | (replace 'install |
93 | (lambda* (#:key outputs #:allow-other-keys) | |
94 | ;; Install the commands, library, and .pc files. | |
3d85c3ec LC |
95 | (invoke "make" "install" "install-lib"))) |
96 | ||
97 | ,@(if (hurd-target?) | |
98 | '((add-after 'unpack 'apply-hurd-patch | |
99 | (lambda* (#:key inputs #:allow-other-keys) | |
100 | (let ((patch (assoc-ref inputs "hurd-patch"))) | |
101 | (invoke "patch" "-p1" "--batch" "-i" | |
102 | patch))))) | |
103 | '())) | |
42422cc2 LC |
104 | |
105 | ;; Make sure programs have an RPATH so they can find libpciutils.so. | |
106 | #:make-flags (list (string-append "LDFLAGS=-Wl,-rpath=" | |
107 | (assoc-ref %outputs "out") "/lib")) | |
108 | ||
109 | ;; No test suite. | |
110 | #:tests? #f)) | |
111 | (native-inputs | |
112 | `(("which" ,which) | |
113 | ("pkg-config" ,pkg-config))) | |
114 | (inputs | |
22ee7209 JN |
115 | `(,@(if (member (or (%current-target-system) |
116 | (%current-system)) | |
117 | (package-supported-systems kmod)) | |
118 | `(("kmod" ,kmod)) | |
119 | '()) | |
3d85c3ec LC |
120 | ,@(if (hurd-target?) |
121 | `(("hurd-patch" ,(search-patch "pciutils-hurd-fix.patch"))) | |
122 | '()) | |
43ec6ca0 | 123 | ("zlib" ,zlib))) |
8af77fe9 | 124 | (home-page "https://mj.ucw.cz/sw/pciutils/") |
42422cc2 LC |
125 | (synopsis "Programs for inspecting and manipulating PCI devices") |
126 | (description | |
127 | "The PCI Utilities are a collection of programs for inspecting and | |
128 | manipulating configuration of PCI devices, all based on a common portable | |
129 | library libpci which offers access to the PCI configuration space on a variety | |
a48da398 LC |
130 | of operating systems. This includes the @command{lspci} and @command{setpci} |
131 | commands.") | |
42422cc2 | 132 | (license license:gpl2+))) |