wireshark-99999999.ebuild 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. inherit autotools eutils fcaps flag-o-matic git-r3 multilib qmake-utils user
  5. DESCRIPTION="A network protocol analyzer formerly known as ethereal"
  6. HOMEPAGE="http://www.wireshark.org/"
  7. EGIT_REPO_URI="https://code.wireshark.org/review/wireshark"
  8. LICENSE="GPL-2"
  9. SLOT="0/${PV}"
  10. KEYWORDS=""
  11. IUSE="
  12. adns androiddump +caps ciscodump cpu_flags_x86_sse4_2 crypt doc doc-pdf
  13. geoip +gtk kerberos lua +netlink +pcap portaudio +qt5 sbc selinux smi
  14. libssh randpkt randpktdump sshdump ssl tfshark zlib
  15. "
  16. REQUIRED_USE="
  17. ciscodump? ( libssh )
  18. sshdump? ( libssh )
  19. ssl? ( crypt )
  20. "
  21. CDEPEND="
  22. >=dev-libs/glib-2.14:2
  23. netlink? ( dev-libs/libnl:3 )
  24. adns? ( >=net-dns/c-ares-1.5 )
  25. crypt? ( dev-libs/libgcrypt:0 )
  26. caps? ( sys-libs/libcap )
  27. geoip? ( dev-libs/geoip )
  28. gtk? (
  29. x11-libs/gdk-pixbuf
  30. x11-libs/gtk+:3
  31. x11-libs/pango
  32. x11-misc/xdg-utils
  33. )
  34. kerberos? ( virtual/krb5 )
  35. libssh? ( >=net-libs/libssh-0.6 )
  36. lua? ( >=dev-lang/lua-5.1:* )
  37. pcap? ( net-libs/libpcap )
  38. portaudio? ( media-libs/portaudio )
  39. qt5? (
  40. dev-qt/qtcore:5
  41. dev-qt/qtgui:5
  42. dev-qt/qtmultimedia:5
  43. dev-qt/qtprintsupport:5
  44. dev-qt/qtwidgets:5
  45. media-libs/speex
  46. x11-misc/xdg-utils
  47. )
  48. sbc? ( media-libs/sbc )
  49. smi? ( net-libs/libsmi )
  50. ssl? ( net-libs/gnutls:= )
  51. zlib? ( sys-libs/zlib !=sys-libs/zlib-1.2.4 )
  52. "
  53. # We need perl for `pod2html`. The rest of the perl stuff is to block older
  54. # and broken installs. #455122
  55. DEPEND="
  56. ${CDEPEND}
  57. dev-lang/perl
  58. !<virtual/perl-Pod-Simple-3.170
  59. !<perl-core/Pod-Simple-3.170
  60. doc? (
  61. app-doc/doxygen
  62. app-text/asciidoc
  63. dev-libs/libxml2
  64. dev-libs/libxslt
  65. doc-pdf? ( dev-java/fop )
  66. www-client/lynx
  67. )
  68. qt5? (
  69. dev-qt/linguist-tools:5
  70. )
  71. sys-devel/bison
  72. sys-devel/flex
  73. virtual/pkgconfig
  74. "
  75. RDEPEND="
  76. ${CDEPEND}
  77. gtk? ( virtual/freedesktop-icon-theme )
  78. qt5? ( virtual/freedesktop-icon-theme )
  79. selinux? ( sec-policy/selinux-wireshark )
  80. "
  81. PATCHES=(
  82. "${FILESDIR}"/${PN}-1.99.8-qtchooser.patch
  83. "${FILESDIR}"/${PN}-99999999-androiddump.patch
  84. "${FILESDIR}"/${PN}-99999999-sse4_2.patch
  85. )
  86. pkg_setup() {
  87. enewgroup wireshark
  88. }
  89. src_unpack() {
  90. git-r3_src_unpack
  91. }
  92. src_prepare() {
  93. default
  94. eautoreconf
  95. }
  96. src_configure() {
  97. local myconf
  98. # Workaround bug #213705. If krb5-config --libs has -lcrypto then pass
  99. # --with-ssl to ./configure. (Mimics code from acinclude.m4).
  100. if use kerberos; then
  101. case $(krb5-config --libs) in
  102. *-lcrypto*)
  103. ewarn "Kerberos was built with ssl support: linkage with openssl is enabled."
  104. ewarn "Note there are annoying license incompatibilities between the OpenSSL"
  105. ewarn "license and the GPL, so do your check before distributing such package."
  106. myconf+=( "--with-ssl" )
  107. ;;
  108. esac
  109. fi
  110. # Enable wireshark binary with any supported GUI toolkit (bug #473188)
  111. if use gtk || use qt5; then
  112. myconf+=( "--enable-wireshark" )
  113. else
  114. myconf+=( "--disable-wireshark" )
  115. fi
  116. if ! use qt5; then
  117. myconf+=( "--with-qt=no" )
  118. fi
  119. if use qt5; then
  120. export QT_MIN_VERSION=5.3.0
  121. append-cxxflags -fPIC -DPIC
  122. fi
  123. # Hack around inability to disable doxygen/fop doc generation
  124. use doc || export ac_cv_prog_HAVE_DOXYGEN=false
  125. use doc-pdf || export ac_cv_prog_HAVE_FOP=false
  126. # dumpcap requires libcap
  127. # --disable-profile-build bugs #215806, #292991, #479602
  128. econf \
  129. $(use androiddump && use pcap && echo --enable-androiddump-use-libpcap=yes) \
  130. $(use_enable androiddump) \
  131. $(use_enable ciscodump) \
  132. $(use_enable randpkt) \
  133. $(use_enable randpktdump) \
  134. $(use_enable sshdump) \
  135. $(use_enable tfshark) \
  136. $(use_with adns c-ares) \
  137. $(use_with caps libcap) \
  138. $(use_with crypt gcrypt) \
  139. $(use_with geoip) \
  140. $(use_with gtk gtk 3) \
  141. $(use_with kerberos krb5) \
  142. $(use_with libssh ssh) \
  143. $(use_with lua) \
  144. $(use_with pcap dumpcap-group wireshark) \
  145. $(use_with pcap) \
  146. $(use_with portaudio) \
  147. $(use_with sbc) \
  148. $(use_with smi libsmi) \
  149. $(use_with ssl gnutls) \
  150. $(use_with zlib) \
  151. $(usex cpu_flags_x86_sse4_2 --enable-sse4_2 '') \
  152. $(usex netlink --with-libnl=3 --without-libnl) \
  153. $(usex qt5 --with-qt=5 '') \
  154. $(usex qt5 LRELEASE=$(qt5_get_bindir)/lrelease '') \
  155. $(usex qt5 MOC=$(qt5_get_bindir)/moc '') \
  156. $(usex qt5 RCC=$(qt5_get_bindir)/rcc '') \
  157. $(usex qt5 UIC=$(qt5_get_bindir)/uic '') \
  158. --disable-profile-build \
  159. --disable-warnings-as-errors \
  160. --sysconfdir="${EPREFIX}"/etc/wireshark \
  161. ${myconf[@]}
  162. }
  163. src_compile() {
  164. default
  165. if use doc; then
  166. emake -j1 -C docbook
  167. if use doc-pdf; then
  168. addpredict "/root/.java"
  169. emake -C docbook all-pdf
  170. fi
  171. fi
  172. }
  173. src_install() {
  174. default
  175. # FAQ is not required as is installed from help/faq.txt
  176. dodoc AUTHORS ChangeLog NEWS README{,.bsd,.linux,.macos,.vmware} \
  177. doc/{randpkt.txt,README*}
  178. if use doc; then
  179. docinto /usr/share/doc/${PF}/html
  180. dodoc -r docbook/{release-notes.html,ws{d,u}g_html{,_chunked}}
  181. if use doc-pdf; then
  182. docinto /usr/share/doc/${PF}/pdf/
  183. dodoc docbook/{developer,user}-guide-{a4,us}.pdf docbook/release-notes.pdf
  184. fi
  185. fi
  186. # install headers
  187. local wsheader
  188. for wsheader in \
  189. config.h \
  190. epan/*.h \
  191. epan/crypt/*.h \
  192. epan/dfilter/*.h \
  193. epan/dissectors/*.h \
  194. epan/ftypes/*.h \
  195. epan/wmem/*.h \
  196. register.h \
  197. wiretap/*.h \
  198. ws_diag_control.h \
  199. ws_symbol_export.h \
  200. wsutil/*.h
  201. do
  202. insinto /usr/include/wireshark/$( dirname ${wsheader} )
  203. doins ${wsheader}
  204. done
  205. #with the above this really shouldn't be needed, but things may be looking in wiretap/ instead of wireshark/wiretap/
  206. insinto /usr/include/wiretap
  207. doins wiretap/wtap.h
  208. if use gtk || use qt5; then
  209. local c d
  210. for c in hi lo; do
  211. for d in 16 32 48; do
  212. insinto /usr/share/icons/${c}color/${d}x${d}/apps
  213. newins image/${c}${d}-app-wireshark.png wireshark.png
  214. done
  215. done
  216. for d in 16 24 32 48 64 128 256 ; do
  217. insinto /usr/share/icons/hicolor/${d}x${d}/mimetypes
  218. newins image/WiresharkDoc-${d}.png application-vnd.tcpdump.pcap.png
  219. done
  220. fi
  221. prune_libtool_files
  222. }
  223. pkg_postinst() {
  224. # Add group for users allowed to sniff.
  225. enewgroup wireshark
  226. if use pcap; then
  227. fcaps -o 0 -g wireshark -m 4710 -M 0710 \
  228. cap_dac_read_search,cap_net_raw,cap_net_admin \
  229. "${EROOT}"/usr/bin/dumpcap
  230. fi
  231. ewarn "NOTE: To capture traffic with wireshark as normal user you have to"
  232. ewarn "add yourself to the wireshark group. This security measure ensures"
  233. ewarn "that only trusted users are allowed to sniff your traffic."
  234. }