iputils-20151218.ebuild 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. # Copyright 1999-2016 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # For released versions, we precompile the man/html pages and store
  4. # them in a tarball on our mirrors. This avoids ugly issues while
  5. # building stages, and when the jade/sgml packages are broken (which
  6. # seems to be more common than would be nice).
  7. EAPI=5
  8. inherit flag-o-matic eutils toolchain-funcs fcaps
  9. if [[ ${PV} == "99999999" ]] ; then
  10. EGIT_REPO_URI="git://www.linux-ipv6.org/gitroot/iputils"
  11. inherit git-2
  12. else
  13. SRC_URI="http://www.skbuff.net/iputils/iputils-s${PV}.tar.bz2
  14. https://dev.gentoo.org/~polynomial-c/iputils-s${PV}-manpages.tar.xz"
  15. KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-linux ~x86-linux"
  16. fi
  17. DESCRIPTION="Network monitoring tools including ping and ping6"
  18. HOMEPAGE="https://wiki.linuxfoundation.org/networking/iputils"
  19. LICENSE="BSD-4"
  20. SLOT="0"
  21. IUSE="arping caps clockdiff doc gcrypt idn ipv6 libressl rarpd rdisc SECURITY_HAZARD ssl static tftpd tracepath traceroute"
  22. LIB_DEPEND="caps? ( sys-libs/libcap[static-libs(+)] )
  23. idn? ( net-dns/libidn[static-libs(+)] )
  24. ipv6? ( ssl? (
  25. gcrypt? ( dev-libs/libgcrypt:0=[static-libs(+)] )
  26. !gcrypt? (
  27. !libressl? ( dev-libs/openssl:0[static-libs(+)] )
  28. libressl? ( dev-libs/libressl[static-libs(+)] )
  29. )
  30. ) )"
  31. RDEPEND="arping? ( !net-misc/arping )
  32. rarpd? ( !net-misc/rarpd )
  33. traceroute? ( !net-analyzer/traceroute )
  34. !static? ( ${LIB_DEPEND//\[static-libs(+)]} )"
  35. DEPEND="${RDEPEND}
  36. static? ( ${LIB_DEPEND} )
  37. virtual/os-headers"
  38. if [[ ${PV} == "99999999" ]] ; then
  39. DEPEND+="
  40. app-text/openjade
  41. dev-perl/SGMLSpm
  42. app-text/docbook-sgml-dtd
  43. app-text/docbook-sgml-utils
  44. "
  45. fi
  46. S=${WORKDIR}/${PN}-s${PV}
  47. PATCHES=(
  48. "${FILESDIR}"/021109-uclibc-no-ether_ntohost.patch
  49. "${FILESDIR}"/${PN}-99999999-openssl.patch #335436
  50. "${FILESDIR}"/${PN}-99999999-tftpd-syslog.patch
  51. "${FILESDIR}"/${PN}-20121221-makefile.patch
  52. "${FILESDIR}"/${PN}-20121221-parallel-doc.patch
  53. "${FILESDIR}"/${PN}-20121221-strtod.patch #472592
  54. )
  55. src_prepare() {
  56. use SECURITY_HAZARD && PATCHES+=( "${FILESDIR}"/${PN}-20071127-nonroot-floodping.patch )
  57. epatch "${PATCHES[@]}"
  58. }
  59. src_configure() {
  60. use static && append-ldflags -static
  61. IPV4_TARGETS=(
  62. ping
  63. $(for v in arping clockdiff rarpd rdisc tftpd tracepath ; do usev ${v} ; done)
  64. )
  65. IPV6_TARGETS=(
  66. ping6
  67. $(usex tracepath 'tracepath6' '')
  68. $(usex traceroute 'traceroute6' '')
  69. )
  70. use ipv6 || IPV6_TARGETS=()
  71. }
  72. ldflag_resolv() {
  73. # See if the system includes a libresolv. #584132
  74. echo "main(){}" > "${T}"/resolv.c
  75. if ${CC} ${CFLAGS} ${LDFLAGS} "${T}"/resolv.c -lresolv -o "${T}"/resolv 2>/dev/null ; then
  76. echo -lresolv
  77. fi
  78. }
  79. src_compile() {
  80. tc-export CC
  81. emake \
  82. USE_CAP=$(usex caps) \
  83. USE_IDN=$(usex idn) \
  84. USE_GCRYPT=$(usex gcrypt) \
  85. USE_CRYPTO=$(usex ssl) \
  86. LDFLAG_RESOLV=$(ldflag_resolv) \
  87. IPV4_TARGETS="${IPV4_TARGETS[*]}" \
  88. IPV6_TARGETS="${IPV6_TARGETS[*]}"
  89. if [[ ${PV} == "99999999" ]] ; then
  90. emake html man
  91. fi
  92. }
  93. src_install() {
  94. into /
  95. dobin ping $(usex ipv6 'ping6' '')
  96. use ipv6 && dosym ping.8 /usr/share/man/man8/ping6.8
  97. doman doc/ping.8
  98. if use arping ; then
  99. dobin arping
  100. doman doc/arping.8
  101. fi
  102. into /usr
  103. local u
  104. for u in clockdiff rarpd rdisc tftpd tracepath ; do
  105. if use ${u} ; then
  106. case ${u} in
  107. clockdiff) dobin ${u};;
  108. *) dosbin ${u};;
  109. esac
  110. doman doc/${u}.8
  111. fi
  112. done
  113. if use tracepath && use ipv6 ; then
  114. dosbin tracepath6
  115. dosym tracepath.8 /usr/share/man/man8/tracepath6.8
  116. fi
  117. if use traceroute && use ipv6 ; then
  118. dosbin traceroute6
  119. doman doc/traceroute6.8
  120. fi
  121. if use rarpd ; then
  122. newinitd "${FILESDIR}"/rarpd.init.d rarpd
  123. newconfd "${FILESDIR}"/rarpd.conf.d rarpd
  124. fi
  125. dodoc INSTALL RELNOTES
  126. use doc && dohtml doc/*.html
  127. }
  128. pkg_postinst() {
  129. fcaps cap_net_raw \
  130. bin/ping \
  131. $(usex ipv6 'bin/ping6' '') \
  132. $(usex arping 'bin/arping' '') \
  133. $(usex clockdiff 'usr/bin/clockdiff' '')
  134. }