aboutsummaryrefslogtreecommitdiffstats
path: root/packaging/rpm/SPECS/wireshark.spec.in
blob: 1099ab940ffdd54fa4f4857746a712e02dddfab7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
# Note that this is NOT a relocatable package
# @configure_input@
# configure options: @CONFIG_ARGS@

%bcond_with    qt
%bcond_without gtk2
%bcond_with    gtk3

# Set these to 1 if you want to ensure your package includes support for them:
%global with_adns 0
%global with_c_ares 1
%global with_lua  1
%global with_portaudio 0

# Set at most one of these two:
# Note that setcap requires rpmbuild 4.7.0 or later.
%global setuid_dumpcap 0
%global setcap_dumpcap 1

# Set to 1 if you want a group called 'wireshark' which users must be a member
# of in order to run dumpcap.  Only used if setuid_dumpcap or setcap_dumpcap
# are set.
%global use_wireshark_group 1


Summary:	Wireshark is the world's foremost protocol analyzer
Name:		wireshark
Version:	@VERSION@
Release:	1
License:	GPLv2+
Group:		Applications/Internet
Source:		https://wireshark.org/download/src/%{name}-%{version}.tar.bz2
# Or this URL for automated builds:
#Source:	https://wireshark.org/download/automated/src/%{name}-%{version}.tar.bz2
URL:		https://www.wireshark.org/
Packager:	Gerald Combs <gerald[AT]wireshark.org>
# Some distributions create a wireshark-devel package; get rid of it
Obsoletes:	wireshark-devel

BuildRoot:	/tmp/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:	autoconf >= @AC_MIN_VERSION@
BuildRequires:	automake
BuildRequires:	libtool
BuildRequires:	gcc
BuildRequires:	flex
BuildRequires:	bison
BuildRequires:	python
BuildRequires:	perl

BuildRequires:	glib2-devel >= @GLIB_MIN_VERSION@
Requires:	glib2 >= @GLIB_MIN_VERSION@
BuildRequires:	libpcap-devel
Requires:	libpcap
BuildRequires:	zlib-devel
Requires:	zlib

%if %{with_c_ares}
%if 0%{?suse_version}
# SuSE uses these package names (yes 2!):
BuildRequires:	libcares-devel
Requires:	libcares2
%else
# ... while Redhat uses this one:
# (What other RPM-based distros do will have to be determined...)
BuildRequires:	c-ares-devel
Requires:	c-ares
%endif
%endif
%if %{with_adns}
BuildRequires:	adns-devel
Requires:	adns
%endif
%if %{with_lua}
BuildRequires:	lua-devel
Requires:	lua
%endif

# Uncomment these if you want to be sure you get them...
#BuildRequires:	krb5-devel
#BuildRequires:	libsmi-devel
#BuildRequires:	pcre-devel
#BuildRequires:	libselinux
#BuildRequires:	gnutls-devel
#BuildRequires:	libcap-devel

%if %{use_wireshark_group}
%if 0%{?suse_version}
# SuSE's groupadd is in this package:
Requires(pre):	pwdutils
%else
# ... while Redhat's is in this one:
Requires(pre):	shadow-utils
%endif
%endif

%if %{setcap_dumpcap}
# Actually we require rpmbuild (the program) >= 4.7.0 but the package name
# where we can find it varies.  So we check the 'rpm' version because either
# rpmbuild is in that package (e.g., in older distros) or it's in the
# 'rpm-build' package which generally requires a matching version of 'rpm'.
#
# All of this is to save users the trouble of getting through an full compile
# only to have rpmbuild barf because it doesn't understand capabilities.
BuildRequires:	rpm >= 4.7.0
%endif

%description
Wireshark allows you to examine protocol data stored in files or as it is
captured from wired or wireless (WiFi or Bluetooth) networks, USB devices,
and many other sources.  It supports dozens of protocol capture file formats
and understands more than a thousand protocols.

It has many powerful features including a rich display filter language
and the ability to reassemble multiple protocol packets in order to, for
example, view a complete TCP stream, save the contents of a file which was
transferred over HTTP or CIFS, or play back an RTP audio stream.

This package contains command-line utilities, plugins, and documentation for
Wireshark. A Qt and a GTK+ graphical user interface are packaged separately.

