commit: fc162ea0dc49426a8a3db756b8f0183435d20c1c Author: Aric Belsito <lluixhi <AT> gmail <DOT> com> AuthorDate: Mon Jul 2 18:27:30 2018 +0000 Commit: Aric Belsito <lluixhi <AT> gmail <DOT> com> CommitDate: Mon Jul 2 18:27:30 2018 +0000 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=fc162ea0
sys-apps/pciutils: add latest version needs a patch for canonicalize_file_name sys-apps/pciutils/Manifest | 1 + sys-apps/pciutils/files/conf.d-pciparm | 28 +++++ sys-apps/pciutils/files/init.d-pciparm | 79 ++++++++++++++ .../pciutils/files/pciutils-3.1.9-static-pc.patch | 13 +++ .../pciutils/files/pciutils-3.6.0-realpath.patch | 12 ++ sys-apps/pciutils/metadata.xml | 13 +++ sys-apps/pciutils/pciutils-3.6.0.ebuild | 121 +++++++++++++++++++++ 7 files changed, 267 insertions(+) diff --git a/sys-apps/pciutils/Manifest b/sys-apps/pciutils/Manifest new file mode 100644 index 0000000..7dc8d96 --- /dev/null +++ b/sys-apps/pciutils/Manifest @@ -0,0 +1 @@ +DIST pciutils-3.6.0.tar.gz 454912 BLAKE2B 1f37307ba21085d5f49dd908781ce34dff98a1e4d818158800a1fbdc1fc689e1b868ee9c762378a8cd28ab17cbaaf1e9255da94c44029bfa2f4a8b5d9fd4b273 SHA512 e59cb5685f1dee2673368c90fdf1f5b7689de9fa45f249ce472258f278288da7a81644c76d1ecb7cc857f8029d3d70c367fe62190caf55328143b51017cc5c6f diff --git a/sys-apps/pciutils/files/conf.d-pciparm b/sys-apps/pciutils/files/conf.d-pciparm new file mode 100644 index 0000000..f036b15 --- /dev/null +++ b/sys-apps/pciutils/files/conf.d-pciparm @@ -0,0 +1,28 @@ +# PCI tweaking article: +# http://www.gentoo.org/doc/en/articles/hardware-stability-p2.xml +# +# Apply to all devices: +# PCIPARM_ALL="...." +# Cards also can be addressed by vid:pid or by bus:slot.func +# (see setpci man page relative to -d and -s options) +# PCIPARM_(BUS|VENDOR)_#="...." +# Where # is sequentially numbered from zero. + +# Examples: +# "open up" the PCI bus by allowing fairly long bursts +# for all devices, increasing performance +# (equivalent to: setpci -v -d *:* latency_timer=b0) +#PCIPARM_ALL="latency_timer=b0" + +# maximize latency timers for network and audio, +# allowing them to transmit more data per burst, +# preventing buffer over/under-run conditions +#PCIPARM_BUS_0="00:04.0 latency_timer=ff" +#PCIPARM_BUS_1="01:04.0 latency_timer=ff" +#PCIPARM_VENDOR_0="1057:3410 latency_timer=ff" + +# -v : whether to be verbose about changes +# -D : dry-run, no commit +# -f : do not warn if the change is already set +# (see the setpci manpage for more advanced options) +SETPCI_OPT="-f" diff --git a/sys-apps/pciutils/files/init.d-pciparm b/sys-apps/pciutils/files/init.d-pciparm new file mode 100644 index 0000000..734ca99 --- /dev/null +++ b/sys-apps/pciutils/files/init.d-pciparm @@ -0,0 +1,79 @@ +#!/sbin/openrc-run +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +depend() { + before bootmisc hdparm + after localmount +} + +checkconfig() { + if [ ! -f /etc/conf.d/pciparm ]; then + ewarn "/etc/conf.d/pciparm does not exist, skipping" + return 1 + fi + + if [ -z "${PCIPARM_ALL}" -a -z "${PCIPARM_BUS_0}" -a -z "${PCIPARM_VENDOR_0}" ]; then + ewarn "None of PCIPARM_ALL, PCIPARM_BUS_* or PCIPARM_VENDOR_* set in /etc/conf.d/pciparm" + return 1 + fi +} + +do_setpci() { + #ewarn "do_setpci: /usr/sbin/setpci $SETPCI_OPT $@" + SWITCH=$1 + SPEC_ID=$2 + shift 2 + case "$SWITCH" in + -d) DESC=vendor ;; + -s) DESC=bus ;; + *) eerror "Unknown setpci type: $SWITCH" ; return 1 ;; + esac + + if [ -z "$SPEC_ID" ]; then + eerror "Missing device specifier!" + return 1 + fi + if [ -z "$*" ]; then + eerror "Missing configuration to set for ($DESC) $SPEC_ID!" + return 1 + fi + + ebegin "Setting PCI params for ($DESC) $SPEC_ID to $@" + /usr/sbin/setpci $SETPCI_OPT $SWITCH $SPEC_ID "$@" + rc=$? + eend $rc + return $rc +} + +do_setpci_array() { + name=$1 + shift + i=0 + while true; do + eval opt="\$${name}_$i" + # End of loop + [ -z "${opt}" ] && break + # Pass in all other parameters here, in case we want to use multiple + # arguments later. + do_setpci "$@" $opt #|| return 1 + i=$(($i+1)) + done +} + +start() { + if get_bootparam "nopciparm" ; then + ewarn "Skipping pciparm init as requested in kernel cmdline" + return 0 + fi + + checkconfig || return 1 + + # We do not exit after any errors presently, because it might be a + # stability-related fix after a failure. + [ -n "$PCIPARM_ALL" ] && \ + do_setpci -d '*:*' $PCIPARM_ALL #|| return 1 + + do_setpci_array PCIPARM_BUS -s #|| return 1 + do_setpci_array PCIPARM_VENDOR -d #|| return 1 +} 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 new file mode 100644 index 0000000..9e63b7e --- /dev/null +++ b/sys-apps/pciutils/files/pciutils-3.1.9-static-pc.patch @@ -0,0 +1,13 @@ +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.6.0-realpath.patch b/sys-apps/pciutils/files/pciutils-3.6.0-realpath.patch new file mode 100644 index 0000000..b8c64b7 --- /dev/null +++ b/sys-apps/pciutils/files/pciutils-3.6.0-realpath.patch @@ -0,0 +1,12 @@ +diff -Naur pciutils-3.6.0.orig/lib/sysfs.c pciutils-3.6.0/lib/sysfs.c +--- pciutils-3.6.0.orig/lib/sysfs.c 2018-07-02 11:24:47.874595946 -0700 ++++ pciutils-3.6.0/lib/sysfs.c 2018-07-02 11:25:30.453595183 -0700 +@@ -133,7 +133,7 @@ + sysfs_obj_name(d, "", path); + strcat(path, rel_path); + +- return canonicalize_file_name(path); ++ return realpath(path, NULL); + } + + static int diff --git a/sys-apps/pciutils/metadata.xml b/sys-apps/pciutils/metadata.xml new file mode 100644 index 0000000..739960f --- /dev/null +++ b/sys-apps/pciutils/metadata.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="project"> + <email>base-sys...@gentoo.org</email> + <name>Gentoo Base System</name> +</maintainer> +<use> + <flag name="dns">Enable support for querying the central database of PCI IDs using DNS</flag> + <flag name="kmod">Enable <pkg>sys-apps/kmod</pkg> support for the -k switch in lspci command</flag> + <flag name="zlib">Support compressed pci.ids database</flag> +</use> +</pkgmetadata> diff --git a/sys-apps/pciutils/pciutils-3.6.0.ebuild b/sys-apps/pciutils/pciutils-3.6.0.ebuild new file mode 100644 index 0000000..5ef1a52 --- /dev/null +++ b/sys-apps/pciutils/pciutils-3.6.0.ebuild @@ -0,0 +1,121 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit multilib toolchain-funcs multilib-minimal flag-o-matic + +DESCRIPTION="Various utilities dealing with the PCI bus" +HOMEPAGE="http://mj.ucw.cz/sw/pciutils/ https://git.kernel.org/?p=utils/pciutils/pciutils.git" +SRC_URI="ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux" +IUSE="dns +kmod static-libs +udev zlib" + +# 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}] ) + udev? ( >=virtual/libudev-208[static-libs(+),${MULTILIB_USEDEP}] ) +" +DEPEND=" + kmod? ( sys-apps/kmod ) + static-libs? ( ${LIB_DEPEND} ) + !static-libs? ( ${LIB_DEPEND//static-libs(+),} ) +" +RDEPEND=" + ${DEPEND} + sys-apps/hwids +" +DEPEND=" + ${DEPEND} + kmod? ( virtual/pkgconfig ) +" + +PATCHES=( + "${FILESDIR}"/${PN}-3.1.9-static-pc.patch + "${FILESDIR}"/${PN}-3.6.0-realpath.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)/misc' \ + 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/misc/pci.ids \ + "${ED}"/usr/share/man/man8/update-pciids.8* + + newinitd "${FILESDIR}"/init.d-pciparm pciparm + newconfd "${FILESDIR}"/conf.d-pciparm pciparm +} + +pkg_postinst() { + if [[ ${REPLACING_VERSIONS} ]] && [[ ${REPLACING_VERSIONS} < 3.2.0 ]]; then + elog "The 'network-cron' USE flag is gone; if you want a more up-to-date" + elog "pci.ids file, you should use sys-apps/hwids-99999999 (live ebuild)." + fi +}