1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit autotools eutils fcaps flag-o-matic multilib qmake-utils qt4-r2 user
8 DESCRIPTION="A network protocol analyzer formerly known as ethereal"
9 HOMEPAGE="http://www.wireshark.org/"
10 SRC_URI="${HOMEPAGE}download/src/all-versions/${P/_/}.tar.bz2"
14 KEYWORDS="alpha amd64 ~arm hppa ia64 ppc ppc64 sparc x86 ~x86-fbsd"
16 adns androiddump +caps crypt doc doc-pdf geoip +gtk3 ipv6 kerberos lua
17 +netlink +pcap portaudio +qt4 qt5 selinux sbc smi tfshark
18 cpu_flags_x86_sse4_2 ssl zlib
33 >=dev-libs/glib-2.14:2
34 netlink? ( dev-libs/libnl:3 )
35 adns? ( >=net-dns/c-ares-1.5 )
36 crypt? ( dev-libs/libgcrypt:0 )
37 caps? ( sys-libs/libcap )
38 geoip? ( dev-libs/geoip )
43 kerberos? ( virtual/krb5 )
44 lua? ( >=dev-lang/lua-5.1:* )
45 pcap? ( net-libs/libpcap )
46 portaudio? ( media-libs/portaudio )
49 dev-qt/qtgui:4[accessibility]
56 dev-qt/qtprintsupport:5
60 sbc? ( media-libs/sbc )
61 smi? ( net-libs/libsmi )
62 ssl? ( net-libs/gnutls )
63 zlib? ( sys-libs/zlib !=sys-libs/zlib-1.2.4 )
65 # We need perl for `pod2html`. The rest of the perl stuff is to block older
66 # and broken installs. #455122
70 !<virtual/perl-Pod-Simple-3.170
71 !<perl-core/Pod-Simple-3.170
77 doc-pdf? ( dev-java/fop )
86 gtk3? ( virtual/freedesktop-icon-theme )
87 qt4? ( virtual/freedesktop-icon-theme )
88 qt5? ( virtual/freedesktop-icon-theme )
89 selinux? ( sec-policy/selinux-wireshark )
98 "${FILESDIR}"/${PN}-1.6.13-ldflags.patch \
99 "${FILESDIR}"/${PN}-1.11.0-oldlibs.patch \
100 "${FILESDIR}"/${PN}-99999999-pkgconfig.patch \
101 "${FILESDIR}"/${PN}-1.99.8-qtchooser.patch \
102 "${FILESDIR}"/${PN}-2.0.0-androiddump-pcap.patch \
103 "${FILESDIR}"/${PN}-2.1.0-sse4_2.patch
113 # Workaround bug #213705. If krb5-config --libs has -lcrypto then pass
114 # --with-ssl to ./configure. (Mimics code from acinclude.m4).
115 if use kerberos; then
116 case $(krb5-config --libs) in
118 ewarn "Kerberos was built with ssl support: linkage with openssl is enabled."
119 ewarn "Note there are annoying license incompatibilities between the OpenSSL"
120 ewarn "license and the GPL, so do your check before distributing such package."
121 myconf+=( "--with-ssl" )
126 # Enable wireshark binary with any supported GUI toolkit (bug #473188)
127 if use gtk3 || use qt4 || use qt5; then
128 myconf+=( "--enable-wireshark" )
130 myconf+=( "--disable-wireshark" )
133 if ! use qt4 && ! use qt5; then
134 myconf+=( "--with-qt=no" )
138 export QT_MIN_VERSION=4.6.0
142 export QT_MIN_VERSION=5.3.0
143 append-cxxflags -fPIC -DPIC
146 # Hack around inability to disable doxygen/fop doc generation
147 use doc || export ac_cv_prog_HAVE_DOXYGEN=false
148 use doc-pdf || export ac_cv_prog_HAVE_FOP=false
150 # dumpcap requires libcap
151 # --disable-profile-build bugs #215806, #292991, #479602
153 $(use androiddump && use pcap && echo --enable-androiddump-use-libpcap=yes) \
154 $(use_enable androiddump) \
156 $(use_enable tfshark) \
157 $(use_with adns c-ares) \
158 $(use_with caps libcap) \
159 $(use_with crypt gcrypt) \
162 $(use_with kerberos krb5) \
164 $(use_with pcap dumpcap-group wireshark) \
166 $(use_with portaudio) \
167 $(usex qt4 --with-qt=4 '') \
168 $(usex qt5 --with-qt=5 '') \
169 $(usex qt4 MOC=$(qt4_get_bindir)/moc '') \
170 $(usex qt4 RCC=$(qt4_get_bindir)/rcc '') \
171 $(usex qt4 UIC=$(qt4_get_bindir)/uic '') \
172 $(usex qt5 MOC=$(qt5_get_bindir)/moc '') \
173 $(usex qt5 RCC=$(qt5_get_bindir)/rcc '') \
174 $(usex qt5 UIC=$(qt5_get_bindir)/uic '') \
176 $(use_with smi libsmi) \
177 $(use_with ssl gnutls) \
179 $(usex netlink --with-libnl=3 --without-libnl) \
180 $(usex cpu_flags_x86_sse4_2 --enable-sse4_2 '') \
181 --disable-profile-build \
182 --disable-usr-local \
183 --disable-warnings-as-errors \
184 --sysconfdir="${EPREFIX}"/etc/wireshark \
192 use doc-pdf && addpredict "/root/.java"
201 dohtml -r docbook/{release-notes.html,ws{d,u}g_html{,_chunked}}
203 insinto /usr/share/doc/${PF}/pdf/
204 doins docbook/{developer,user}-guide-{a4,us}.pdf docbook/release-notes.pdf
208 # FAQ is not required as is installed from help/faq.txt
209 dodoc AUTHORS ChangeLog NEWS README{,.bsd,.linux,.macos,.vmware} \
210 doc/{randpkt.txt,README*}
220 epan/dissectors/*.h \
228 insinto /usr/include/wireshark/$( dirname ${wsheader} )
232 #with the above this really shouldn't be needed, but things may be looking in wiretap/ instead of wireshark/wiretap/
233 insinto /usr/include/wiretap
236 if use gtk3 || use qt4 || use qt5; then
239 for d in 16 32 48; do
240 insinto /usr/share/icons/${c}color/${d}x${d}/apps
241 newins image/${c}${d}-app-wireshark.png wireshark.png
244 for d in 16 24 32 48 64 128 256 ; do
245 insinto /usr/share/icons/hicolor/${d}x${d}/mimetypes
246 newins image/WiresharkDoc-${d}.png application-vnd.tcpdump.pcap.png
251 domenu wireshark.desktop
254 if use qt4 || use qt5; then
256 -e '/Exec=/s|wireshark|&-qt|g' \
257 -e 's|^Name.*=Wireshark|& (Qt)|g' \
258 wireshark.desktop > wireshark-qt.desktop \
260 domenu wireshark-qt.desktop
267 # Add group for users allowed to sniff.
271 fcaps -o 0 -g wireshark -m 4710 -M 0710 \
272 cap_dac_read_search,cap_net_raw,cap_net_admin \
273 "${EROOT}"/usr/bin/dumpcap
276 ewarn "NOTE: To capture traffic with wireshark as normal user you have to"
277 ewarn "add yourself to the wireshark group. This security measure ensures"
278 ewarn "that only trusted users are allowed to sniff your traffic."