%if %{with qt}
%package	qt
Summary:	Wireshark's Qt-based GUI
Group:		Applications/Internet
%if 0%{?suse_version}
Requires:	libqt4 >= @QT_MIN_VERSION@
BuildRequires:	libqt4-devel >= @QT_MIN_VERSION@
%else
Requires:	qt >= @QT_MIN_VERSION@
BuildRequires:	qt-devel >= @QT_MIN_VERSION@
%endif
Requires:	%{name} = %{version}-%{release}
Requires:	xdg-utils
Requires:	hicolor-icon-theme
BuildRequires:	desktop-file-utils
Requires(post):	desktop-file-utils
Requires(post): /usr/sbin/update-alternatives
Requires(postun): /usr/sbin/update-alternatives
BuildRequires:	gcc-c++
%if 0%{?suse_version}
# Need this for SuSE's suse_update_desktop_file macro
BuildRequires:	update-desktop-files
%endif

%description qt
This package contains the Qt Wireshark GUI and desktop integration files.
%endif

%if %{with gtk2} || %{with gtk3}
%package	gnome
Summary:	Wireshark's GTK+-based GUI
Group:		Applications/Internet
%if %{with gtk3}
Requires:	gtk3 >= @GTK3_MIN_VERSION@
BuildRequires:	gtk3-devel >= @GTK3_MIN_VERSION@
%else
%if %{with gtk2}
Requires:	gtk2 >= @GTK2_MIN_VERSION@
BuildRequires:	gtk2-devel >= @GTK2_MIN_VERSION@
%endif
%endif
Requires:	%{name} = %{version}-%{release}
Requires:	xdg-utils
Requires:	hicolor-icon-theme
BuildRequires:	desktop-file-utils
Requires(post):	desktop-file-utils
Requires(post): /usr/sbin/update-alternatives
Requires(postun): /usr/sbin/update-alternatives
%if 0%{?suse_version}
# Need this for SuSE's suse_update_desktop_file macro
BuildRequires:	update-desktop-files
%endif
%if %{with_portaudio}
BuildRequires:	portaudio-devel
Requires:	portaudio
%endif

# Uncomment these if you want to be sure you get them...
#BuildRequires:	GeoIP-devel
#Requires:	GeoIP
# Add this for more readable fonts on some distributions/versions
#Requires:	dejavu-sans-mono-fonts

%description gnome
This package contains the GTK+ Wireshark GUI and desktop integration files.
%endif


%prep
%setup -q -n %{name}-%{version}

# Don't specify the prefix here: configure is a macro which expands to set
# the prefix and everything else too.  If you need to change the prefix
# set _prefix (note the underscore) either in this file or on rpmbuild's
# command-line.
%configure \
  --with-gnu-ld \
%if %{with_c_ares}
  --with-c-ares \
%endif
%if %{with_adns}
  --with-adns \
%endif
%if %{with_lua}
  --with-lua \
%endif
%if %{with_portaudio}
  --with-portaudio \
%endif
%if %{with qt}
  --with-qt \
%else
  --without-qt \
%endif
%if %{with gtk2}
  --with-gtk2 \
%else
  --without-gtk2 \
%endif
%if %{with gtk3}
  --with-gtk3 \
%else
  --without-gtk3 \
%endif
  --disable-warnings-as-errors

# Remove rpath.  It's prohibited in Fedora[1] and anyway we don't need it (and
# sometimes it gets in the way).
# [1] https://fedoraproject.org/wiki/Packaging:Guidelines#Beware_of_Rpath
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool

# Suggestion: put this in your ~/.rpmmacros (without the hash sign, of course):
# %_smp_mflags -j %(grep -c processor /proc/cpuinfo)
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install

# If we're being installed in an unusual prefix tell the loader where
# to find our libraries.
%if "%{_prefix}" != "/usr"
	%define install_ld_so_conf 1
	mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
	echo %{_libdir} > $RPM_BUILD_ROOT/etc/ld.so.conf.d/wireshark.conf
%endif

