Add a (wireshark-)qt package that contains the Qt-based GUI (and the necessary
authormorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 13 Nov 2013 03:01:42 +0000 (03:01 +0000)
committermorriss <morriss@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 13 Nov 2013 03:01:42 +0000 (03:01 +0000)
desktop-integration files); build it by default.

Use 'alternatives' to choose which GUI actually gets used; give the Gtk
GUI priority over the Qt one (for now).

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@53297 f5534014-38df-0310-8fa8-9805f1628bb7

packaging/rpm/SPECS/wireshark.spec.in

index 2274660698a562c79b076430a78d3fc02a8f128c..f057b8dfa2083b88526b7c2f8b1458065bc6fe5a 100644 (file)
@@ -10,6 +10,8 @@
 
 # Set to 1 if you want GTK3 instead of GTK2:
 %global with_gtk3 0
+# Set to 1 if you want the Qt GUI too
+%global with_qt 1
 
 # Set at most one of these two:
 # Note that setcap requires rpmbuild 4.7.0 or later.
@@ -91,7 +93,6 @@ Requires(pre):        pwdutils
 Requires(pre): shadow-utils
 %endif
 %endif
-Requires(post):        desktop-file-utils
 
 %if %{setcap_dumpcap}
 # Actually we require rpmbuild (the program) >= 4.7.0 but the package name
@@ -104,9 +105,19 @@ Requires(post):    desktop-file-utils
 BuildRequires: rpm >= 4.7.0
 %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.
+
+This package contains command-line utilities, plugins, and documentation for
+Wireshark. A GTK+ and a Qt graphical user interface are packaged separately.
 
 %package       gnome
-Summary:       Gnome desktop integration for wireshark
+Summary:       Gnome desktop integration for Wireshark
 Group:         Applications/Internet
 %if %{with_gtk3}
 Requires:      gtk3 >= @GTK3_MIN_VERSION@
@@ -119,6 +130,9 @@ Requires:   wireshark = %{version}-%{release}
 Requires:      xdg-utils
 Requires:      hicolor-icon-theme
 BuildRequires: desktop-file-utils
+Requires(post):        desktop-file-utils
+Requires(post): %{_sbindir}/update-alternatives
+Requires(postun): %{_sbindir}/update-alternatives
 %if 0%{?suse_version}
 # Need this for SuSE's suse_update_desktop_file macro
 BuildRequires: update-desktop-files
@@ -134,20 +148,32 @@ Requires: portaudio
 # Add this for more readable fonts on some distributions/versions
 #Requires:     dejavu-sans-mono-fonts
 
+%description gnome
+Contains the Gnome (GTK+) Wireshark GUI and desktop integration files.
 
-%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.
+%if %{with_qt}
+%package       qt
+Summary:       Qt GUI for Wireshark
+Group:         Applications/Internet
+Requires:      qt >= @QT_MIN_VERSION@
+BuildRequires: qt-devel >= @QT_MIN_VERSION@
+Requires:      wireshark = %{version}-%{release}
+Requires:      xdg-utils
+Requires:      hicolor-icon-theme
+BuildRequires: desktop-file-utils
+Requires(post):        desktop-file-utils
+Requires(post): %{_sbindir}/update-alternatives
+Requires(postun): %{_sbindir}/update-alternatives
+BuildRequires: gcc-c++
+%if 0%{?suse_version}
+# Need this for SuSE's suse_update_desktop_file macro
+BuildRequires: update-desktop-files
+%endif
 
-This package contains command-line utilities, plugins, and documentation for
-Wireshark. A GTK+ graphical user interface is packaged separately.
+%description qt
+Contains the Qt Wireshark GUI and desktop integration files.
+%endif
 
-%description gnome
-Contains the Gnome (GTK+) Wireshark GUI and desktop integration files.
 
 %prep
 %setup -q -n %{name}-%{version}
@@ -174,6 +200,9 @@ Contains the Gnome (GTK+) Wireshark GUI and desktop integration files.
   --with-gtk3 \
 %else
   --with-gtk2 \
+%endif
+%if %{with_qt}
+  --with-qt \
 %endif
   --disable-warnings-as-errors
 
