gnu: pciutils: Support the 64bit Hurd.

* gnu/packages/patches/pciutils-hurd64.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/pciutils.scm (pciutils)[arguments]: Use g-expressions.  When
building for the 64bit Hurd, use it in new "apply-hurd64-patch" phase.

Change-Id: I8936377da726681b748cc010e1fbae3fb19dee05
This commit is contained in:
Janneke Nieuwenhuizen 2024-11-07 15:19:52 +01:00
parent 82e8ef994c
commit 5482403f35
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
3 changed files with 49 additions and 8 deletions

View file

@ -1916,6 +1916,7 @@ dist_patch_DATA = \
%D%/packages/patches/pam-krb5-CVE-2020-10595.patch \ %D%/packages/patches/pam-krb5-CVE-2020-10595.patch \
%D%/packages/patches/pango-skip-libthai-test.patch \ %D%/packages/patches/pango-skip-libthai-test.patch \
%D%/packages/patches/password-store-tree-compat.patch \ %D%/packages/patches/password-store-tree-compat.patch \
%D%/packages/patches/pciutils-hurd64.patch \
%D%/packages/patches/pdfpc-build-with-vala-0.56.patch \ %D%/packages/patches/pdfpc-build-with-vala-0.56.patch \
%D%/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch \ %D%/packages/patches/petri-foo-0.1.87-fix-recent-file-not-exist.patch \
%D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \ %D%/packages/patches/plasma-framework-fix-KF5PlasmaMacros.cmake.patch \

View file

@ -0,0 +1,31 @@
Upstream-status: Not presented upstream.
--- pciutils-3.8.0/lib/hurd.c.orig 2024-11-07 15:09:20.728973822 +0100
+++ pciutils-3.8.0/lib/hurd.c 2024-11-07 15:05:08.524682813 +0100
@@ -213,7 +213,7 @@
hurd_read(struct pci_dev *d, int pos, byte * buf, int len)
{
int err;
- size_t nread;
+ mach_msg_type_number_t nread;
char *data;
mach_port_t device_port = device_port_lookup(d);
@@ -266,7 +266,7 @@
mach_port_t device_port = device_port_lookup(d);
struct pci_bar regions[6];
char *buf = (char *) &regions;
- size_t size = sizeof(regions);
+ mach_msg_type_number_t size = sizeof(regions);
int err = pci_get_dev_regions(device_port, &buf, &size);
if (err)
@@ -305,7 +305,7 @@
struct pci_xrom_bar rom;
mach_port_t device_port = device_port_lookup(d);
char *buf = (char *) &rom;
- size_t size = sizeof(rom);
+ mach_msg_type_number_t size = sizeof(rom);
int err = pci_get_dev_rom(device_port, &buf, &size);
if (err)

View file

@ -3,7 +3,7 @@
;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il> ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr> ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com> ;;; Copyright © 2019 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020, 2023 Janneke Nieuwenhuizen <janneke@gnu.org> ;;; Copyright © 2020, 2023, 2024 Janneke Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot> ;;; Copyright © 2022 Brendan Tildesley <mail@brendan.scot>
;;; Copyright © 2022 Marius Bakke <marius@gnu.org> ;;; Copyright © 2022 Marius Bakke <marius@gnu.org>
;;; ;;;
@ -81,25 +81,34 @@ Each database is contained in a specific package output, such as the
"01aglgw9ds9qiswcbi2lx90lswncikrlyv8mmp4haix8542bvvci")))) "01aglgw9ds9qiswcbi2lx90lswncikrlyv8mmp4haix8542bvvci"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments (arguments
`(#:phases (list
(modify-phases %standard-phases #:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'unbundle-pci.ids (add-after 'unpack 'unbundle-pci.ids
(lambda* (#:key native-inputs inputs #:allow-other-keys) (lambda* (#:key native-inputs inputs #:allow-other-keys)
(copy-file (search-input-file (or native-inputs inputs) (copy-file (search-input-file (or native-inputs inputs)
"share/hwdata/pci.ids") "share/hwdata/pci.ids")
"pci.ids"))) "pci.ids")))
#$@(if (target-hurd64?)
#~((add-after 'unpack 'apply-hurd64-patch
(lambda _
(let ((patch-file
#$(local-file
(search-patch "pciutils-hurd64.patch"))))
(invoke "patch" "--force" "-p1" "-i" patch-file)))))
#~())
(replace 'configure (replace 'configure
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
;; There's no 'configure' script, just a raw makefile. ;; There's no 'configure' script, just a raw makefile.
(substitute* "Makefile" (substitute* "Makefile"
,@(if (%current-target-system) #$@(if (%current-target-system)
`((("^CROSS_COMPILE=.*$") #~((("^CROSS_COMPILE=.*$")
(string-append "CROSS_COMPILE=" (string-append "CROSS_COMPILE="
,(%current-target-system) "-" #$(%current-target-system) "-"
"\n")) "\n"))
(("^HOST=.*$") (("^HOST=.*$")
(string-append "HOST=" (string-append "HOST="
,(gnu-triplet->nix-system #$(gnu-triplet->nix-system
(%current-target-system)) "\n")) (%current-target-system)) "\n"))
;; Disable 'install' strip option, that would fail when ;; Disable 'install' strip option, that would fail when
;; we are cross-compiling. ;; we are cross-compiling.
@ -139,7 +148,7 @@ Each database is contained in a specific package output, such as the
(invoke "make" "install" "install-lib")))) (invoke "make" "install" "install-lib"))))
;; Make sure programs have an RPATH so they can find libpciutils.so. ;; Make sure programs have an RPATH so they can find libpciutils.so.
#:make-flags (list ,(string-append "CC=" #:make-flags #~(list #$(string-append "CC="
(if (%current-target-system) (if (%current-target-system)
(cc-for-target) (cc-for-target)
"gcc")) "gcc"))