%if %{with qt}
# Change the program name for 'alternatives'
mv %{buildroot}%{_bindir}/wireshark %{buildroot}%{_bindir}/wireshark-qt
%endif
%if %{with qt} || %{with gtk2} || %{with gtk3}
# Create the 'alternative' file
touch %{buildroot}%{_bindir}/wireshark
%if 0%{?suse_version}
# SuSE's packaging conventions
# (http://en.opensuse.org/openSUSE:Packaging_Conventions_RPM_Macros#.25suse_update_desktop_file)
# require this:
%suse_update_desktop_file %{name}
%else
# Fedora's packaging guidelines (https://fedoraproject.org/wiki/Packaging:Guidelines)
# require this (at least if desktop-file-install was not used to install it).
desktop-file-validate %{buildroot}%{_datadir}/applications/wireshark.desktop
%endif
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%pre
%if %{use_wireshark_group}
getent group wireshark >/dev/null || groupadd -r wireshark
%endif
# If we have a pre-alternatives wireshark binary out there, get rid of it.
# (With 'alternatives' %{_bindir}/wireshark should be a symlink.)
if [ -f %{_bindir}/wireshark ]
then
	rm -f %{_bindir}/wireshark
fi

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%if %{with qt}
%post qt
update-desktop-database %{_datadir}/applications &> /dev/null || :
update-mime-database %{_datadir}/mime &> /dev/null || :
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
/usr/sbin/update-alternatives --install %{_bindir}/wireshark \
  %{name} %{_bindir}/wireshark-qt 50

%postun qt
update-desktop-database %{_datadir}/applications &> /dev/null ||:
update-mime-database %{_datadir}/mime &> /dev/null || :
if [ $1 -eq 0 ] ; then
	/usr/sbin/update-alternatives --remove %{name} %{_bindir}/wireshark-qt
fi
%endif

%if %{with gtk2} || %{with gtk3}
%post gnome
update-desktop-database %{_datadir}/applications &> /dev/null ||:
update-mime-database %{_datadir}/mime &> /dev/null || :
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
gtk-update-icon-cache -t %{_datadir}/icons/hicolor &>/dev/null || :
/usr/sbin/update-alternatives --install %{_bindir}/wireshark \
  %{name} %{_bindir}/wireshark-gtk 10

%postun gnome
update-desktop-database %{_datadir}/applications &> /dev/null ||:
update-mime-database %{_datadir}/mime &> /dev/null || :
if [ $1 -eq 0 ] ; then
	touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
	gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
	/usr/sbin/update-alternatives --remove %{name} %{_bindir}/wireshark-gtk
fi
%endif

