wireshark/wireshark.spec

338 lines
9.7 KiB
RPMSpec
Raw Normal View History

#
# spec file for package wireshark
#
# Copyright (c) 2015 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
%define use_gtk3 0%{?suse_version} > 1140
%bcond_without gtk
%bcond_without qt
%define use_gnutls 0%{?suse_version} >= 1310 || 0%{?suse_version} == 1110
Name: wireshark
Version: 1.12.2
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
Patch6: wireshark-1.12.x-allow-gdk-pixbuf-deprecation.patch
BuildRequires: bison
BuildRequires: cairo-devel
BuildRequires: flex
%if %{with gtk}
%if 0%{use_gtk3}
BuildRequires: gtk3-devel >= 3.0.0
%else
BuildRequires: gtk2-devel >= 2.12.0
%endif # use_gtk3
%endif # with gtk
%if %{with qt}
%if 0%{?suse_version} >= 1220
BuildRequires: pkgconfig(QtCore) >= 4.6.0
%else
BuildRequires: libqt4-devel >= 4.6.0
%endif # 12.20
%endif # with qt
BuildRequires: krb5-devel
BuildRequires: libcap-devel
BuildRequires: libcares-devel
BuildRequires: libgcrypt-devel >= 1.1.92
BuildRequires: libpcap-devel
BuildRequires: libsmi-devel
BuildRequires: lua-devel
BuildRequires: net-snmp-devel
BuildRequires: openssl-devel
BuildRequires: pcre-devel
BuildRequires: portaudio-devel
BuildRequires: python-devel >= 2.5
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%{?use_gnutls}
# pull in licence compatible gnutls
%if 0%{?suse_version} >= 1310
BuildRequires: pkgconfig(gnutls) >= 3.1.10
%endif # >= 13.1
%if 0%{?suse_version} == 1110
BuildRequires: libgnutls-devel >= 1.2.0
BuildConflicts: libgnutls-devel >= 3.0.0
%endif # SLE 11
%endif # use_gnutls
# for patch6 wireshark-1.12.x-allow-gdk-pixbuf-deprecation.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
#
Requires: wireshark-ui = %{version}
%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.
%if %{with gtk}
%package ui-gtk
Summary: A Network Traffic Analyser - GTK+ UI
Group: Productivity/Networking/Diagnostic
Requires: %{name} = %{version}
Provides: %{name}-ui = %{version}
%description ui-gtk
This package contains the classic GTK+ UI of Wireshark.
%endif
%if %{with qt}
%package ui-qt
Summary: A Network Traffic Analyser - Qt UI
Group: Productivity/Networking/Diagnostic
Requires: %{name} = %{version}
Provides: %{name}-ui = %{version}
%description ui-qt
This package contains the newer Qt based UI for Wireshark.
%endif
%prep
# 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 -p1
%patch4 -p1
%if %{with gtk}
sed -i 's/^Icon=wireshark.png$/Icon=wireshark/' wireshark.desktop
# run as root on 11.3 and older - bnc#349782
%if ! %{use_caps}
%patch1 -p1
sed -i 's!^Exec=wireshark!Exec=/usr/bin/xdg-su -c /usr/bin/wireshark!' wireshark.desktop
%endif
%endif # with gtk
%if %{with qt}
sed \
-e 's/^Name.*Wireshark/& (QT)/' \
-e 's/^Icon=wireshark/&-qt/' \
-e '/Exec=/s/wireshark/&-qt/g' %{name}.desktop > %{name}-qt.desktop
%endif # with qt
%patch5 -p1
%patch6 -p1
%build
# for patch6 wireshark-1.12.x-allow-gdk-pixbuf-deprecation.patch
autoreconf -fiv
# zlib-1.2.5 does not work well with wireshark, so disable it on pre-12.2
export CFLAGS="%optflags -fPIE"
export CXXFLAGS="%optflags -fPIE"
export LDFLAGS="-pie"
%configure \
%if 0%{?suse_version} < 1220
--without-zlib \
%endif
%if %{with gtk}
%if 0%{?use_gtk3}
--with-gtk3=yes \
--with-gtk2=no \
%else
--with-gtk3=no \
--with-gtk2=yes \
%endif
%else
--with-gtk3=no \
--with-gtk2=no \
%endif # with gtk
%if %{with qt}
--with-qt=yes \
%else
--with-qt=no \
%endif
--with-ssl \
%if 0%{?use_gnutls}
--with-gnutls=yes \
%endif
--with-gcrypt=yes \
--with-plugins=%{_libdir}/%{name}/plugins/%{version}
make %{?_smp_mflags} V=1
%install
make DESTDIR=%{buildroot} install
find %{buildroot} -name "*.la" -delete -print
%if %{with gtk}
ln -fs wireshark %{buildroot}%{_bindir}/ethereal
%endif
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}/epan/wmem"
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 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 epan/wmem/*.h "${IDIR}/epan/wmem"
install -m 644 wiretap/*.h "${IDIR}/wiretap"
install -m 644 wsutil/*.h "${IDIR}/wsutil"
install -m 644 ws_symbol_export.h "${IDIR}/"
%if %{with gtk}
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
%endif
%if %{with qt}
install -D -m 0644 image/wsicon48.png %{buildroot}%{_datadir}/pixmaps/wireshark-qt.png
install -D -m 0644 wireshark-qt.desktop %{buildroot}%{_datadir}/applications/wireshark-qt.desktop
%if 0%{?suse_version}
%suse_update_desktop_file %{name}-qt
%endif
%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/*
%{_bindir}/ethereal
%{_bindir}/tethereal
%{_bindir}/editcap
%{_bindir}/tshark
%{_bindir}/mergecap
%{_bindir}/reordercap
%{_bindir}/text2pcap
%{_bindir}/dftest
%{_bindir}/capinfos
%{_bindir}/captype
%{_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
%if %{with gtk}
%files ui-gtk
%defattr(-,root,root)
%{_bindir}/wireshark
%{_datadir}/applications/wireshark.desktop
%{_datadir}/pixmaps/wireshark.png
%endif
%if %{with qt}
%files ui-qt
%defattr(-,root,root)
%{_bindir}/wireshark-qt
%{_datadir}/applications/wireshark-qt.desktop
%{_datadir}/pixmaps/wireshark-qt.png
%endif
%changelog