/[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.1 - (hide annotations) (download)
Wed Aug 15 22:17:22 2012 UTC (2 years ago) by jer
Branch: MAIN
Version bump (bug #431572).

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

1 jer 1.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.1-r1.ebuild,v 1.5 2012/08/07 09:02:01 jer 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     eautoreconf
108     }
109    
110     src_configure() {
111     local myconf
112    
113     if [[ $(gcc-major-version) -lt 3 ||
114     ( $(gcc-major-version) -eq 3 &&
115     $(gcc-minor-version) -le 4 ) ]] ; then
116     die "Unsupported compiler version, please upgrade."
117     fi
118    
119     if use ares && use adns; then
120     elog "You asked for both, ares and adns, but we can use only one of them."
121     elog "c-ares supersedes adns resolver thus using c-ares (ares USE flag)."
122     myconf="$(use_with ares c-ares) --without-adns"
123     else
124     myconf="$(use_with adns) $(use_with ares c-ares)"
125     fi
126    
127     # profile and pie are incompatible #215806, #292991
128     if use profile; then
129     ewarn "You've enabled the 'profile' USE flag, building PIE binaries is disabled."
130     ewarn "Also ignore \"unrecognized option '-nopie'\" gcc warning #358101."
131     append-flags $(test-flags-CC -nopie)
132     fi
133    
134     # Workaround bug #213705. If krb5-config --libs has -lcrypto then pass
135     # --with-ssl to ./configure. (Mimics code from acinclude.m4).
136     if use kerberos; then
137     case `krb5-config --libs` in
138     *-lcrypto*)
139     ewarn "Kerberos was built with ssl support: linkage with openssl is enabled."
140     ewarn "Note there are annoying license incompatibilities between the OpenSSL"
141     ewarn "license and the GPL, so do your check before distributing such package."
142     myconf+=" --with-ssl"
143     ;;
144     esac
145     fi
146    
147     # Hack around inability to disable doxygen/fop doc generation
148     use doc || export ac_cv_prog_HAVE_DOXYGEN=false
149     use doc-pdf || export ac_cv_prog_HAVE_FOP=false
150    
151     # dumpcap requires libcap, setuid-install requires dumpcap
152     econf \
153     $(use pcap && use_enable !caps setuid-install) \
154     $(use pcap && use_enable caps setcap-install) \
155     $(use_enable gtk wireshark) \
156     $(use_enable ipv6) \
157     $(use_enable profile profile-build) \
158     $(use_with caps libcap) \
159     $(use_with gcrypt) \
160     $(use_with geoip) \
161     $(use_with kerberos krb5) \
162     $(use_with lua) \
163     $(use_with pcap dumpcap-group wireshark) \
164     $(use_with pcap) \
165     $(use_with portaudio) \
166     $(use_with python) \
167     $(use_with smi libsmi) \
168     $(use_with ssl gnutls) \
169     $(use_with zlib) \
170     --disable-extra-gcc-checks \
171     --disable-usr-local \
172     --sysconfdir="${EPREFIX}"/etc/wireshark \
173     ${myconf}
174     }
175    
176     src_compile() {
177     default
178     use doc && emake -C docbook
179     }
180    
181     src_install() {
182     default
183     if use doc; then
184     dohtml -r docbook/{release-notes.html,ws{d,u}g_html{,_chunked}}
185     if use doc-pdf; then
186     insinto /usr/share/doc/${PF}/pdf/
187     doins docbook/{{developer,user}-guide,release-notes}-{a4,us}.pdf
188     fi
189     fi
190    
191     # FAQ is not required as is installed from help/faq.txt
192     dodoc AUTHORS ChangeLog NEWS README{,.bsd,.linux,.macos,.vmware} \
193     doc/{randpkt.txt,README*}
194    
195     insinto /usr/include/wiretap
196     doins wiretap/wtap.h
197    
198     if use gtk; then
199     for c in hi lo; do
200     for d in 16 32 48; do
201     insinto /usr/share/icons/${c}color/${d}x${d}/apps
202     newins image/${c}${d}-app-wireshark.png wireshark.png
203     done
204     done
205     domenu wireshark.desktop
206     fi
207     use pcap && chmod o-x "${ED}"/usr/bin/dumpcap #357237
208     }
209    
210     pkg_postinst() {
211     if use caps && use pcap; then
212     fcaps 0:wireshark 550 cap_dac_read_search,cap_net_raw,cap_net_admin "${EROOT}"/usr/bin/dumpcap
213     fi
214     echo
215     ewarn "NOTE: To run wireshark as normal user you have to add yourself to"
216     ewarn "the wireshark group. This security measure ensures that only trusted"
217     ewarn "users are allowed to sniff your traffic."
218     echo
219     }

  ViewVC Help
Powered by ViewVC 1.1.20