Make it so that alternate-prefix RPM builds actually work.
[metze/wireshark/wip.git] / packaging / rpm / SPECS / wireshark.spec.in
1 # Note that this is NOT a relocatable package
2 # $Id$
3 # @configure_input@
4
5 # Set these to 1 if you want to ensure your package inclues support for them:
6 %global with_adns 0
7 %global with_lua  1
8 %global with_portaudio 0
9
10 # Set to 1 if you want GTK3 instead of GTK2:
11 %global with_gtk3 0
12
13 # Set at most one of these two:
14 # Note that setcap requires rpmbuild 4.7.0 or later.
15 %global setuid_dumpcap 0
16 %global setcap_dumpcap 1
17
18 # Set to 1 if you want a group called 'wireshark' which users must be a member
19 # of in order to run dumpcap.  Only used if setuid_dumpcap or setcap_dumpcap
20 # are set.
21 %global use_wireshark_group 1
22
23
24 Summary:        Network protocol analyzer
25 Name:           wireshark
26 Version:        @VERSION@
27 Release:        1
28 License:        GPL+
29 Group:          Applications/Internet
30 Source:         http://wireshark.org/download/src/%{name}-%{version}.tar.bz2
31 # Or this URL for automated builds:
32 #Source:        http://wireshark.org/download/automated/src/%{name}-%{version}.tar.bz2
33 URL:            http://www.wireshark.org/
34 BuildRoot:      /tmp/wireshark-%{PACKAGE_VERSION}-root
35 Packager:       Gerald Combs <gerald[AT]wireshark.org>
36 # Some distributions create a wireshark-devel package; get rid of it
37 Obsoletes:      wireshark-devel
38
39 BuildRequires:  autoconf >= @AC_MIN_VERSION@
40 BuildRequires:  flex, bison
41 BuildRequires:  python
42 BuildRequires:  perl
43
44 BuildRequires:  glib2-devel >= @GLIB_MIN_VERSION@
45 Requires:       glib2 >= @GLIB_MIN_VERSION@
46 BuildRequires:  libpcap-devel
47 Requires:       libpcap
48 BuildRequires:  zlib-devel
49 Requires:       zlib
50
51 %if %{with_adns}
52 BuildRequires:  adns-devel
53 Requires:       adns
54 %endif
55 %if %{with_lua}
56 BuildRequires:  lua-devel
57 Requires:       lua
58 %endif
59
60 # Uncomment these if you want to be sure you get them...
61 #BuildRequires: krb5-devel
62 #BuildRequires: libsmi-devel
63 #BuildRequires: pcre-devel
64 #BuildRequires: libselinux
65 #BuildRequires: gnutls-devel
66 #BuildRequires: libcap-devel
67 #BuildRequires: c-ares-devel
68 #Requires:      c-ares
69
70 %if %{use_wireshark_group}
71 Requires(pre):  shadow-utils
72 %endif
73 Requires(post): desktop-file-utils
74
75 %if %{setcap_dumpcap}
76 BuildRequires: rpm-build >= 4.7.0
77 %endif
78
79
80 %package        gnome
81 Summary:        Gnome desktop integration for wireshark
82 Group:          Applications/Internet
83 %if %{with_gtk3}
84 Requires:       gtk3 >= @GTK3_MIN_VERSION@
85 BuildRequires:  gtk3-devel >= @GTK3_MIN_VERSION@
86 %else
87 Requires:       gtk2 >= @GTK2_MIN_VERSION@
88 BuildRequires:  gtk2-devel >= @GTK2_MIN_VERSION@
89 %endif
90 Requires:       wireshark = %{version}-%{release}
91 Requires:       xdg-utils
92 Requires:       hicolor-icon-theme
93 BuildRequires:  desktop-file-utils
94 %if %{with_portaudio}
95 BuildRequires:  portaudio-devel
96 Requires:       portaudio
97 %endif
98
99 # Uncomment these if you want to be sure you get them...
100 #BuildRequires: GeoIP-devel
101 #Requires:      GeoIP
102 # Add this for more readable fonts on some distributions/versions
103 #Requires:      dejavu-sans-mono-fonts
104
105
106 %description
107 Wireshark is a free network protocol analyzer for Unix and Windows. It
108 allows you to examine data from a live network or from a capture file
109 on disk. You can interactively browse the capture data, viewing summary
110 and detail information for each packet. Wireshark has several powerful
111 features, including a rich display filter language and the ability to
112 view the reconstructed stream of a TCP session.
113
114 This package contains command-line utilities, plugins, and documentation for
115 Wireshark. A GTK+ graphical user interface is packaged separately.
116
117 %description gnome
118 Contains the Gnome (GTK+) Wireshark GUI and desktop integration files.
119
120 %prep
121 %setup -q -n %{name}-%{version}
122
123 # Don't specify the prefix here: %configure is a macro which expands to set
124 # the prefix and everything else too.  If you need to change the prefix
125 # set _prefix (note the underscore) either in this file or on rpmbuild's
126 # command-line.
127 %configure \
128   --with-gnu-ld \
129 %if %{with_adns}
130   --with-adns \
131 %endif
132 %if %{with_lua}
133   --with-lua \
134 %endif
135 %if %{with_portaudio}
136   --with-portaudio \
137 %endif
138 %if %{with_gtk3}
139   --with-gtk3 \
140 %endif
141   --disable-warnings-as-errors
142
143 make %{?_smp_mflags}
144
145 %install
146 rm -rf $RPM_BUILD_ROOT
147 make DESTDIR=$RPM_BUILD_ROOT install
148 make DESTDIR=$RPM_BUILD_ROOT install_desktop_files
149 # Fedora's packaging guidelines (https://fedoraproject.org/wiki/Packaging:Guidelines)
150 # require this (at least if desktop-file-install was not used to install it).
151 desktop-file-validate %{buildroot}/usr/share/applications/wireshark.desktop
152
153 %clean
154 rm -rf $RPM_BUILD_ROOT
155
156 %if %{use_wireshark_group}
157 %pre
158 getent group wireshark >/dev/null || groupadd -r wireshark
159 %endif
160
161 %post -p /sbin/ldconfig
162
163 %postun -p /sbin/ldconfig
164
165 %post gnome
166 update-desktop-database &> /dev/null ||:
167 update-mime-database %{_datadir}/mime &> /dev/null || :
168 touch --no-create %{_datadir}/icons/gnome &>/dev/null || :
169 touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
170
171 %postun gnome
172 update-desktop-database &> /dev/null ||:
173 update-mime-database /usr/share/mime &> /dev/null || :
174 if [ $1 -eq 0 ] ; then
175         touch --no-create /usr/share/icons/gnome &>/dev/null
176         gtk-update-icon-cache /usr/share/icons/gnome &>/dev/null || :
177
178         touch --no-create /usr/share/icons/hicolor &>/dev/null
179         gtk-update-icon-cache /usr/share/icons/hicolor &>/dev/null || :
180 fi
181
182 # Is this really needed?
183 %posttrans
184 gtk-update-icon-cache /usr/share/icons/gnome &>/dev/null || :
185 gtk-update-icon-cache /usr/share/icons/hicolor &>/dev/null || :
186
187
188 %files
189 %defattr(-,root,root)
190 %doc AUTHORS COPYING ChangeLog INSTALL INSTALL.configure NEWS README*
191 # Don't pick up the wireshark (GUI) binary here
192 %exclude %{_bindir}/wireshark
193 %{_bindir}/*
194
195 # This generates a warning because dumpcap is listed twice. That's
196 # probably preferable to listing each program (and keeping the list up to
197 # date)...  Maybe if we can find a way to get the toplevel Makefile.am's
198 # bin_PROGRAMS in here?
199 %if %{use_wireshark_group} && %{setuid_dumpcap}
200 # Setuid but only executable by members of the 'wireshark' group
201 %attr(4750, root, wireshark) %{_bindir}/dumpcap
202 %else
203 %if %{use_wireshark_group} && %{setcap_dumpcap}
204 # Setcap but only executable by members of the 'wireshark' group
205 %attr(0750, root, wireshark) %caps(cap_net_raw,cap_net_admin=eip) %{_bindir}/dumpcap
206 %else
207 %if %{setuid_dumpcap}
208 # Setuid and executable by all
209 %attr(4755, root, root) %{_bindir}/dumpcap
210 %else
211 %if %{setcap_dumpcap}
212 # Setcap and executable by all
213 %attr(0755, root, root) %caps(cap_net_raw,cap_net_admin=eip) %{_bindir}/dumpcap
214 %else
215 # Executable by all but with no special permissions
216 %attr(0755, root, root) %{_bindir}/dumpcap
217 %endif
218 %endif
219 %endif
220 %endif
221
222 %{_libdir}/lib*.so*
223 %exclude %{_libdir}/%{name}/plugins/%{version}/*.la
224 %exclude %{_libdir}/*.la
225 %{_libdir}/wireshark
226 # Don't pick up the wireshark (GUI) man page
227 %exclude %{_mandir}/man1/wireshark.*
228 %{_mandir}/man1/*
229 %{_mandir}/man4/*
230 %{_datadir}/wireshark
231
232 %files gnome
233 %defattr(-,root,root)
234 /usr/share/applications/wireshark.desktop
235 /usr/share/icons/hicolor/*/apps/*
236 /usr/share/icons/gnome/*/mimetypes/*
237 /usr/share/mime/packages/wireshark.xml
238 %{_bindir}/wireshark
239 %{_mandir}/man1/wireshark.*
240
241 %changelog
242 * Mon Feb  6 2013 Jeff Morriss
243 - Overhaul to make this file more useful/up to date.  Many changes are based
244   on Fedora's .spec file.  Changes include:
245   - Create a separate wireshark-gnome package (like Redhat).
246   - Control some things with variables set at the top of the file.
247     - Allow the user to configure how dumpcap is installed.
248     - Allow the user to choose some options including GTK2 or GTK3.
249   - Greatly expand the BuildRequires entries; get the minimum versions of some
250     things from 'configure'.
251   - Install freedesktop files for better (free)desktop integration.
252
253 * Thu Aug 10 2006 Joerg Mayer
254 - Starting with X.org 7.x X11R6 is being phased out. Install wireshark
255   and manpage into the standard path.
256
257 * Mon Aug 01 2005 Gerald Combs
258 - Add a desktop file and icon for future use
259
260 - Take over the role of packager
261
262 - Update descriptions and source locations
263
264 * Thu Oct 28 2004 Joerg Mayer
265 - Add openssl requirement (heimdal and net-snmp are still automatic)
266
267 * Tue Jul 20 2004 Joerg Mayer
268 - Redo install and files section to actually work with normal builds
269
270 * Sat Feb 07 2004 Joerg Mayer
271 - in case there are shared libs: include them
272
273 * Tue Aug 24 1999 Gilbert Ramirez
274 - changed to ethereal.spec.in so that 'configure' can update
275   the version automatically
276
277 * Tue Aug 03 1999 Gilbert Ramirez <gram@xiexie.org>
278 - updated to 0.7.0 and changed gtk+ requirement
279
280 * Sun Jan 01 1999 Gerald Combs <gerald@zing.org>
281 - updated to 0.5.1
282
283 * Fri Nov 20 1998 FastJack <fastjack@i-s-o.net>
284 - updated to 0.5.0
285
286 * Sun Nov 15 1998 FastJack <fastjack@i-s-o.net>
287 - created .spec file
288