Subject: [PATCH xorg-updates 018/109] gnu: libpciaccess: Update to 0.18.1.

From: [email-masked]
Date: Sat, 28 Dec 2024 19:14:49 +0800

From: 宋文武 <[email-masked]>

* gnu/packages/xorg.scm (libpciaccess): Update to 0.18.1.
Switch to meson-build-system.
(libpciaccess-0.17): Remove package.
* gnu/packages/patches/libpciaccess-hurd64.patch: Remove patch.
* gnu/local.mk (dist_patch_DATA): Remove it.
* gnu/packages/hurd.scm (hurd, netdde, rumpkernel): Use libpciaccess.

Change-Id: I12c2ca80f7e9e404d80303b326bcfd36a8839723
---
 gnu/local.mk                                  |  1 -
 gnu/packages/hurd.scm                         |  8 +--
 .../patches/libpciaccess-hurd64.patch         | 58 -------------------
 gnu/packages/xorg.scm                         | 58 ++++---------------
 4 files changed, 16 insertions(+), 109 deletions(-)
 delete mode 100644 gnu/packages/patches/libpciaccess-hurd64.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 84160f407a..90a4896fa1 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1731,7 +1731,6 @@ dist_patch_DATA =						\
   %D%/packages/patches/libmpeg2-global-symbol-test.patch	\
   %D%/packages/patches/libmygpo-qt-fix-qt-5.11.patch		\
   %D%/packages/patches/libmygpo-qt-missing-qt5-modules.patch	\
