pciutils-3.5.4.ebuild 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI="5"
  4. inherit eutils multilib toolchain-funcs multilib-minimal flag-o-matic
  5. DESCRIPTION="Various utilities dealing with the PCI bus"
  6. HOMEPAGE="http://mj.ucw.cz/sw/pciutils/ https://git.kernel.org/?p=utils/pciutils/pciutils.git"
  7. SRC_URI="ftp://atrey.karlin.mff.cuni.cz/pub/linux/pci/${P}.tar.gz"
  8. LICENSE="GPL-2"
  9. SLOT="0"
  10. 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"
  11. IUSE="dns +kmod static-libs +udev zlib"
  12. # Have the sub-libs in RDEPEND with [static-libs] since, logically,
  13. # our libpci.a depends on libz.a/etc... at runtime.
  14. LIB_DEPEND="zlib? ( >=sys-libs/zlib-1.2.8-r1[static-libs(+),${MULTILIB_USEDEP}] )
  15. udev? ( >=virtual/libudev-208[static-libs(+),${MULTILIB_USEDEP}] )"
  16. DEPEND="kmod? ( sys-apps/kmod )
  17. static-libs? ( ${LIB_DEPEND} )
  18. !static-libs? ( ${LIB_DEPEND//static-libs(+),} )"
  19. RDEPEND="${DEPEND}
  20. sys-apps/hwids"
  21. DEPEND="${DEPEND}
  22. kmod? ( virtual/pkgconfig )"
  23. PATCHES=(
  24. "${FILESDIR}"/${PN}-3.1.9-static-pc.patch
  25. )
  26. MULTILIB_WRAPPED_HEADERS=( /usr/include/pci/config.h )
  27. switch_config() {
  28. [[ $# -ne 2 ]] && return 1
  29. local opt=$1 val=$2
  30. sed "s@^\(${opt}=\).*\$@\1${val}@" -i Makefile || die
  31. return 0
  32. }
  33. src_prepare() {
  34. epatch "${PATCHES[@]}"
  35. if use static-libs ; then
  36. cp -pPR "${S}" "${S}.static" || die
  37. mv "${S}.static" "${S}/static" || die
  38. fi
  39. multilib_copy_sources
  40. }
  41. multilib_src_configure() {
  42. append-lfs-flags #471102
  43. }
  44. pemake() {
  45. emake \
  46. HOST="${CHOST}" \
  47. CROSS_COMPILE="${CHOST}-" \
  48. CC="$(tc-getCC)" \
  49. AR="$(tc-getAR)" \
  50. PKG_CONFIG="$(tc-getPKG_CONFIG)" \
  51. RANLIB="$(tc-getRANLIB)" \
  52. DNS=$(usex dns) \
  53. IDSDIR='$(SHAREDIR)/misc' \
  54. MANDIR='$(SHAREDIR)/man' \
  55. PREFIX="${EPREFIX}/usr" \
  56. SHARED="yes" \
  57. STRIP="" \
  58. ZLIB=$(usex zlib) \
  59. PCI_COMPRESSED_IDS=0 \
  60. PCI_IDS=pci.ids \
  61. LIBDIR="\${PREFIX}/$(get_libdir)" \
  62. LIBKMOD=$(multilib_native_usex kmod) \
  63. HWDB=$(usex udev) \
  64. "$@"
  65. }
  66. multilib_src_compile() {
  67. pemake OPT="${CFLAGS}" all
  68. if use static-libs ; then
  69. pemake \
  70. -C "${BUILD_DIR}/static" \
  71. OPT="${CFLAGS}" \
  72. SHARED="no" \
  73. lib/libpci.a
  74. fi
  75. }
  76. multilib_src_install() {
  77. pemake DESTDIR="${D}" install install-lib
  78. use static-libs && dolib.a "${BUILD_DIR}/static/lib/libpci.a"
  79. }
  80. multilib_src_install_all() {
  81. dodoc ChangeLog README TODO
  82. rm "${ED}"/usr/sbin/update-pciids "${ED}"/usr/share/misc/pci.ids \
  83. "${ED}"/usr/share/man/man8/update-pciids.8*
  84. newinitd "${FILESDIR}"/init.d-pciparm pciparm
  85. newconfd "${FILESDIR}"/conf.d-pciparm pciparm
  86. }
  87. pkg_postinst() {
  88. if [[ ${REPLACING_VERSIONS} ]] && [[ ${REPLACING_VERSIONS} < 3.2.0 ]]; then
  89. elog "The 'network-cron' USE flag is gone; if you want a more up-to-date"
  90. elog "pci.ids file, you should use sys-apps/hwids-99999999 (live ebuild)."
  91. fi
  92. }