File wireshark.spec of Package wireshark
#
# spec file for package wireshark
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# disable caps for now
%define use_caps 0
# openSUSE Factory gtk3 deprecates gtk2 elements used
%define use_gtk3 0
Name: wireshark
Version: 1.10.3
Release: 0
Summary: A Network Traffic Analyser
License: GPL-2.0+ and GPL-3.0+
Group: Productivity/Networking/Diagnostic
Url: https://www.wireshark.org/
Source: https://www.wireshark.org/download/src/%{name}-%{version}.tar.bz2
Source2: https://www.wireshark.org/download/SIGNATURES-%{version}.txt
Source3: https://www.wireshark.org/download/gerald_at_wireshark_dot_org.gpg#/wireshark.keyring
# PATCH-FIX-OPENSUSE wireshark-1.6.3-disable-warning-dialog.patch bnc#349782 prusnak@suse.cz -- don't show warning when running as root
Patch1: wireshark-1.2.0-disable-warning-dialog.patch
# PATCH-FEATURE-OPENSUSE wireshark-1.2.0-geoip.patch prusnak@suse.cz -- search in /var/lib/GeoIP if user hasn't set any GeoIP folders
Patch2: wireshark-1.2.0-geoip.patch
Patch4: wireshark-1.10.0-enable_lua.patch
Patch5: wireshark-1.10.0-authors-pod2man.patch
Patch100: wireshark-bug8808-packetlen.patch
BuildRequires: bison
BuildRequires: cairo-devel
BuildRequires: flex
%if 0%{?suse_version} <= 1140
BuildRequires: gtk2-devel
%else
%if 0%{?use_gtk3}
BuildRequires: gtk3-devel
%else
BuildRequires: gtk2-devel
%endif
%endif
BuildRequires: krb5-devel
BuildRequires: libcap-devel
BuildRequires: libcares-devel
BuildRequires: libgcrypt-devel
BuildRequires: libgnutls-devel
BuildRequires: libpcap-devel
BuildRequires: libsmi-devel
# required for Lua support in openSUSE 12.2 and later [bnc#780669]
%if 0%{?suse_version} >= 1220
BuildRequires: lua51-devel
%else
BuildRequires: lua-devel
%endif
BuildRequires: net-snmp-devel
BuildRequires: openssl-devel
BuildRequires: pcre-devel
BuildRequires: portaudio-devel
BuildRequires: python-devel
BuildRequires: tcpd-devel
BuildRequires: xdg-utils
%if 0%{?suse_version} > 1220
BuildRequires: zlib-devel
%endif
Requires: xdg-utils
Provides: ethereal = %{version}
Obsoletes: ethereal < %{version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version}
BuildRequires: libGeoIP-devel
BuildRequires: update-desktop-files
Recommends: GeoIP
%endif
%if 0%{?suse_version} >= 1230
BuildRequires: gpg-offline
%endif
%description
Wireshark is a free network protocol analyzer for Unix and Windows. It
allows you to examine data from a live network or from a capture file
on disk. You can interactively browse the capture data, viewing summary
and detail information for each packet. Wireshark has several powerful
features, including a rich display filter language and the ability to
view the reconstructed stream of a TCP session.
%package devel
Summary: A Network Traffic Analyser
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
Requires: glib2-devel
Requires: glibc-devel
Provides: ethereal-devel = %{version}
Obsoletes: ethereal-devel < %{version}
%description devel
Wireshark is a free network protocol analyzer for Unix and Windows. It
allows you to examine data from a live network or from a capture file
on disk. You can interactively browse the capture data, viewing summary
and detail information for each packet. Wireshark has several powerful
features, including a rich display filter language and the ability to
view the reconstructed stream of a TCP session.
%prep
%{?gpg_verify: %gpg_verify %{S:2}}
# The publisher doesn't sign the source tarball, but a signatures file containing multiple hashes.
# Verify hashes in that file against source tarball.
echo "`grep %{name}-%{version}.tar.bz2 %{S:2} | grep MD5 | head -n1 | cut -d= -f2` %{S:0}" | md5sum -c
echo "`grep %{name}-%{version}.tar.bz2 %{S:2} | grep SHA1 | head -n1 | cut -d= -f2` %{S:0}" | sha1sum -c
%setup -q
%patch2
%patch4 -p1
sed -i 's/^Icon=wireshark.png$/Icon=wireshark/' wireshark.desktop
# run as root on 11.3 and older - bnc#349782
%if ! %{use_caps}
%patch1
sed -i 's!^Exec=wireshark!Exec=/usr/bin/xdg-su -c /usr/bin/wireshark!' wireshark.desktop
%endif
%patch5 -p1
%patch100 -p1
%build
# zlib-1.2.5 does not work well with wireshark, so disable it on pre-12.2
%configure \
%if 0%{?suse_version} < 1220
--without-zlib \
%endif
%if 0%{?suse_version} > 1140
%if 0%{?use_gtk3}
--with-gtk3 \
%endif
%endif
--with-ssl \
--with-gnutls=yes \
--with-gcrypt=yes \
--with-python \
--with-plugins=%{_libdir}/%{name}/plugins/%{version}
make %{?_smp_mflags}
%install
make DESTDIR=%{buildroot} install
find %{buildroot} -name "*.la" -delete -print
ln -fs wireshark %{buildroot}%{_bindir}/ethereal
ln -fs tshark %{buildroot}%{_bindir}/tethereal
install -d -m 0755 %{buildroot}%{_sysconfdir}
install -d -m 0755 %{buildroot}%{_mandir}/man1/
# install -m 0644 *.1 %%{buildroot}%%{_mandir}/man1/
# -devel
install -d -m 0755 %{buildroot}%{_includedir}/wireshark
IDIR="${RPM_BUILD_ROOT}%{_includedir}/wireshark"
mkdir -p "${IDIR}/epan"
mkdir -p "${IDIR}/epan/crypt"
mkdir -p "${IDIR}/epan/ftypes"
mkdir -p "${IDIR}/epan/dfilter"
mkdir -p "${IDIR}/epan/dissectors"
mkdir -p "${IDIR}/wiretap"
mkdir -p "${IDIR}/wsutil"
install -m 644 color.h config.h register.h "${IDIR}/"
install -m 644 cfile.h file.h "${IDIR}/"
install -m 644 frame_data_sequence.h "${IDIR}/"
install -m 644 packet-range.h print.h "${IDIR}/"
install -m 644 epan/*.h "${IDIR}/epan/"
install -m 644 epan/crypt/*.h "${IDIR}/epan/crypt"
install -m 644 epan/ftypes/*.h "${IDIR}/epan/ftypes"
install -m 644 epan/dfilter/*.h "${IDIR}/epan/dfilter"
install -m 644 epan/dissectors/*.h "${IDIR}/epan/dissectors"
install -m 644 wiretap/*.h "${IDIR}/wiretap"
install -m 644 wsutil/*.h "${IDIR}/wsutil"
install -m 644 ws_symbol_export.h "${IDIR}/"
install -D -m 0644 image/wsicon48.png %{buildroot}%{_datadir}/pixmaps/wireshark.png
install -D -m 0644 wireshark.desktop %{buildroot}%{_datadir}/applications/wireshark.desktop
%if 0%{?suse_version}
%suse_update_desktop_file %{name}
%endif
%clean
rm -rf %{buildroot}
%if %{use_caps}
%pre
getent group wireshark >/dev/null || groupadd wireshark
%endif
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README README.linux README.vmware
%doc %{_mandir}/man1/[^i]*
%doc %{_mandir}/man4/*
%{_datadir}/applications/wireshark.desktop
%{_datadir}/pixmaps/wireshark.png
%{_bindir}/ethereal
%{_bindir}/tethereal
%{_bindir}/wireshark
%{_bindir}/editcap
%{_bindir}/tshark
%{_bindir}/mergecap
%{_bindir}/reordercap
%{_bindir}/text2pcap
%{_bindir}/dftest
%{_bindir}/capinfos
%{_bindir}/randpkt
%if %{use_caps}
%attr(0750,root,wireshark) %caps(cap_net_raw,cap_net_admin=eip) %{_bindir}/dumpcap
%else
%{_bindir}/dumpcap
%endif
%{_bindir}/rawshark
%{_libdir}/lib*.so.*
%{_libdir}/wireshark/
%{_datadir}/wireshark/
%files devel
%defattr(-,root,root)
%doc doc/README.*
%{_includedir}/wireshark
%{_libdir}/lib*.so
%changelog