-  %D%/packages/patches/libpciaccess-hurd64.patch		\
   %D%/packages/patches/libphonenumber-reproducible-build.patch	\
   %D%/packages/patches/libqalculate-3.8.0-libcurl-ssl-fix.patch	\
   %D%/packages/patches/libquicktime-ffmpeg.patch 		\
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 4342686517..7a7f621e40 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -48,7 +48,7 @@ (define-module (gnu packages hurd)
   #:use-module (gnu packages bash)
   #:use-module (gnu packages texinfo)
   #:use-module (gnu packages onc-rpc)
-  #:use-module (gnu packages xorg) ;libpciaccess-0.17
+  #:use-module (gnu packages xorg) ;libpciaccess
   #:use-module (guix git-download)
   #:use-module (ice-9 match))
 
@@ -572,7 +572,7 @@ (define-public hurd
      `(("libgcrypt" ,libgcrypt)                  ;for /hurd/random
        ("libdaemon" ,libdaemon)                  ;for /bin/console --daemonize
        ("unifont" ,unifont)
-       ("libpciaccess" ,libpciaccess-0.17)       ;need libpciaccess > 0.16
+       ("libpciaccess" ,libpciaccess)
 
        ;; For NFS support
        ("libtirpc" ,libtirpc/hurd)
@@ -700,7 +700,7 @@ (define-public netdde
                  (install-file "netdde" hurd)
                  (install-file "netdde.static" hurd)))))))
       (inputs
-       (list hurd libpciaccess-0.17 zlib `(,zlib "static")))
+       (list hurd libpciaccess zlib `(,zlib "static")))
       (native-inputs
        `(("coreutils" ,coreutils)
          ("gawk" ,gawk)
@@ -912,7 +912,7 @@ (define-public rumpkernel
                    (append (find-files "buildrump.sh/src" "librump.*[.](a|so.*)")
                            (find-files "obj" "librump.*[.](a|so.*)")))))))))
       (inputs
-       (list gnumach-headers libpciaccess-0.17))
+       (list gnumach-headers libpciaccess))
       (native-inputs
        (list autoconf
              automake
diff --git a/gnu/packages/patches/libpciaccess-hurd64.patch b/gnu/packages/patches/libpciaccess-hurd64.patch
deleted file mode 100644
index f7e11059b1..0000000000
--- a/gnu/packages/patches/libpciaccess-hurd64.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-Upstream-status: Taken from upstream:
-
-<https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/commit/6cd5a4afbb70868c7746de8d50dea59e02e9acf2>.
-
-From 6cd5a4afbb70868c7746de8d50dea59e02e9acf2 Mon Sep 17 00:00:00 2001
-From: Flavio Cruz <[email-masked]>
-Date: Wed, 28 Jun 2023 01:02:34 -0400
-Subject: [PATCH] Fix compilation warnings when building against hurd-amd64.
-Content-Transfer-Encoding: 8bit
-Content-Type: text/plain; charset=UTF-8
-
-Passes mach_msg_type_number_t instead of size_t which have different
-sizes. Example warning:
-
-/hurd_pci.c:101:53: warning: passing argument 3 of 'pci_get_dev_regions' from incompatible pointer type [-Wincompatible-pointer-types]
-  101 |     err = pci_get_dev_regions(d->device_port, &buf, &size);
-      |                                                     ^~~~~
-      |                                                     |
-      |                                                     size_t * {aka long unsigned int *}
----
- src/hurd_pci.c | 6 +++---
- 1 file changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/src/hurd_pci.c b/src/hurd_pci.c
-index 8653e1b..9ac3813 100644
---- a/src/hurd_pci.c
-+++ b/src/hurd_pci.c
-@@ -82,7 +82,7 @@ pci_device_hurd_probe(struct pci_device *dev)
-     struct pci_bar regions[6];
-     struct pci_xrom_bar rom;
-     struct pci_device_private *d;
--    size_t size;
-+    mach_msg_type_number_t size;
-     char *buf;
- 
-     /* Many of the fields were filled in during initial device enumeration.
-@@ -323,7 +323,7 @@ pciclient_cfg_read(mach_port_t device_port, int reg, char *buf,
-                    size_t * nbytes)
- {
-     int err;
--    size_t nread;
-+    mach_msg_type_number_t nread;
-     char *data;
- 
-     data = buf;
-@@ -473,7 +473,7 @@ simple_readdir(mach_port_t port, uint32_t *first_entry)
- {
-     char *data;
-     int nentries = 0;
--    vm_size_t size;
-+    mach_msg_type_number_t size;
- 
-     dir_readdir (port, &data, &size, *first_entry, 1, 0, &nentries);
- 
--- 
-Janneke Nieuwenhuizen <[email-masked]>  | GNU LilyPond https://LilyPond.org
-Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com
-
diff --git a/gnu/packages/xorg.scm b/gnu/packages/xorg.scm
index 9f067acf87..2b403ec9f2 100644
--- a/gnu/packages/xorg.scm
+++ b/gnu/packages/xorg.scm
@@ -1172,72 +1172,38 @@ (define-public libfs
 (define-public libpciaccess
   (package
     (name "libpciaccess")
-    (version "0.16")
+    (version "0.18.1")
     (source
       (origin
         (method url-fetch)
         (uri (string-append
                "mirror://xorg/individual/lib/libpciaccess-"
                version
-               ".tar.bz2"))
+               ".tar.xz"))
         (sha256
           (base32
-            "12glp4w1kgvmqn89lk19cgr6jccd3awxra4dxisp7pagi06rsk11"))))
-    (build-system gnu-build-system)
+            "0xpslrjnfrc1a7y8f8qwnd3wq24ndpj2q77ds12mbnwand239x2a"))))
+    (build-system meson-build-system)
     (arguments
      (list
       ;; Make sure libpciaccess can read compressed 'pci.ids' files as
       ;; provided by pciutils.
       #:configure-flags
-      #~(list "--with-zlib"
-             (string-append "--with-pciids-path="
-                            (assoc-ref %build-inputs "pciutils")
-                            "/share/hwdata"))
-
-       #:phases
-       #~(modify-phases %standard-phases
-         (add-after 'install 'add-L-zlib
-           (lambda* (#:key inputs outputs #:allow-other-keys)
-             ;; Provide '-LZLIB/lib' next to '-lz' in the .la file.
-             (let ((zlib (assoc-ref inputs "zlib"))
-                   (out  (assoc-ref outputs "out")))
-               (substitute* (string-append out "/lib/libpciaccess.la")
-                 (("-lz")
-                  (string-append "-L" zlib "/lib -lz")))
-               #t)))
-         #$@(if (target-hurd64?)
-                #~((add-after 'unpack 'apply-hurd64-patch
-                     (lambda _
-                       (let ((patch-file
-                              #$(local-file
-                                 (search-patch "libpciaccess-hurd64.patch"))))
-                         (invoke "patch" "--force" "-p1" "-i" patch-file)))))
-                #~()))))
+      #~(list "-Dzlib=enabled"
+              (string-append "-Dpci-ids="
+                             (assoc-ref %build-inputs "pciutils")
+                             "/share/hwdata"))))
     (inputs
-     (list zlib pciutils))                   ;for 'pci.ids.gz'
+     (list pciutils))                   ;for 'pci.ids.gz'
+    (propagated-inputs
+     (list zlib))                       ;in Requires.private of pciaccess.pc
     (native-inputs
-       (list pkg-config))
+     (list pkg-config))
     (home-page "https://www.x.org/wiki/")
     (synopsis "Xorg PCI access library")
     (description "Xorg Generic PCI access library.")
     (license license:x11)))
 
-(define-public libpciaccess-0.17
-  (package
-    (inherit libpciaccess)
-    (name "libpciaccess")
-    (version "0.17")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append
-             "mirror://xorg/individual/lib/libpciaccess-"
-             version
-             ".tar.xz"))
-       (sha256
-        (base32
-         "0wsvv5d05maqbidvnavka7n0fnql55m4jix5wwlk14blr6ikna3l"))))))
-
 (define-public libpthread-stubs
   (package
     (name "libpthread-stubs")
-- 
2.46.0