summaryrefslogtreecommitdiff
path: root/sys-apps/pciutils
diff options
context:
space:
mode:
Diffstat (limited to 'sys-apps/pciutils')
-rw-r--r--sys-apps/pciutils/Manifest8
-rw-r--r--sys-apps/pciutils/files/pciutils-3.1.9-static-pc.patch13
-rw-r--r--sys-apps/pciutils/files/pciutils-3.8.0-no-which.patch34
-rw-r--r--sys-apps/pciutils/files/pciutils-3.8.0-pkg-config.patch19
-rw-r--r--sys-apps/pciutils/pciutils-3.7.0-r2.ebuild111
-rw-r--r--sys-apps/pciutils/pciutils-3.8.0-r1.ebuild168
-rw-r--r--sys-apps/pciutils/pciutils-3.8.0.ebuild63
7 files changed, 286 insertions, 130 deletions
diff --git a/sys-apps/pciutils/Manifest b/sys-apps/pciutils/Manifest
index 9252a81d71fb..fc8eef06660d 100644
--- a/sys-apps/pciutils/Manifest
+++ b/sys-apps/pciutils/Manifest
@@ -1,8 +1,8 @@
AUX conf.d-pciparm 988 BLAKE2B c51b826806c58411939d8987e103cba5775806abcbf12a9320cdba2d410dde4f2b3198b4e07d3341b2b7fcafcfd6cafea648909bdaa4976703c764d5d4a0e312 SHA512 7c3513a9112318736907f4a1f3e94910d59752d8f51cf4f9f8ccd33b563250aca17a507e0937507bd9352d12a2b9a47e7419306908990b21a3460e6527dab6a4
AUX init.d-pciparm 1758 BLAKE2B a9dd930da942c73d7a150938b2b58543f517542c4c675334cca8f9eb02b83dad456e36ae1bf77ed8fcc0eac52e0dc638f19a41682fa3e1d3623011d09301945b SHA512 c5a527236039edf29f6876d3b07909045dd04e40d863d68014dd96cc021b7b61356470e67541b5b68487d996a299b60b3da46272259f9d0724ea1392e6243646
-AUX pciutils-3.1.9-static-pc.patch 373 BLAKE2B 39e44412bdde832e9812cd719155f7638d01cd49ebb5be638b2bd10627fe77279c4be79684e13c588b5d3b252eba66dc1a95275d60d40bcf12df46cf8bbdc807 SHA512 e20286ae41569236b549d13c703266f920f335609c1ad2e5d67fd1561f9e9c68d4ac1fd530f93a4451ec79a5496ed226b83db0c74935499f44cd47e94eb74f49
-DIST pciutils-3.7.0.tar.gz 516418 BLAKE2B fca6720cff73ec20559c666c76fdcd3b59cdf0e33e2c3894a82590d77c5d51cf22e667fe65d9f66a248a624c2b9c868f6e9b69f45f4b6d704b637afe55041e6a SHA512 8a8fb9dc44a8dd31f80e45a48f6693452c11d343b9dfed87dd5cea6846f38d001f294e4010cd7c0545e238fde45b0e9a8e88c67a43d80676a585336e3665a631
+AUX pciutils-3.8.0-no-which.patch 1207 BLAKE2B 6012046e4d0831e5a20b351e43bde4c1450c076989ed42741eac76510e2bc279940c80a04d978f6947878adca3140f5fc205615540871eefc9d62a68482fd4fa SHA512 240bb7142f5af044a8fdac96fcc63af7938b1e7f5f3d1689d213df09e71c1d6da84d1d1ee421511fa4c07f212e5605485c1f5ad8ad30052d181f0020e256d387
+AUX pciutils-3.8.0-pkg-config.patch 691 BLAKE2B c12a6a6f19a62d5d161479e401f5bd9e373821fb72648c6ef0d9a49312a0ed930e790a9153eddadfaca28b8c0c330166c915c43d9439e1163a385defa08760df SHA512 d616aadc83c40cde4f8e0261ad0a99259d5b66bf32c7db3f5b47cd0981b27ec93ff5547b1927806e3b045ac61d884cd5eb96e4ff58955b1881616056a95cab4c
DIST pciutils-3.8.0.tar.gz 575255 BLAKE2B 7339189f7115af31ccc19663d54e12ef966fbcd75c6b6b4c28c8ddcaafa3e233313ca14300ef70100edb00f5f2e1e767af9d6527a9d836edd07b598f0a40f4f4 SHA512 4b0de02a54c6ed19d5ea85a01d89a62386000bc0f816498872479aba26fb007a8c394cba3f95e77a7ffe52d36ad2726169b7b83bda5ab0647f00e49d8a34bf15
-EBUILD pciutils-3.7.0-r2.ebuild 2625 BLAKE2B 79828b3bb68b1aea998c716677815a2a459df5813c26056d69ce336ff3b2c63b51a9299f4f75c7e9eb7d99d75644c8a68ef21016ce15c929294566d894ee0b5f SHA512 6b35ea095aac16030aa2033e8429dcb80bbd6300e8de1750342e3b70af354417dfde559936f962b8c883d0b173ae0ccd164da4eded1065fc47924ce879ccc028
-EBUILD pciutils-3.8.0.ebuild 2568 BLAKE2B 0373c7cb27124af1f6ceaf2a333f2f732976a727d9d5caa075cfc65dfeb401cfcb737fc1ec46a3598feaf33c305aa45427f44a3c6e56d06371bcd9dd0b805e5a SHA512 ebf9b0c4a49e1da1ff2b579dcb0364ae2e2dd403f5fa74fec7e0f3d0cf39e36bf674777105b8027dd627e5e51da1d549deed353fdfb942d064e6087823bdc8d3
+EBUILD pciutils-3.8.0-r1.ebuild 4882 BLAKE2B a25f7136f8ed59963eca2c3a36e8be95fe007a5a84b1be136abaa63b1e0ef5b3c2911c825f49b91042099e8e1c45409ca6688d7721623cdc3b8d3295c17014e9 SHA512 4febe95aea85c906b361d876467f1ba68162101dce1d770c310d42516c506377bb0c20962c1d7c4ae120c9ab04a4403b516f41efa7f08c2f579ad6eecb1d0f50
+EBUILD pciutils-3.8.0.ebuild 4709 BLAKE2B f3954f5bf30d0fc063fdd27b7e1c6824ef396a8f922d5ed0b3180a1ea5036a6d04f79acfb863919f1f00466f6070e1f42338d89fa937fbf2b9318987bea4d7bc SHA512 dfacfe7264bacac6e00c252f20b04366a72cccb47f7629bd8dd12541be9d4daea82c0359f6407bbc566bbcef0d6f875de69bbdcf147506bf19080d2a347d0b98
MISC metadata.xml 525 BLAKE2B 5a7a502d28b6e74db1f1f008adfc5d9c398fb7832c8c82e066c9d4834726a0cd1e97b9738ca21906468f3c2444f20bfcf715339a1314e34b2b43d4f5c631a659 SHA512 5e53a4261ea0aa0d58f7a16b5c8ddbc2e6bda130e49642a9dc220f39cd6a77b8fdf22c22fd7def106d4728b880b75371feea3d552981d03294b86b8cb7fd08c0
diff --git a/sys-apps/pciutils/files/pciutils-3.1.9-static-pc.patch b/sys-apps/pciutils/files/pciutils-3.1.9-static-pc.patch
deleted file mode 100644
index 9e63b7ecd661..000000000000
--- a/sys-apps/pciutils/files/pciutils-3.1.9-static-pc.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-make sure all lib entries get into libs.private in the .pc file
-
---- a/lib/Makefile
-+++ b/lib/Makefile
-@@ -61,7 +61,7 @@ $(PCILIBPC): libpci.pc.in
- -e 's,@LIBDIR@,$(LIBDIR),' \
- -e 's,@IDSDIR@,$(IDSDIR),' \
- -e 's,@VERSION@,$(VERSION),' \
-- -e 's,@LDLIBS@,$(LDLIBS),'
-+ -e 's,@LDLIBS@,$(LDLIBS) $(LIB_LDLIBS),'
-
- init.o: init.c $(INCL)
- access.o: access.c $(INCL)
diff --git a/sys-apps/pciutils/files/pciutils-3.8.0-no-which.patch b/sys-apps/pciutils/files/pciutils-3.8.0-no-which.patch
new file mode 100644
index 000000000000..3024d73555d3
--- /dev/null
+++ b/sys-apps/pciutils/files/pciutils-3.8.0-no-which.patch
@@ -0,0 +1,34 @@
+https://github.com/pciutils/pciutils/pull/105
+
+From 91bf24dd3c91f826377548b7e164b49cfed56f9a Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 19 Jun 2022 23:52:22 +0100
+Subject: [PATCH 1/2] lib/configure: drop usage of which
+
+'which' is not required by POSIX and is an external command which may not be
+available, and 'command -v' does the job just fine.
+
+Debian and Gentoo at least are both making efforts to drop which from
+their base system package list.
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/lib/configure
++++ b/lib/configure
+@@ -238,7 +238,7 @@ if [ "$sys" = linux ] ; then
+ PKG_CONFIG=pkg-config
+ fi
+ if [ "$LIBKMOD" != no ] ; then
+- if ! which $PKG_CONFIG >/dev/null ; then
++ if ! command -v $PKG_CONFIG >/dev/null ; then
+ echo_n "($PKG_CONFIG not found) "
+ elif $PKG_CONFIG libkmod ; then
+ LIBKMOD_DETECTED=1
+@@ -268,7 +268,7 @@ if [ "$sys" = linux ] ; then
+ if [ "$HWDB" = yes -o "$HWDB" = no ] ; then
+ echo "$HWDB (set manually)"
+ else
+- if `which pkg-config >/dev/null && pkg-config --atleast-version=196 libudev` ; then
++ if `command -v pkg-config >/dev/null && pkg-config --atleast-version=196 libudev` ; then
+ HWDB=yes
+ else
+ HWDB=no
diff --git a/sys-apps/pciutils/files/pciutils-3.8.0-pkg-config.patch b/sys-apps/pciutils/files/pciutils-3.8.0-pkg-config.patch
new file mode 100644
index 000000000000..4630609bad24
--- /dev/null
+++ b/sys-apps/pciutils/files/pciutils-3.8.0-pkg-config.patch
@@ -0,0 +1,19 @@
+https://github.com/pciutils/pciutils/pull/105
+
+From a74832198ab36683a867c79b3d6ef2cac9baad55 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 19 Jun 2022 23:53:42 +0100
+Subject: [PATCH 2/2] lib/configure: respect $PKG_CONFIG completely
+
+Signed-off-by: Sam James <sam@gentoo.org>
+--- a/lib/configure
++++ b/lib/configure
+@@ -268,7 +268,7 @@ if [ "$sys" = linux ] ; then
+ if [ "$HWDB" = yes -o "$HWDB" = no ] ; then
+ echo "$HWDB (set manually)"
+ else
+- if `command -v pkg-config >/dev/null && pkg-config --atleast-version=196 libudev` ; then
++ if `command -v $PKG_CONFIG >/dev/null && $PKG_CONFIG --atleast-version=196 libudev` ; then
+ HWDB=yes
+ else
+ HWDB=no
diff --git a/sys-apps/pciutils/pciutils-3.7.0-r2.ebuild b/sys-apps/pciutils/pciutils-3.7.0-r2.ebuild
deleted file mode 100644
index 9f9b0b41e67e..000000000000
--- a/sys-apps/pciutils/pciutils-3.7.0-r2.ebuild
+++ /dev/null
@@ -1,111 +0,0 @@
-# Copyright 1999-2021 Gentoo Authors
-# Distributed under the terms of the GNU General Public License v2
-
-EAPI=7
-
-inherit multilib toolchain-funcs multilib-minimal flag-o-matic
-
-DESCRIPTION="Various utilities dealing with the PCI bus"
-HOMEPAGE="https://mj.ucw.cz/sw/pciutils/ https://git.kernel.org/?p=utils/pciutils/pciutils.git"
-SRC_URI="https://mj.ucw.cz/download/linux/pci/${P}.tar.gz"
-
-LICENSE="GPL-2"
-SLOT="0"
-KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
-IUSE="dns +kmod static-libs +udev zlib"
-REQUIRED_USE="static-libs? ( !udev )"
-
-# Have the sub-libs in RDEPEND with [static-libs] since, logically,
-# our libpci.a depends on libz.a/etc... at runtime.
-LIB_DEPEND="
- zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+),${MULTILIB_USEDEP}] )
-"
-DEPEND="
- kmod? ( sys-apps/kmod )
- udev? ( >=virtual/libudev-208[${MULTILIB_USEDEP}] )
- static-libs? ( ${LIB_DEPEND} )
- !static-libs? ( ${LIB_DEPEND//static-libs([+-]),} )
-"
-RDEPEND="
- ${DEPEND}
- sys-apps/hwdata
-"
-BDEPEND="kmod? ( virtual/pkgconfig )"
-
-PATCHES=(
- "${FILESDIR}"/${PN}-3.1.9-static-pc.patch
-)
-
-MULTILIB_WRAPPED_HEADERS=( /usr/include/pci/config.h )
-
-switch_config() {
- [[ $# -ne 2 ]] && return 1
- local opt=$1 val=$2
-
- sed "s@^\(${opt}=\).*\$@\1${val}@" -i Makefile || die
- return 0
-}
-
-src_prepare() {
- default
-
- if use static-libs ; then
- cp -pPR "${S}" "${S}.static" || die
- mv "${S}.static" "${S}/static" || die
- fi
-
- multilib_copy_sources
-}
-
-multilib_src_configure() {
- append-lfs-flags #471102
-}
-
-pemake() {
- emake \
- HOST="${CHOST}" \
- CROSS_COMPILE="${CHOST}-" \
- CC="$(tc-getCC)" \
- AR="$(tc-getAR)" \
- PKG_CONFIG="$(tc-getPKG_CONFIG)" \
- RANLIB="$(tc-getRANLIB)" \
- DNS=$(usex dns) \
- IDSDIR='$(SHAREDIR)/hwdata' \
- MANDIR='$(SHAREDIR)/man' \
- PREFIX="${EPREFIX}/usr" \
- SHARED="yes" \
- STRIP="" \
- ZLIB=$(usex zlib) \
- PCI_COMPRESSED_IDS=0 \
- PCI_IDS=pci.ids \
- LIBDIR="\${PREFIX}/$(get_libdir)" \
- LIBKMOD=$(multilib_native_usex kmod) \
- HWDB=$(usex udev) \
- "$@"
-}
-
-multilib_src_compile() {
- pemake OPT="${CFLAGS}" all
- if use static-libs ; then
- pemake \
- -C "${BUILD_DIR}/static" \
- OPT="${CFLAGS}" \
- SHARED="no" \
- lib/libpci.a
- fi
-}
-
-multilib_src_install() {
- pemake DESTDIR="${D}" install install-lib
- use static-libs && dolib.a "${BUILD_DIR}/static/lib/libpci.a"
-}
-
-multilib_src_install_all() {
- dodoc ChangeLog README TODO
-
- rm "${ED}"/usr/sbin/update-pciids "${ED}"/usr/share/man/man8/update-pciids.8* || die
- rm -r "${ED}"/usr/share/hwdata || die
-
- newinitd "${FILESDIR}"/init.d-pciparm pciparm
- newconfd "${FILESDIR}"/conf.d-pciparm pciparm
-}
diff --git a/sys-apps/pciutils/pciutils-3.8.0-r1.ebuild b/sys-apps/pciutils/pciutils-3.8.0-r1.ebuild
new file mode 100644
index 000000000000..1bf858cd8fbf
--- /dev/null
+++ b/sys-apps/pciutils/pciutils-3.8.0-r1.ebuild
@@ -0,0 +1,168 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs multilib-minimal flag-o-matic
+
+DESCRIPTION="Various utilities dealing with the PCI bus"
+HOMEPAGE="https://mj.ucw.cz/sw/pciutils/ https://git.kernel.org/?p=utils/pciutils/pciutils.git"
+SRC_URI="https://mj.ucw.cz/download/linux/pci/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+IUSE="dns +kmod static-libs +udev zlib"
+REQUIRED_USE="static-libs? ( !udev )"
+
+# Have the sub-libs in RDEPEND with [static-libs] since, logically,
+# our libpci.a depends on libz.a/etc... at runtime.
+LIB_DEPEND="zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+),${MULTILIB_USEDEP}] )"
+DEPEND="kmod? ( sys-apps/kmod )
+ udev? ( >=virtual/libudev-208[${MULTILIB_USEDEP}] )
+ static-libs? ( ${LIB_DEPEND} )
+ !static-libs? ( ${LIB_DEPEND//static-libs([+-]),} )"
+RDEPEND="${DEPEND}
+ sys-apps/hwdata"
+# See bug #847133 re binutils check
+BDEPEND="|| ( >=sys-devel/binutils-2.37:* sys-devel/lld sys-devel/native-cctools )
+ kmod? ( virtual/pkgconfig )"
+
+MULTILIB_WRAPPED_HEADERS=( /usr/include/pci/config.h )
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-3.8.0-no-which.patch
+ "${FILESDIR}"/${PN}-3.8.0-pkg-config.patch
+)
+
+switch_config() {
+ [[ $# -ne 2 ]] && return 1
+ local opt=$1 val=$2
+
+ sed "s@^\(${opt}=\).*\$@\1${val}@" -i Makefile || die
+ return 0
+}
+
+check_binutils_version() {
+ if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && ! tc-ld-is-gold && ! tc-ld-is-lld ; then
+ # Okay, hopefully it's Binutils' bfd.
+ # bug #847133
+
+ # Convert this:
+ # ```
+ # GNU ld (Gentoo 2.38 p4) 2.38
+ # Copyright (C) 2022 Free Software Foundation, Inc.
+ # This program is free software; you may redistribute it under the terms of
+ # the GNU General Public License version 3 or (at your option) a later version.
+ # This program has absolutely no warranty.
+ # ```
+ #
+ # into...
+ # ```
+ # 2.38
+ # ```
+ local ver=$($(tc-getLD) --version 2>&1 | head -1 | rev | cut -d' ' -f1 | rev)
+
+ if ! [[ ${ver} =~ [0-9].[0-9][0-9] ]] ; then
+ # Skip if unrecognised format so we don't pass something
+ # odd into ver_cut.
+ return
+ fi
+
+ ver_major=$(ver_cut 1 "${ver}")
+ ver_minor=$(ver_cut 2 "${ver}")
+
+ # We use 2.37 here, not 2.35, as https://github.com/pciutils/pciutils/issues/98 mentions
+ # because we've had other miscompiles with older Binutils (not just build failures!)
+ # and we don't want people running any unsupported versions of Binutils. An example
+ # of this is where glibc is completely broken with old binutils: bug #802036. It's
+ # just not sustainable to support.
+ if [[ ${ver_major} -eq 2 && ${ver_minor} -lt 37 ]] ; then
+ eerror "Old version of binutils activated! ${P} cannot be built with an old version."
+ eerror "Please follow these steps:"
+ eerror "1. Select a newer binutils (>= 2.37) using binutils-config"
+ eerror " (If no such version is installed, run emerge -v1 sys-devel/binutils)"
+ eerror "2. Run: . /etc/profile"
+ eerror "3. Try emerging again with: emerge -v1 ${CATEGORY}/${P}"
+ eerror "4. Complete your world upgrade if you were performing one."
+ eerror "4. Perform a depclean (emerge -acv)"
+ eerror "\tYou MUST depclean after every world upgrade in future!"
+ die "Old binutils found! Change to a newer ld using binutils-config (bug #847133)."
+ fi
+ fi
+}
+
+pkg_pretend() {
+ [[ ${MERGE_TYPE} != binary ]] && check_binutils_version
+}
+
+pkg_setup() {
+ [[ ${MERGE_TYPE} != binary ]] && check_binutils_version
+}
+
+src_prepare() {
+ default
+
+ if use static-libs ; then
+ cp -pPR "${S}" "${S}.static" || die
+ mv "${S}.static" "${S}/static" || die
+ fi
+
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ # bug #471102
+ append-lfs-flags
+}
+
+pemake() {
+ emake \
+ HOST="${CHOST}" \
+ CROSS_COMPILE="${CHOST}-" \
+ CC="$(tc-getCC)" \
+ AR="$(tc-getAR)" \
+ PKG_CONFIG="$(tc-getPKG_CONFIG)" \
+ RANLIB="$(tc-getRANLIB)" \
+ DNS=$(usex dns) \
+ IDSDIR='$(SHAREDIR)/hwdata' \
+ MANDIR='$(SHAREDIR)/man' \
+ PREFIX="${EPREFIX}/usr" \
+ SHARED="yes" \
+ STRIP="" \
+ ZLIB=$(usex zlib) \
+ PCI_COMPRESSED_IDS=0 \
+ PCI_IDS=pci.ids \
+ LIBDIR="\${PREFIX}/$(get_libdir)" \
+ LIBKMOD=$(multilib_native_usex kmod) \
+ HWDB=$(usex udev) \
+ "$@"
+}
+
+multilib_src_compile() {
+ pemake OPT="${CFLAGS}" all
+
+ if use static-libs ; then
+ pemake \
+ -C "${BUILD_DIR}"/static \
+ OPT="${CFLAGS}" \
+ SHARED="no" \
+ lib/libpci.a
+ fi
+}
+
+multilib_src_install() {
+ pemake DESTDIR="${D}" install install-lib
+
+ use static-libs && dolib.a "${BUILD_DIR}"/static/lib/libpci.a
+}
+
+multilib_src_install_all() {
+ dodoc ChangeLog README TODO
+
+ rm "${ED}"/usr/sbin/update-pciids "${ED}"/usr/share/man/man8/update-pciids.8* || die
+ rm -r "${ED}"/usr/share/hwdata || die
+
+ newinitd "${FILESDIR}"/init.d-pciparm pciparm
+ newconfd "${FILESDIR}"/conf.d-pciparm pciparm
+}
diff --git a/sys-apps/pciutils/pciutils-3.8.0.ebuild b/sys-apps/pciutils/pciutils-3.8.0.ebuild
index 311aa06502b2..53e69aa143eb 100644
--- a/sys-apps/pciutils/pciutils-3.8.0.ebuild
+++ b/sys-apps/pciutils/pciutils-3.8.0.ebuild
@@ -11,7 +11,7 @@ SRC_URI="https://mj.ucw.cz/download/linux/pci/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
-KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux"
+KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
IUSE="dns +kmod static-libs +udev zlib"
REQUIRED_USE="static-libs? ( !udev )"
@@ -24,7 +24,10 @@ DEPEND="kmod? ( sys-apps/kmod )
!static-libs? ( ${LIB_DEPEND//static-libs([+-]),} )"
RDEPEND="${DEPEND}
sys-apps/hwdata"
-BDEPEND="kmod? ( virtual/pkgconfig )"
+# See bug #847133 re binutils check
+BDEPEND="sys-apps/which
+ || ( >=sys-devel/binutils-2.37:* sys-devel/lld sys-devel/native-cctools )
+ kmod? ( virtual/pkgconfig )"
MULTILIB_WRAPPED_HEADERS=( /usr/include/pci/config.h )
@@ -36,6 +39,62 @@ switch_config() {
return 0
}
+check_binutils_version() {
+ if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]] && ! tc-ld-is-gold && ! tc-ld-is-lld ; then
+ # Okay, hopefully it's Binutils' bfd.
+ # bug #847133
+
+ # Convert this:
+ # ```
+ # GNU ld (Gentoo 2.38 p4) 2.38
+ # Copyright (C) 2022 Free Software Foundation, Inc.
+ # This program is free software; you may redistribute it under the terms of
+ # the GNU General Public License version 3 or (at your option) a later version.
+ # This program has absolutely no warranty.
+ # ```
+ #
+ # into...
+ # ```
+ # 2.38
+ # ```
+ local ver=$($(tc-getLD) --version 2>&1 | head -1 | rev | cut -d' ' -f1 | rev)
+
+ if ! [[ ${ver} =~ [0-9].[0-9][0-9] ]] ; then
+ # Skip if unrecognised format so we don't pass something
+ # odd into ver_cut.
+ return
+ fi
+
+ ver_major=$(ver_cut 1 "${ver}")
+ ver_minor=$(ver_cut 2 "${ver}")
+
+ # We use 2.37 here, not 2.35, as https://github.com/pciutils/pciutils/issues/98 mentions
+ # because we've had other miscompiles with older Binutils (not just build failures!)
+ # and we don't want people running any unsupported versions of Binutils. An example
+ # of this is where glibc is completely broken with old binutils: bug #802036. It's
+ # just not sustainable to support.
+ if [[ ${ver_major} -eq 2 && ${ver_minor} -lt 37 ]] ; then
+ eerror "Old version of binutils activated! ${P} cannot be built with an old version."
+ eerror "Please follow these steps:"
+ eerror "1. Select a newer binutils (>= 2.37) using binutils-config"
+ eerror "2. Run: . /etc/profile"
+ eerror "3. Try emerging again with: emerge -v1 ${CATEGORY}/${P}"
+ eerror "4. Complete your world upgrade if you were performing one."
+ eerror "4. Perform a depclean (emerge -acv)"
+ eerror "\tYou MUST depclean after every world upgrade in future!"
+ die "Old binutils found! Change to a newer ld using binutils-config (bug #847133)."
+ fi
+ fi
+}
+
+pkg_pretend() {
+ [[ ${MERGE_TYPE} != binary ]] && check_binutils_version
+}
+
+pkg_setup() {
+ [[ ${MERGE_TYPE} != binary ]] && check_binutils_version
+}
+
src_prepare() {
default