%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL INSTALL.configure NEWS README*
# Don't pick up any of the wireshark (GUI) binaries here
%exclude %{_bindir}/wireshark*
%{_bindir}/*

# This generates a warning because dumpcap is listed twice. That's
# probably preferable to listing each program (and keeping the list up to
# date)...  Maybe if we can find a way to get the toplevel Makefile.am's
# bin_PROGRAMS in here?
%if %{use_wireshark_group} && %{setuid_dumpcap}
# Setuid but only executable by members of the 'wireshark' group
%attr(4750, root, wireshark) %{_bindir}/dumpcap
%else
%if %{use_wireshark_group} && %{setcap_dumpcap}
# Setcap but only executable by members of the 'wireshark' group
%attr(0750, root, wireshark) %caps(cap_net_raw,cap_net_admin=ep) %{_bindir}/dumpcap
%else
%if %{setuid_dumpcap}
# Setuid and executable by all
%attr(4755, root, root) %{_bindir}/dumpcap
%else
%if %{setcap_dumpcap}
# Setcap and executable by all
%attr(0755, root, root) %caps(cap_net_raw,cap_net_admin=ep) %{_bindir}/dumpcap
%else
# Executable by all but with no special permissions
%attr(0755, root, root) %{_bindir}/dumpcap
%endif
%endif
%endif
%endif

%{_libdir}/lib*.so*
%exclude %{_libdir}/%{name}/plugins/%{version}/*.la
%exclude %{_libdir}/*.la
%{_libdir}/wireshark
# Don't pick up the wireshark (GUI) man page
%exclude %{_mandir}/man1/wireshark.*
%{_mandir}/man1/*
%{_mandir}/man4/*
%{_datadir}/wireshark
%if 0%{?install_ld_so_conf}
/etc/ld.so.conf.d/wireshark.conf
%endif

%if %{with qt}
%files qt
%defattr(-,root,root)
%{_datadir}/applications/wireshark.desktop
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/icons/hicolor/*/mimetypes/*
%{_datadir}/mime/packages/wireshark.xml
%{_bindir}/wireshark-qt
%{_mandir}/man1/wireshark.*
%ghost %{_bindir}/wireshark
%endif

%if %{with gtk2} || %{with gtk3}
%files gnome
%defattr(-,root,root)
%{_datadir}/applications/wireshark.desktop
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/icons/hicolor/*/mimetypes/*
%{_datadir}/mime/packages/wireshark.xml
%{_bindir}/wireshark-gtk
%{_mandir}/man1/wireshark.*
%ghost %{_bindir}/wireshark
%endif

%changelog
* Tue Jan 20 2015 Jeff Morriss
- Make the license tag more specific: Wireshark is GPLv2+.

* Mon Jan 12 2015 Jeff Morriss
- Modernize the (base package) %description.

* Wed Dec  3 2014 Jeff Morriss
- Don't run gtk-update-icon-cache when uninstalling the Qt package.  But do run
  it when installing the gnome package.
- Tell the loader where to find our libraries if we're being installed
  someplace other than /usr .
- Attempt to get RPMs working with a prefix other than /usr (now that the
  (free)desktop files are no longer always installed /usr).  Desktop
  integration doesn't work for prefixes other than "/usr" or "/usr/local".

* Fri Aug 29 2014 Gerald Combs
- The Qt UI is now the default. Update logic and prioritization to
  reflect this.

* Mon Aug 4 2014 Jeff Morriss
- Fix RPM builds with a prefix other than /usr: The location of
  update-alternatives does not depend on Wireshark's installation prefix:
  it's always in /usr/sbin/.

* Fri Aug  1 2014 Jeff Morriss
- Remove the old wireshark binary during RPM upgrades: this is needed because
  we now declare wireshark to be %ghost so it doesn't get overwritten during an
  upgrade (but in older RPMs it was the real program).

* Tue Jul  1 2014 Jeff Morriss
- Get rid of rpath when we're building RPMs: Fedora prohibits it, we don't
  need it, and it gets in the way some times.

* Tue Nov 26 2013 Jeff Morriss
- Overhaul options handling to pull in the UI choice from ./configure.
- Make it possible to not build the GNOME package.

* Tue Nov 12 2013 Jeff Morriss
- Add a 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)

* Thu Mar 28 2013 Jeff Morriss
- Simplify check for rpmbuild's version.

* Fri Mar  8 2013 Jeff Morriss
- Put all icons in hicolor
- Use SuSE's desktop-update macro.
- Actually update MIME database when Wireshark's prefix is not /usr .

* Thu Mar  7 2013 Jeff Morriss
- List more build dependencies.
- Update to work on SuSE too: some of their package names are different.

* Wed Mar  6 2013 Gerald Combs
- Enable c-ares by default

* Thu Feb  7 2013 Jeff Morriss
- Overhaul to make this file more useful/up to date.  Many changes are based
  on Fedora's .spec file.  Changes include:
  - Create a separate wireshark-gnome package (like Redhat).
  - Control some things with variables set at the top of the file.
    - Allow the user to configure how dumpcap is installed.
    - Allow the user to choose some options including GTK2 or GTK3.
  - Greatly expand the BuildRequires entries; get the minimum versions of some
    things from 'configure'.
  - Install freedesktop files for better (free)desktop integration.

* Thu Aug 10 2006 Joerg Mayer
- Starting with X.org 7.x X11R6 is being phased out. Install wireshark
  and manpage into the standard path.

* Mon Aug 01 2005 Gerald Combs
- Add a desktop file and icon for future use

- Take over the role of packager

- Update descriptions and source locations

* Thu Oct 28 2004 Joerg Mayer
- Add openssl requirement (heimdal and net-snmp are still automatic)

* Tue Jul 20 2004 Joerg Mayer
- Redo install and files section to actually work with normal builds

* Sat Feb 07 2004 Joerg Mayer
- in case there are shared libs: include them

* Tue Aug 24 1999 Gilbert Ramirez
- changed to ethereal.spec.in so that 'configure' can update
  the version automatically

* Tue Aug 03 1999 Gilbert Ramirez <gram@xiexie.org>
- updated to 0.7.0 and changed gtk+ requirement

* Sun Jan 03 1999 Gerald Combs <gerald@zing.org>
- updated to 0.5.1

* Fri Nov 20 1998 FastJack <fastjack@i-s-o.net>
- updated to 0.5.0

* Sun Nov 15 1998 FastJack <fastjack@i-s-o.net>
- created .spec file