commit:     bb9b11b116b5029003c55716d733a4bc9886ad66
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue May  9 12:45:53 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue May  9 12:46:05 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bb9b11b1

x11-libs/libpciaccess: fix build w/ musl-1.2.4

In theory these fixes can be okay without a revbump but it's best to be careful.

Closes: https://bugs.gentoo.org/905913
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/libpciaccess-0.17-musl-lfs.patch         | 40 ++++++++++++++++++++++
 x11-libs/libpciaccess/libpciaccess-0.17-r1.ebuild  | 33 ++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/x11-libs/libpciaccess/files/libpciaccess-0.17-musl-lfs.patch 
b/x11-libs/libpciaccess/files/libpciaccess-0.17-musl-lfs.patch
new file mode 100644
index 000000000000..cfd7a1469b25
--- /dev/null
+++ b/x11-libs/libpciaccess/files/libpciaccess-0.17-musl-lfs.patch
@@ -0,0 +1,40 @@
+https://bugs.gentoo.org/905913
+https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/commit/833c86ce15cee2a84a37ae71015f236fd32615d9
+
+From 833c86ce15cee2a84a37ae71015f236fd32615d9 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Fri, 11 Nov 2022 11:15:58 -0800
+Subject: [PATCH] linux_sysfs: Use pwrite/pread instead of 64bit versions
+
+pread64/pwrite64 are aliased to pread/pwrite when largefile support is
+enabled e.g. using _FILE_OFFSET_BITS=64 macro
+
+This helps it compile on latest musl C library based systems where these
+functions are put under _LARGEFILE64_SOURCE which is to be removed once
+all packages start using 64bit off_t, it works with glibc becuase
+_GNU_SOURCE feature macro also defines _LARGEFILE64_SOURCE, thats not
+the case with musl
+
+Signed-off-by: Khem Raj <[email protected]>
+--- a/src/linux_sysfs.c
++++ b/src/linux_sysfs.c
+@@ -462,7 +462,7 @@ pci_device_linux_sysfs_read( struct pci_device * dev, void 
* data,
+ 
+ 
+     while ( temp_size > 0 ) {
+-      const ssize_t bytes = pread64( fd, data_bytes, temp_size, offset );
++      const ssize_t bytes = pread( fd, data_bytes, temp_size, offset );
+ 
+       /* If zero bytes were read, then we assume it's the end of the
+        * config file.
+@@ -522,7 +522,7 @@ pci_device_linux_sysfs_write( struct pci_device * dev, 
const void * data,
+ 
+ 
+     while ( temp_size > 0 ) {
+-      const ssize_t bytes = pwrite64( fd, data_bytes, temp_size, offset );
++      const ssize_t bytes = pwrite( fd, data_bytes, temp_size, offset );
+ 
+       /* If zero bytes were written, then we assume it's the end of the
+        * config file.
+-- 
+GitLab

diff --git a/x11-libs/libpciaccess/libpciaccess-0.17-r1.ebuild 
b/x11-libs/libpciaccess/libpciaccess-0.17-r1.ebuild
new file mode 100644
index 000000000000..7191e10bbbb0
--- /dev/null
+++ b/x11-libs/libpciaccess/libpciaccess-0.17-r1.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+XORG_MULTILIB=yes
+XORG_TARBALL_SUFFIX="xz"
+inherit xorg-3 meson-multilib
+
+DESCRIPTION="Library providing generic access to the PCI bus and devices"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~sparc-solaris ~x64-solaris 
~x86-solaris"
+IUSE="zlib"
+
+DEPEND="
+       zlib? ( >=sys-libs/zlib-1.2.8-r1:=[${MULTILIB_USEDEP}] )"
+RDEPEND="${DEPEND}
+       sys-apps/hwdata"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-musl-lfs.patch
+)
+
+src_prepare() {
+       default
+}
+
+multilib_src_configure() {
+       local emesonargs=(
+               -Dpci-ids="${EPREFIX}"/usr/share/hwdata
+               $(meson_feature zlib)
+       )
+       meson_src_configure
+}

Reply via email to