Advertisement
theroot

wireshark-1.8.6-r2.ebuild

Apr 24th, 2013
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.47 KB | None | 0 0
  1. # Copyright 1999-2013 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: /var/cvsroot/gentoo-x86/net-analyzer/wireshark/wireshark-1.8.6-r1.ebuild,v 1.4 2013/04/23 20:55:57 jer Exp $
  4.  
  5. EAPI=5
  6. PYTHON_COMPAT=( python2_5 python2_6 python2_7 )
  7. inherit autotools eutils fcaps flag-o-matic python-single-r1 user
  8.  
  9. [[ -n ${PV#*_rc} && ${PV#*_rc} != ${PV} ]] && MY_P=${PN}-${PV/_} || MY_P=${P}
  10. DESCRIPTION="A network protocol analyzer formerly known as ethereal"
  11. HOMEPAGE="http://www.wireshark.org/"
  12. SRC_URI="http://www.wireshark.org/download/src/all-versions/${MY_P}.tar.bz2"
  13.  
  14. LICENSE="GPL-2"
  15. SLOT="0/${PV}"
  16. KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
  17. IUSE="
  18. adns +caps crypt doc doc-pdf geoip gtk ipv6 kerberos libadns lua +pcap
  19. portaudio profile python selinux smi ssl zlib
  20. "
  21. RDEPEND="
  22. >=dev-libs/glib-2.14:2
  23. adns? ( !libadns? ( >=net-dns/c-ares-1.5 ) )
  24. caps? ( sys-libs/libcap )
  25. crypt? ( dev-libs/libgcrypt )
  26. geoip? ( dev-libs/geoip )
  27. gtk? (
  28. >=x11-libs/gtk+-2.4.0:2
  29. dev-libs/atk
  30. x11-libs/pango
  31. x11-misc/xdg-utils
  32. )
  33. kerberos? ( virtual/krb5 )
  34. libadns? ( net-libs/adns )
  35. lua? ( >=dev-lang/lua-5.1 )
  36. pcap? ( net-libs/libpcap )
  37. portaudio? ( media-libs/portaudio )
  38. python? ( ${PYTHON_DEPS} )
  39. selinux? ( sec-policy/selinux-wireshark )
  40. smi? ( net-libs/libsmi )
  41. ssl? ( net-libs/gnutls dev-libs/libgcrypt )
  42. zlib? ( sys-libs/zlib !=sys-libs/zlib-1.2.4 )
  43. "
  44.  
  45. DEPEND="
  46. ${RDEPEND}
  47. dev-lang/perl
  48. doc? (
  49. app-doc/doxygen
  50. dev-libs/libxml2
  51. dev-libs/libxslt
  52. doc-pdf? ( dev-java/fop )
  53. )
  54. sys-apps/sed
  55. sys-devel/bison
  56. sys-devel/flex
  57. virtual/pkgconfig
  58. "
  59.  
  60. S=${WORKDIR}/${MY_P}
  61.  
  62. pkg_setup() {
  63. if ! use gtk; then
  64. ewarn "USE=-gtk disables gtk-based gui called wireshark."
  65. ewarn "Only command line utils will be built available"
  66. fi
  67.  
  68. if use python; then
  69. python-single-r1_pkg_setup
  70. fi
  71. }
  72.  
  73. src_prepare() {
  74.  
  75. epatch \
  76. "${FILESDIR}"/${PN}-1.6.13-ldflags.patch \
  77. "${FILESDIR}"/${PN}-1.8.3-gnutls3.patch
  78.  
  79. epatch_user
  80.  
  81. sed -i \
  82. -e '/^Icon/s|.png||g' \
  83. ${PN}.desktop || die
  84.  
  85. eautoreconf
  86. }
  87.  
  88. src_configure() {
  89. local myconf
  90.  
  91. # profile and pie are incompatible #215806, #292991
  92. if use profile; then
  93. ewarn "You've enabled the 'profile' USE flag, building PIE binaries is disabled."
  94. ewarn "Also ignore \"unrecognized option '-nopie'\" gcc warning #358101."
  95. append-flags $(test-flags-CC -nopie)
  96. fi
  97.  
  98. if use adns; then
  99. if use libadns; then
  100. myconf+=( "--with-adns --without-c-ares" )
  101. else
  102. myconf+=( "--without-adns --with-c-ares" )
  103. fi
  104. else
  105. if use libadns; then
  106. myconf+=( "--with-adns --without-c-ares" )
  107. else
  108. myconf+=( "--without-adns --without-c-ares" )
  109. fi
  110. fi
  111.  
  112. # Workaround bug #213705. If krb5-config --libs has -lcrypto then pass
  113. # --with-ssl to ./configure. (Mimics code from acinclude.m4).
  114. if use kerberos; then
  115. case `krb5-config --libs` in
  116. *-lcrypto*)
  117. ewarn "Kerberos was built with ssl support: linkage with openssl is enabled."
  118. ewarn "Note there are annoying license incompatibilities between the OpenSSL"
  119. ewarn "license and the GPL, so do your check before distributing such package."
  120. myconf+=( "--with-ssl" )
  121. ;;
  122. esac
  123. fi
  124.  
  125. # Hack around inability to disable doxygen/fop doc generation
  126. use doc || export ac_cv_prog_HAVE_DOXYGEN=false
  127. use doc-pdf || export ac_cv_prog_HAVE_FOP=false
  128.  
  129. # dumpcap requires libcap, setuid-install requires dumpcap
  130. econf \
  131. $(use pcap && use_enable !caps setuid-install) \
  132. $(use pcap && use_enable caps setcap-install) \
  133. $(use_enable gtk wireshark) \
  134. $(use_enable ipv6) \
  135. $(use_enable profile profile-build) \
  136. $(use_with crypt gcrypt) \
  137. $(use_with caps libcap) \
  138. $(use_with geoip) \
  139. $(use_with kerberos krb5) \
  140. $(use_with lua) \
  141. $(use_with pcap dumpcap-group wireshark) \
  142. $(use_with pcap) \
  143. $(use_with portaudio) \
  144. $(use_with python) \
  145. $(use_with smi libsmi) \
  146. $(use_with ssl gnutls) \
  147. $(use_with zlib) \
  148. --disable-extra-gcc-checks \
  149. --disable-usr-local \
  150. --sysconfdir="${EPREFIX}"/etc/wireshark \
  151. ${myconf[@]}
  152. }
  153.  
  154. src_compile() {
  155. default
  156. use doc && emake -C docbook
  157. }
  158.  
  159. src_install() {
  160. default
  161. if use doc; then
  162. dohtml -r docbook/{release-notes.html,ws{d,u}g_html{,_chunked}}
  163. if use doc-pdf; then
  164. insinto /usr/share/doc/${PF}/pdf/
  165. doins docbook/{{developer,user}-guide,release-notes}-{a4,us}.pdf
  166. fi
  167. fi
  168.  
  169. # FAQ is not required as is installed from help/faq.txt
  170. dodoc AUTHORS ChangeLog NEWS README{,.bsd,.linux,.macos,.vmware} \
  171. doc/{randpkt.txt,README*}
  172.  
  173. # install headers
  174. local wsheader
  175. for wsheader in $( echo $(< debian/wireshark-dev.header-files ) ); do
  176. insinto /usr/include/wireshark/$( dirname ${wsheader} )
  177. doins ${wsheader}
  178. done
  179.  
  180. #with the above this really shouldn't be needed, but things may be looking in wiretap/ instead of wireshark/wiretap/
  181. insinto /usr/include/wiretap
  182. doins wiretap/wtap.h
  183.  
  184. if use gtk; then
  185. for c in hi lo; do
  186. for d in 16 32 48; do
  187. insinto /usr/share/icons/${c}color/${d}x${d}/apps
  188. newins image/${c}${d}-app-wireshark.png wireshark.png
  189. done
  190. done
  191. domenu wireshark.desktop
  192. fi
  193.  
  194. use pcap && chmod o-x "${ED}"/usr/bin/dumpcap #357237
  195.  
  196. if use python; then
  197. python_optimize "${ED}"/usr/lib*/wireshark/python
  198. fi
  199. }
  200.  
  201. pkg_postinst() {
  202. # Add group for users allowed to sniff.
  203. enewgroup wireshark
  204.  
  205. if use pcap; then
  206. fcaps -o 0 -g wireshark -m 4550 -M 0750 \
  207. cap_dac_read_search,cap_net_raw,cap_net_admin \
  208. "${EROOT}"/usr/bin/dumpcap
  209. fi
  210.  
  211. ewarn "NOTE: To run wireshark as normal user you have to add yourself to"
  212. ewarn "the wireshark group. This security measure ensures that only trusted"
  213. ewarn "users are allowed to sniff your traffic."
  214. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement