| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2014, 2015, 2017 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 | ;;; |
| 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) |
| 26 | #:use-module ((guix licenses) #:prefix license:) |
| 27 | #:use-module (guix utils) |
| 28 | #:use-module (guix build-system gnu) |
| 29 | #:use-module (gnu packages) |
| 30 | #:use-module (gnu packages compression) |
| 31 | #:use-module (gnu packages pkg-config) |
| 32 | #:use-module (gnu packages hurd) |
| 33 | #:use-module (gnu packages linux) |
| 34 | #:use-module (gnu packages base)) |
| 35 | |
| 36 | (define-public pciutils |
| 37 | (package |
| 38 | (name "pciutils") |
| 39 | (version "3.6.4") |
| 40 | (source (origin |
| 41 | (method url-fetch) |
| 42 | (uri (string-append |
| 43 | "mirror://kernel.org/software/utils/pciutils/pciutils-" |
| 44 | version ".tar.xz")) |
| 45 | (patches (search-patches "pciutils-hurd-configure.patch")) |
| 46 | (sha256 |
| 47 | (base32 |
| 48 | "0mb0f2phdcmp4kfiqsszn2k6nlln0w160ffzrjjv4bbfjwrgfzzn")))) |
| 49 | (build-system gnu-build-system) |
| 50 | (arguments |
| 51 | `(#:phases |
| 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" |
| 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 | '()) |
| 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")) |
| 80 | |
| 81 | (("^SHARED=.*$") |
| 82 | ;; Build libpciutils.so. |
| 83 | "SHARED := yes\n") |
| 84 | (("^ZLIB=.*$") |
| 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)) |
| 92 | (replace 'install |
| 93 | (lambda* (#:key outputs #:allow-other-keys) |
| 94 | ;; Install the commands, library, and .pc files. |
| 95 | (invoke "make" "install" "install-lib")))) |
| 96 | |
| 97 | ;; Make sure programs have an RPATH so they can find libpciutils.so. |
| 98 | #:make-flags (list (string-append "LDFLAGS=-Wl,-rpath=" |
| 99 | (assoc-ref %outputs "out") "/lib")) |
| 100 | |
| 101 | ;; No test suite. |
| 102 | #:tests? #f)) |
| 103 | (native-inputs |
| 104 | `(("which" ,which) |
| 105 | ("pkg-config" ,pkg-config))) |
| 106 | (inputs |
| 107 | `(,@(if (member (or (%current-target-system) |
| 108 | (%current-system)) |
| 109 | (package-supported-systems kmod)) |
| 110 | `(("kmod" ,kmod)) |
| 111 | '()) |
| 112 | ("zlib" ,zlib))) |
| 113 | (home-page "https://mj.ucw.cz/sw/pciutils/") |
| 114 | (synopsis "Programs for inspecting and manipulating PCI devices") |
| 115 | (description |
| 116 | "The PCI Utilities are a collection of programs for inspecting and |
| 117 | manipulating configuration of PCI devices, all based on a common portable |
| 118 | library libpci which offers access to the PCI configuration space on a variety |
| 119 | of operating systems. This includes the @command{lspci} and @command{setpci} |
| 120 | commands.") |
| 121 | (license license:gpl2+))) |