@@ -184,6 +213,10 @@ make %{?_smp_mflags}
 %install
 rm -rf $RPM_BUILD_ROOT
 make DESTDIR=$RPM_BUILD_ROOT install
+# Change the program name for 'alternatives'
+mv %{buildroot}%{_bindir}/wireshark %{buildroot}%{_bindir}/wireshark-gtk
+# Create the 'alternative' file
+touch %{buildroot}%{_bindir}/wireshark
 make DESTDIR=$RPM_BUILD_ROOT install_desktop_files
 %if 0%{?suse_version}
 # SuSE's packaging conventions
@@ -212,6 +245,8 @@ getent group wireshark >/dev/null || groupadd -r wireshark
 update-desktop-database &> /dev/null ||:
 update-mime-database /usr/share/mime &> /dev/null || :
 touch --no-create /usr/share/icons/hicolor &>/dev/null || :
+%{_sbindir}/update-alternatives --install %{_bindir}/wireshark \
+  %{name} %{_bindir}/wireshark-gtk 50
 
 %postun gnome
 update-desktop-database &> /dev/null ||:
@@ -219,7 +254,26 @@ update-mime-database /usr/share/mime &> /dev/null || :
 if [ $1 -eq 0 ] ; then
        touch --no-create /usr/share/icons/hicolor &>/dev/null || :
        gtk-update-icon-cache /usr/share/icons/hicolor &>/dev/null || :
+       %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/wireshark-gtk
+fi
+
+%if %{with_qt}
+%post qt
+update-desktop-database &> /dev/null ||:
+update-mime-database /usr/share/mime &> /dev/null || :
+touch --no-create /usr/share/icons/hicolor &>/dev/null || :
+%{_sbindir}/update-alternatives --install %{_bindir}/wireshark \
+  %{name} %{_bindir}/wireshark-qt 10
+
+%postun qt
+update-desktop-database &> /dev/null ||:
+update-mime-database /usr/share/mime &> /dev/null || :
+if [ $1 -eq 0 ] ; then
+       touch --no-create /usr/share/icons/hicolor &>/dev/null || :
+       gtk-update-icon-cache /usr/share/icons/hicolor &>/dev/null || :
+       %{_sbindir}/update-alternatives --remove %{name} %{_bindir}/wireshark-qt
 fi
+%endif
 
 # Is this really needed?
 %posttrans
@@ -231,6 +285,8 @@ gtk-update-icon-cache /usr/share/icons/hicolor &>/dev/null || :
 %doc AUTHORS COPYING ChangeLog INSTALL INSTALL.configure NEWS README*
 # Don't pick up the wireshark (GUI) binary here
 %exclude %{_bindir}/wireshark
+%exclude %{_bindir}/wireshark-gtk
+%exclude %{_bindir}/wireshark-qt
 %{_bindir}/*
 
 # This generates a warning because dumpcap is listed twice. That's
@@ -276,10 +332,27 @@ gtk-update-icon-cache /usr/share/icons/hicolor &>/dev/null || :
 /usr/share/icons/hicolor/*/apps/*
 /usr/share/icons/hicolor/*/mimetypes/*
 /usr/share/mime/packages/wireshark.xml
-%{_bindir}/wireshark
+%{_bindir}/wireshark-gtk
+%{_mandir}/man1/wireshark.*
+%ghost %{_bindir}/wireshark
+
+%if %{with_qt}
+%files qt
+%defattr(-,root,root)
+/usr/share/applications/wireshark.desktop
+/usr/share/icons/hicolor/*/apps/*
+/usr/share/icons/hicolor/*/mimetypes/*
+/usr/share/mime/packages/wireshark.xml
+%{_bindir}/wireshark-qt
 %{_mandir}/man1/wireshark.*
+%ghost %{_bindir}/wireshark
+%endif
 
 %changelog
+* Tue Nov 12 2013 Jeff Morriss
+- Add q qt package using 'alternatives' to allow the administrator to choose
+  which one they actually use.
+
 * Fri Sep 20 2013 Jeff Morriss
 - If we're not using gtk3 add --with-gtk2 (since Wireshark now defaults to gtk3)