/[gentoo-x86]/net-analyzer/wireshark/wireshark-1.8.2.ebuild
Gentoo

Contents of /net-analyzer/wireshark/wireshark-1.8.2.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.7 - (show annotations) (download)
Mon Sep 24 11:59:41 2012 UTC (2 years ago) by jer
Branch: MAIN
CVS Tags: HEAD
Changes since 1.6: +1 -1 lines
FILE REMOVED
Old (bug #433990).

(Portage version: 2.2.0_alpha131/cvs/Linux x86_64)

1 # Copyright 1999-2012 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.2.ebuild,v 1.6 2012/08/26 15:55:50 armin76 Exp $
4
5 EAPI="4"
6 PYTHON_DEPEND="python? 2"
7 inherit autotools eutils flag-o-matic python toolchain-funcs 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"
16 KEYWORDS="alpha amd64 ~arm hppa ia64 ~ppc ~ppc64 sparc x86 ~x86-fbsd"
17 IUSE="adns ares doc doc-pdf gtk ipv6 lua gcrypt geoip kerberos
18 profile +pcap portaudio python +caps selinux smi ssl zlib"
19
20 RDEPEND=">=dev-libs/glib-2.14:2
21 zlib? ( sys-libs/zlib
22 !=sys-libs/zlib-1.2.4 )
23 smi? ( net-libs/libsmi )
24 gtk? ( >=x11-libs/gtk+-2.4.0:2
25 x11-libs/pango
26 dev-libs/atk
27 x11-misc/xdg-utils )
28 ssl? ( <net-libs/gnutls-3 )
29 gcrypt? ( dev-libs/libgcrypt )
30 pcap? ( net-libs/libpcap )
31 caps? ( sys-libs/libcap )
32 kerberos? ( virtual/krb5 )
33 portaudio? ( media-libs/portaudio )
34 ares? ( >=net-dns/c-ares-1.5 )
35 !ares? ( adns? ( net-libs/adns ) )
36 geoip? ( dev-libs/geoip )
37 lua? ( >=dev-lang/lua-5.1 )
38 selinux? ( sec-policy/selinux-wireshark )"
39
40 DEPEND="${RDEPEND}
41 doc? ( dev-libs/libxslt
42 dev-libs/libxml2
43 app-doc/doxygen
44 doc-pdf? ( dev-java/fop ) )
45 virtual/pkgconfig
46 dev-lang/perl
47 sys-devel/bison
48 sys-apps/sed
49 sys-devel/flex
50 "
51
52 S=${WORKDIR}/${MY_P}
53
54 # borrowed from GSoC2010_Gentoo_Capabilities by constanze and flameyeys
55 # @FUNCTION: fcaps
56 # @USAGE: fcaps {uid:gid} {file-mode} {cap1[,cap2,...]} {file}
57 # @RETURN: 0 if all okay; non-zero if failure and fallback
58 # @DESCRIPTION:
59 # fcaps sets the specified capabilities in the effective and permitted set of
60 # the given file. In case of failure fcaps sets the given file-mode.
61 fcaps() {
62 local uid_gid=$1
63 local perms=$2
64 local capset=$3
65 local path=$4
66 local res
67
68 chmod $perms $path && \
69 chown $uid_gid $path
70 res=$?
71
72 use caps || return $res
73
74 #set the capability
75 setcap "$capset=ep" "$path" &> /dev/null
76 #check if the capabilitiy got set correctly
77 setcap -v "$capset=ep" "$path" &> /dev/null
78 res=$?
79
80 if [ $res -ne 0 ]; then
81 ewarn "Failed to set capabilities. Probable reason is missed kernel support."
82 ewarn "Kernel must have <FS>_FS_SECURITY enabled where <FS> is the filesystem"
83 ewarn "to store ${path} (e.g. EXT3_FS_SECURITY). For kernels version before"
84 ewarn "2.6.33_rc1 SECURITY_FILE_CAPABILITIES must be enabled as well."
85 ewarn
86 ewarn "Falling back to suid now..."
87 chmod u+s ${path}
88 fi
89 return $res
90 }
91
92 pkg_setup() {
93 if ! use gtk; then
94 ewarn "USE=-gtk disables gtk-based gui called wireshark."
95 ewarn "Only command line utils will be built available"
96 fi
97 if use python; then
98 python_set_active_version 2
99 python_pkg_setup
100 fi
101 # Add group for users allowed to sniff.
102 enewgroup wireshark
103 }
104
105 src_prepare() {
106 epatch "${FILESDIR}"/${PN}-1.8.1-ldflags.patch
107 sed -i -e 's|.png||g' ${PN}.desktop || die
108 eautoreconf
109 }
110
111 src_configure() {
112 local myconf
113
114 if [[ $(gcc-major-version) -lt 3 ||
115 ( $(gcc-major-version) -eq 3 &&
116 $(gcc-minor-version) -le 4 ) ]] ; then
117 die "Unsupported compiler version, please upgrade."
118 fi
119
120 if use ares && use adns; then
121 elog "You asked for both, ares and adns, but we can use only one of them."
122 elog "c-ares supersedes adns resolver thus using c-ares (ares USE flag)."
123 myconf="$(use_with ares c-ares) --without-adns"
124 else
125 myconf="$(use_with adns) $(use_with ares c-ares)"
126 fi
127
128 # profile and pie are incompatible #215806, #292991
129 if use profile; then
130 ewarn "You've enabled the 'profile' USE flag, building PIE binaries is disabled."
131 ewarn "Also ignore \"unrecognized option '-nopie'\" gcc warning #358101."
132 append-flags $(test-flags-CC -nopie)
133 fi
134
135 # Workaround bug #213705. If krb5-config --libs has -lcrypto then pass
136 # --with-ssl to ./configure. (Mimics code from acinclude.m4).
137 if use kerberos; then
138 case `krb5-config --libs` in
139 *-lcrypto*)
140 ewarn "Kerberos was built with ssl support: linkage with openssl is enabled."
141 ewarn "Note there are annoying license incompatibilities between the OpenSSL"
142 ewarn "license and the GPL, so do your check before distributing such package."
143 myconf+=" --with-ssl"
144 ;;
145 esac
146 fi
147
148 # Hack around inability to disable doxygen/fop doc generation
149 use doc || export ac_cv_prog_HAVE_DOXYGEN=false
150 use doc-pdf || export ac_cv_prog_HAVE_FOP=false
151
152 # dumpcap requires libcap, setuid-install requires dumpcap
153 econf \
154 $(use pcap && use_enable !caps setuid-install) \
155 $(use pcap && use_enable caps setcap-install) \
156 $(use_enable gtk wireshark) \
157 $(use_enable ipv6) \
158 $(use_enable profile profile-build) \
159 $(use_with caps libcap) \
160 $(use_with gcrypt) \
161 $(use_with geoip) \
162 $(use_with kerberos krb5) \
163 $(use_with lua) \
164 $(use_with pcap dumpcap-group wireshark) \
165 $(use_with pcap) \
166 $(use_with portaudio) \
167 $(use_with python) \
168 $(use_with smi libsmi) \
169 $(use_with ssl gnutls) \
170 $(use_with zlib) \
171 --disable-extra-gcc-checks \
172 --disable-usr-local \
173 --sysconfdir="${EPREFIX}"/etc/wireshark \
174 ${myconf}
175 }
176
177 src_compile() {
178 default
179 use doc && emake -C docbook
180 }
181
182 src_install() {
183 default
184 if use doc; then
185 dohtml -r docbook/{release-notes.html,ws{d,u}g_html{,_chunked}}
186 if use doc-pdf; then
187 insinto /usr/share/doc/${PF}/pdf/
188 doins docbook/{{developer,user}-guide,release-notes}-{a4,us}.pdf
189 fi
190 fi
191
192 # FAQ is not required as is installed from help/faq.txt
193 dodoc AUTHORS ChangeLog NEWS README{,.bsd,.linux,.macos,.vmware} \
194 doc/{randpkt.txt,README*}
195
196 insinto /usr/include/wiretap
197 doins wiretap/wtap.h
198
199 if use gtk; then
200 for c in hi lo; do
201 for d in 16 32 48; do
202 insinto /usr/share/icons/${c}color/${d}x${d}/apps
203 newins image/${c}${d}-app-wireshark.png wireshark.png
204 done
205 done
206 domenu wireshark.desktop
207 fi
208 use pcap && chmod o-x "${ED}"/usr/bin/dumpcap #357237
209 }
210
211 pkg_postinst() {
212 if use caps && use pcap; then
213 fcaps 0:wireshark 550 cap_dac_read_search,cap_net_raw,cap_net_admin "${EROOT}"/usr/bin/dumpcap
214 fi
215 echo
216 ewarn "NOTE: To run wireshark as normal user you have to add yourself to"
217 ewarn "the wireshark group. This security measure ensures that only trusted"
218 ewarn "users are allowed to sniff your traffic."
219 echo
220 }

  ViewVC Help
Powered by ViewVC 1.1.20