wireshark/wireshark.spec

381 lines
11 KiB
RPMSpec
Raw Normal View History

#
# spec file for package wireshark
#
# Copyright (c) 2016 SUSE LINUX 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
%if 0%{?suse_version} == 1110
%bcond_with qt
%else
%bcond_without qt
%endif
%define use_gnutls 0%{?suse_version} >= 1310 || 0%{?suse_version} == 1110
Name: wireshark
Version: 2.0.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
Source4: wireshark.appdata.xml
# 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
Patch7: wireshark-pkg-config.patch
Patch8: wireshark-1.12.6-fix-QT-PIC-PIE.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} > 1320
BuildRequires: pkgconfig(Qt5Core) >= 5.0.0
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Multimedia)
BuildRequires: pkgconfig(Qt5PrintSupport)
BuildRequires: pkgconfig(Qt5Widgets)
%else
%if 0%{?suse_version} >= 1220
BuildRequires: pkgconfig(QtCore) >= 4.7.0
%else
BuildRequires: libqt4-devel >= 4.7.0
%endif # 12.20
%endif
%endif # with qt
BuildRequires: krb5-devel
BuildRequires: libcap-devel
BuildRequires: libcares-devel
BuildRequires: libgcrypt-devel >= 1.1.92
BuildRequires: libpcap-devel
BuildRequires: libsmi-devel
%if 0%{?suse_version} > 1320
BuildRequires: lua52-devel
%else
BuildRequires: lua-devel
%endif
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 >= 2.12.0
BuildConflicts: libgnutls-devel >= 3.0.0
%endif # SLE 11
%endif # use_gnutls
# for patch7 wireshark-1.12.6-fix-QT-PIC-PIE.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
BuildRequires: pkgconfig(libnl-3.0)
BuildRequires: pkgconfig(libnl-genl-3.0)
BuildRequires: pkgconfig(libnl-route-3.0)
Recommends: 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 ! %{use_caps}
%patch1 -p1
# run as root on 11.3 and older - bnc#349782
sed -i 's!^Exec=wireshark!Exec=/usr/bin/xdg-su -c /usr/bin/wireshark!' wireshark.desktop
%endif
%if %{with qt}
sed -i 's/^Icon=wireshark.png$/Icon=wireshark/' wireshark.desktop
%endif # with qt
%if %{with gtk}
sed -i 's/^Icon=wireshark.png$/Icon=wireshark/' wireshark.desktop
sed \
-e 's/^Name.*Wireshark/& (GTK)/' \
-e 's/^Icon=wireshark/&-gtk/' \
-e '/Exec=/s/wireshark/&-gtk/g' %{name}.desktop > %{name}-gtk.desktop
%endif # with gtk
%patch5 -p1
%patch7 -p1
%patch8 -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 -fPIC -fPIE"
export CXXFLAGS="%optflags -fPIC -fPIE"
export LDFLAGS="-pie"
%if 0%{?suse_version} > 1320
#XXX: buggy autoconf checks..
export PATH="%{_libdir}/qt5/bin:$PATH"
%endif
%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} \
--with-pic=yes
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/
# install appdata file for AppStore integration
install -d -m0755 %{buildroot}%{_datadir}/appdata
install %{S:4} %{buildroot}%{_datadir}/appdata/%{name}.appdata.xml
# -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-gtk.png
install -D -m 0644 wireshark-gtk.desktop %{buildroot}%{_datadir}/applications/wireshark-gtk.desktop
%if 0%{?suse_version}
%suse_update_desktop_file %{name}-gtk
%endif
%endif
%if %{with qt}
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
%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
%{_bindir}/androiddump
%{_bindir}/idl2wrs
%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/
%{_datadir}/icons/hicolor/*/apps/wireshark.png
%{_datadir}/icons/hicolor/*/mimetypes/application-wireshark-doc.png
%{_datadir}/icons/hicolor/scalable/apps/wireshark.svg
%{_datadir}/mime/packages/wireshark.xml
%files devel
%defattr(-,root,root)
%doc doc/README.*
%{_includedir}/wireshark
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/wireshark.pc
%if %{with gtk}
%files ui-gtk
%defattr(-,root,root)
%{_bindir}/wireshark-gtk
%{_datadir}/appdata/wireshark.appdata.xml
%{_datadir}/applications/wireshark-gtk.desktop
%{_datadir}/pixmaps/wireshark-gtk.png
%endif
%if %{with qt}
%files ui-qt
%defattr(-,root,root)
%dir %{_datadir}/appdata
%{_bindir}/wireshark
%{_datadir}/applications/wireshark.desktop
%{_datadir}/pixmaps/wireshark.png
%endif
%changelog