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

Contents of /net-analyzer/wireshark/wireshark-1.6.9-r1.ebuild

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.3 - (show annotations) (download)
Fri Aug 31 17:00:18 2012 UTC (2 years ago) by jer
Branch: MAIN
CVS Tags: HEAD
Changes since 1.2: +1 -1 lines
FILE REMOVED
Old.

(Portage version: 2.2.0_alpha123/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.6.9-r1.ebuild,v 1.2 2012/08/07 09:02:01 jer Exp $
4
5 EAPI="3"
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 ~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 threads 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 \
107 "${FILESDIR}"/${PN}-1.6.6-gtk-pcap.patch \
108 "${FILESDIR}"/${PN}-1.8.1-ldflags.patch
109 eautoreconf
110 }
111
112 src_configure() {
113 local myconf
114
115 if [[ $(gcc-major-version) -lt 3 ||
116 ( $(gcc-major-version) -eq 3 &&
117 $(gcc-minor-version) -le 4 ) ]] ; then
118 die "Unsupported compiler version, please upgrade."
119 fi
120
121 if use ares && use adns; then
122 elog "You asked for both, ares and adns, but we can use only one of them."
123 elog "c-ares supersedes adns resolver thus using c-ares (ares USE flag)."
124 myconf="$(use_with ares c-ares) --without-adns"
125 else
126 myconf="$(use_with adns) $(use_with ares c-ares)"
127 fi
128
129 # profile and pie are incompatible #215806, #292991
130 if use profile; then
131 ewarn "You've enabled the 'profile' USE flag, building PIE binaries is disabled."
132 ewarn "Also ignore \"unrecognized option '-nopie'\" gcc warning #358101."
133 append-flags $(test-flags-CC -nopie)
134 fi
135
136 # Workaround bug #213705. If krb5-config --libs has -lcrypto then pass
137 # --with-ssl to ./configure. (Mimics code from acinclude.m4).
138 if use kerberos; then
139 case `krb5-config --libs` in
140 *-lcrypto*)
141 ewarn "Kerberos was built with ssl support: linkage with openssl is enabled."
142 ewarn "Note there are annoying license incompatibilities between the OpenSSL"
143 ewarn "license and the GPL, so do your check before distributing such package."
144 myconf+=" --with-ssl"
145 ;;
146 esac
147 fi
148
149 # Hack around inability to disable doxygen/fop doc generation
150 use doc || export ac_cv_prog_HAVE_DOXYGEN=false
151 use doc-pdf || export ac_cv_prog_HAVE_FOP=false
152
153 # dumpcap requires libcap, setuid-install requires dumpcap
154 econf $(use_enable gtk wireshark) \
155 $(use_enable profile profile-build) \
156 $(use_with ssl gnutls) \
157 $(use_with gcrypt) \
158 $(use_enable ipv6) \
159 $(use_enable threads) \
160 $(use_with lua) \
161 $(use_with kerberos krb5) \
162 $(use_with smi libsmi) \
163 $(use_with zlib) \
164 $(use_with geoip) \
165 $(use_with portaudio) \
166 $(use_with python) \
167 $(use_with caps libcap) \
168 $(use_with pcap) \
169 $(use_with pcap dumpcap-group wireshark) \
170 $(use pcap && use_enable caps setcap-install) \
171 $(use pcap && use_enable !caps setuid-install) \
172 --sysconfdir="${EPREFIX}"/etc/wireshark \
173 --disable-extra-gcc-checks \
174 ${myconf}
175 }
176
177 src_compile() {
178 emake || die
179 use doc && cd docbook && { emake || die; }
180 }
181
182 src_install() {
183 emake DESTDIR="${D}" install || die "emake install failed"
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 || die
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 || die
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 || die
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