%define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")

Summary: 	Network traffic analyzer
Summary(ja):    ネットワークトラフィック解析プログラム
Name: 		wireshark
Version:	1.12.12
Release: 	1%{_dist_release}
License: 	GPLv2
Group: 		Applications/System
Source0:	http://www.wireshark.org/download/src/%{name}-%{version}.tar.bz2
Source1:	wireshark.pam
Source2:	wireshark.console
Source3:	wireshark.desktop
Patch4:         wireshark-0.99.7-path.patch
Patch5:         wireshark-1.10.0-lua-vine.patch
URL: 		http://www.wireshark.org/

BuildRoot: 	%{_tmppath}/%{name}-%{version}-root

BuildRequires:	libcap-devel
BuildRequires: 	net-snmp-devel >= 5.0
BuildRequires: 	net-snmp-utils >= 5.0
BuildRequires: 	zlib-devel, bzip2-devel
BuildRequires:  openssl-devel
BuildRequires:	glib2-devel, gtk2-devel
BuildRequires:  libelf-devel
BuildRequires:  python, pcre-devel
BuildRequires:  gnutls-devel
BuildRequires:  desktop-file-utils, automake, libtool
BuildRequires:  bison, flex
BuildRequires:  krb5-devel
BuildRequires:	libpcap-devel
BuildRequires:	lua-devel

Requires:	usermode >= 1.37
Requires(post):	desktop-file-utils
Requires(postun): desktop-file-utils

Obsoletes:	ethereal
Obsoletes:      ethereal-base ethereal-gnome ethereal-gtk+
Obsoletes:      ethereal-kde ethereal-usermode
Provides:	ethereal ethereal-gnome

Vendor:         Project Vine
Distribution:   Vine Linux
Packager: inagaki, Takemikaduchi

%description
Wireshark is a network traffic analyzer for Unix-ish operating systems.

This package lays base for libpcap, a packet capture and filtering 
library, contains command-line utilities, contains plugins and 
documentation for wireshark. A graphical user interface is also 
included with this package.

%description -l ja
Wireshark は，UNIX 系 OS 用のネットワークトラフィック解析プログラムです．

このパッケージは，パケットキャプチャ/フィルタリングライブラリである
libpcap を使ったコマンドラインツールと，プラグイン，ドキュメント等が
収められています．GUI もこのパッケージに収められています．

%prep
%setup -q -n %{name}-%{version}
%patch4 -p1
%patch5 -p1 -b .lua-vine

%build
%ifarch s390 s390x
export PIECFLAGS="-fPIE"
%else
export PIECFLAGS="-fpie"
%endif
# FC5+ automatic -fstack-protector-all switch
export RPM_OPT_FLAGS=${RPM_OPT_FLAGS//-fstack-protector/-fstack-protector-all}
## export CFLAGS="$RPM_OPT_FLAGS $CPPFLAGS -I%{_includedir}/pcap -I%{_includedir}/pcre"
export CFLAGS="$RPM_OPT_FLAGS $CPPFLAGS -I%{_includedir}/pcre"
export CXXFLAGS="$RPM_OPT_FLAGS $CPPFLAGS"
export LDFLAGS="$LDFLAGS -lm -lcrypto"
export PATH="$PATH:/usr/kerberos/bin"
./autogen.sh
# --disable-warning-as-erros needs for compiling with glib 2.14.0
%configure \
   --bindir=%{_sbindir} \
   --enable-ipv6 \
   --with-gnu-ld \
   --disable-static \
   --disable-usr-local \
   --enable-wireshark \
   --with-pic \
   --with-ssl \
   --with-pcap \
   --with-pcre \
%if %{?_dist_release} != "vl4"
   --with-krb5 \
%else
   --without-krb5 \
%endif
   --with-plugins=%{_libdir}/%{name}/plugins/%{version} \
   --disable-warnings-as-errors \
   --without-qt \
   --with-gtk2=yes \
   --with-gtk3=no
time make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

# The evil plugins hack
perl -pi -e 's|-L../../epan|-L../../epan/.libs|' plugins/*/*.la

make DESTDIR=$RPM_BUILD_ROOT install

#symlink tshark to tethereal
ln -s tshark $RPM_BUILD_ROOT%{_sbindir}/tethereal

#empty?!
rm -f $RPM_BUILD_ROOT%{_sbindir}/idl2wrs

# install support files for usermode, gnome and kde
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/pam.d
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_sysconfdir}/pam.d/wireshark
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/security/console.apps
install -m 644 %{SOURCE2} $RPM_BUILD_ROOT/%{_sysconfdir}/security/console.apps/wireshark
mkdir -p $RPM_BUILD_ROOT/%{_bindir}
ln -s consolehelper $RPM_BUILD_ROOT/%{_bindir}/wireshark

# install man
## mkdir -p $RPM_BUILD_ROOT/%{_mandir}/man1
## install -m 644 *.1 $RPM_BUILD_ROOT/%{_mandir}/man1

# Install python stuff.
mkdir -p $RPM_BUILD_ROOT%{python_sitelib}
install -m 644 tools/wireshark_be.py tools/wireshark_gen.py  $RPM_BUILD_ROOT%{python_sitelib}

desktop-file-install --vendor=                             \
        --dir ${RPM_BUILD_ROOT}%{_datadir}/applications    \
        %{SOURCE3}

mkdir -p $RPM_BUILD_ROOT/%{_datadir}/pixmaps
install -m 644 image/wsicon48.png $RPM_BUILD_ROOT/%{_datadir}/pixmaps/wireshark.png


# Remove .la files
rm -f $RPM_BUILD_ROOT/%{_libdir}/%{name}/plugins/%{version}/*.la

# Remove .la files in libdir
rm -f $RPM_BUILD_ROOT/%{_libdir}/*.la

%clean
rm -rf $RPM_BUILD_ROOT

%post
/sbin/ldconfig
update-desktop-database -q

%postun 
/sbin/ldconfig
update-desktop-database -q

%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog INSTALL NEWS README* 
%{_sbindir}/editcap
%{_sbindir}/tshark
%{_sbindir}/mergecap
%{_sbindir}/text2pcap
%{_sbindir}/dftest
%{_sbindir}/capinfos
%{_sbindir}/captype
%{_sbindir}/randpkt
%{_sbindir}/dumpcap
%{_sbindir}/tethereal
%{_sbindir}/rawshark
%{_sbindir}/reordercap
%{python_sitelib}/*
%{_libdir}/lib*
%{_mandir}/man1/editcap.*
%{_mandir}/man1/tshark.*
%{_mandir}/man1/mergecap.*
%{_mandir}/man1/text2pcap.*
%{_mandir}/man1/capinfos.*
%{_mandir}/man1/dumpcap.*
%{_mandir}/man1/reordercap.*
%{_mandir}/man4/wireshark-filter.*
%{_libdir}/wireshark
%config(noreplace) %{_sysconfdir}/pam.d/wireshark
%config(noreplace) %{_sysconfdir}/security/console.apps/wireshark

%config(noreplace) %{_datadir}/%{name}/init.lua
%{_datadir}/%{name}/AUTHORS-SHORT
%{_datadir}/%{name}/COPYING
%{_datadir}/%{name}/*.html
%{_datadir}/%{name}/*.css
%{_datadir}/%{name}/cfilters
%{_datadir}/%{name}/colorfilters
%{_datadir}/%{name}/console.lua
%{_datadir}/%{name}/dfilters
%{_datadir}/%{name}/diameter
%{_datadir}/%{name}/dtd_gen.lua
%{_datadir}/%{name}/dtds
%{_datadir}/%{name}/help
%{_datadir}/%{name}/manuf
%{_datadir}/%{name}/pdml2html.xsl
%{_datadir}/%{name}/profiles
%{_datadir}/%{name}/radius
%{_datadir}/%{name}/services
%{_datadir}/%{name}/smi_modules
%{_datadir}/%{name}/tpncp
%{_datadir}/%{name}/wimaxasncp

%{_datadir}/applications/*.desktop
%{_datadir}/pixmaps/wireshark.png
%{_bindir}/wireshark
%{_sbindir}/wireshark
%{_mandir}/man1/wireshark.*
%{_mandir}/man1/rawshark.*
%{_mandir}/man1/dftest.*
%{_mandir}/man1/randpkt.*


%changelog
* Tue Jun 14 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.12-1
- new upstream release

* Sat Apr 23 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.11-1
- new upstream release

* Tue Mar 29 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.10-1
- new upstream release

* Wed Dec 30 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.9-1
- new upstream release

* Wed Dec 30 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.8-2
- rebuild with gnutls-3.4.7

* Thu Oct 15 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.8-1
- new upstream release (including security fix for CVE-2015-7830)

* Sun Aug 16 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.7-1
- new upstream release

* Thu Jun 18 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.6-1
- new upstream release

* Wed May 13 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.5-1
- new upstream release
  (including security fix for CVE-2015-3808,3809,3810,3811,3812,3813,3814,3815)

* Sun Mar 08 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.4-1
- new upstream release
  (including security fix for CVE-2015-2187,2188,2189,2190,2191,2192)

* Sat Jan 10 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.3-1
- new upstream release
  (including security fix for CVE-2015-0559,0560,0561,0562,0563,0564)

* Sun Nov 16 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.12.2-1
- new upstream release
  (including security fix for CVE-2014-8710,8711,8712,8713,8714)

* Tue Sep 23 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.10-1
- new upstream release

* Thu Aug 07 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.9-1
- new upstream release

* Fri Jun 13 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.8-1
- new upstream release
  (including security fix for CVE-2014-4020)

* Sat May 03 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.7-1
- new upstream release
  (including security fix for CVE-2014-2907)

* Sat Mar 15 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.6-1
- new upstream release
  (including security fix for CVE-2014-2281,2282,2283,2299)

* Sun Dec 22 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.5-1
- new upstream release

* Tue Nov 05 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.3-1
- new upstream release
  (including security fix for CVE-2013-6336,6337,6338,6339,6340)

* Mon Sep 16 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.2-1
- new upstream release

* Sun Jul 28 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.1-1
- new upstream release
  (including security fix for CVE-2013-4083,4920,4921,4922,4923,4924,4925,4926,4927,4929,4930,4931,4932,4944,4934,4935,4936)

* Sat Jun 22 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.10.0-1
- new upstream release
- update Patch5 (wireshark-1.10.0-lua-vine.patch)
- remove Patch3 (wireshark-nfsv4-opts.patch)

* Sat May 18 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.7-1
- new upstream release
  (including security fix for CVE-2013-2486 - 2487)

* Sun Mar 10 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.6-1
- new upstream release
  (including security fix for CVE-2013-2475 - 2488)

* Wed Jan 30 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.5-1
- new upstream release

* Tue Jan 01 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.4-1
- new upstream release

* Wed Oct 03 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.3-1
- new upstream release
  (including security fix for CVE-2012-5237 - 5240)

* Thu Aug 16 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.2-1
- new upstream release
  (including security fix for CVE-2012-4285 - 4298)

* Tue Jul 24 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.1-1
- new upstream release

* Fri Jun 22 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.8.0-1
- new upstream release

* Wed May 23 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6.8-1
- new upstream release

* Sun Apr 29 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6.7-1
- new upstream release

* Thu Jan 12 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6.5-1
- new upstream release

* Tue Nov 22 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6.4-1
- new upstream release

* Sat Nov 05 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6.3-1
- new upstream release

* Thu Sep 15 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6.2-1
- new upstream release

* Sun Jul 31 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.6.1-1
- new upstream release

* Sun Jun 05 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.7-1
- new upstream release
  (including security fix for CVE-2011-1957,1958,1959,2174,7175)

* Sun Apr 24 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.6-1
- new upstream release

* Wed Mar 23 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.4-2
- rebuild with krb5-libs-1.8.2

* Wed Mar 02 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.4-1
- new upstream release
  (including security fix for CVE-2011-0538 and CVE-2011-0713)

* Sat Jan 15 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.3-1
- new upstream release
  (including security fix for CVE-2010-4538)

* Mon Jan 10 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.2-2
- rebuild with openssl-1.0.0c

* Sat Nov 20 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.2-1
- new upstream release

* Sat Oct 16 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.1-1
- new upstream release
  (including security fix for CVE-2010-3445)

* Sun Sep 19 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.4.0-1
- new upstream release
- add Patch5 (wireshark-1.4.0-lua-vine.patch)

* Mon Aug 02 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.10-1
- new upstream release
  (including security fix for CVE-2010-2287 and CVE-2010-2284)

* Wed Jul 07 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.9-1
- new upstream release

* Tue May 25 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.2.8-2
- rebuilt with libpcap-1.1.1

* Sat May 08 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.8-1
- new upstream release
  (including security fix for CVE-2010-1455)

* Thu Apr 29 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.2.7-1
- new upstream release

* Wed Feb 03 2010 Shu KONNO <owa@bg.wakwak.com> 1.2.5-3
- rebuilt with python-2.6.4

* Sun Dec 20 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.5-2
- added --enable-wireshark instead of --enable-gtk2
- added BR: bison, flex

* Sat Dec 19 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.2.5-1
- new upstream release with security fixes (SNA/SMB/IPMI issues)

* Thu Oct 29 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.3-1
- new upstream release
  (includeing security fix for CVE-2009-3549,3550 and 3551)

* Wed Sep 23 2009 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.2.2-2
- add BR: lua-devel (Vine 5.0 and later)

* Sat Sep 19 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.2-1
- new upstream release

* Tue Jul 21 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.1-1
- new upstream release

* Mon Jul 20 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.2.0-1
- new upstream release

* Sat May 23 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.8-1
- new upstream release

* Fri Apr 10 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.7-1
- new upstream release

* Mon Feb  9 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.6-1
- new upstream release
- used more macros

* Sat Jan 24 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.5-1
- new upstream release

* Sun Nov 09 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.0.4-2vl5
- rebuilt

* Mon Oct 27 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.0.4-1
- new upstream release with security fix
- add BuildRequires krb5-devel
- SPEC in UTF-8

* Fri Sep 05 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.0.3-1
- new upstream release with security update

* Wed Apr 02 2008 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 1.0.0-1
- new upstream release with security update
- add Vendor/Distribution tag
- add BuildRequires: libcap-devel
- new versioning policy

* Tue Jan  8 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 0.99.7-0vl2
- modified Source3 because of desktop-file-install error, like this:
    /var/tmp/wireshark-0.99.7-root/usr/share/applications/wireshark.desktop:
    error: value "wireshark.png" for key "Icon" in group "Desktop Entry" is
    an icon name with an extension, but there should be no extension as
    described in the Icon Theme Specification if the value is not an
    absolute path
  this warning/error occurs with desktop-file-utils >= 0.14

* Wed Jan 2 2008 Satoshi MACHINO <machino@vinelinux.org> 0.99.7-0vl1
- new upstream release
- imported patch4 from fc9

* Sun Sep  2 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.99.6-0vl2
- rebuilt with libpcap-0.9.7
- added --disable-warning-as-errors to %%configure for glib-2.14.0

* Sat Jul  7 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.99.6-0vl1
- new upstream release
- rebuilt with libpcap-0.9.6
- added --with-pcap, --with-pcre

* Fri Jun  1 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.99.5-0vl2
- rebuilt with new toolchain and environment

* Thu Feb  8 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.99.5-0vl1
- new upstream release

* Mon Nov 13 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.99.4-0vl1
- new upstream release

* Wed Oct  4 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.99.3-0vl1
- initial built for Vine Linux based on Fedora 
- Obsoletes: ethereal, Provides: ethereal

* Fri Aug 25 2006 Radek Vokal <rvokal@redhat.com> 0.99.3-fc5.1
- upgrade to 0.99.3-1
- CVE-2006-4330 Wireshark security issues (CVE-2006-4333 CVE-2006-4332 CVE-2006-4331)

* Wed Jul 26 2006 Radek Vokal <rvokal@redhat.com> 0.99.2-fc5.2
- fix BuildRequires

* Tue Jul 25 2006 Radek Vokal <rvokal@redhat.com> 0.99.2-fc5.1
- build for FC5

* Tue Jul 18 2006 Radek Vok叩l <rvokal@redhat.com> 0.99.2-1
- upgrade to 0.99.2

* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 0.99.2-0.pre1.1
- rebuild

* Tue Jul 11 2006 Radek Vok叩l <rvokal@redhat.com> 0.99.2-0.pre1
- upgrade to 0.99.2pre1, fixes (#198242)

* Tue Jun 13 2006 Radek Vokal <rvokal@redhat.com> 0.99.1-0.pre1
- spec file changes

* Fri Jun  9 2006 Radek Vokal <rvokal@redhat.com> 0.99.1pre1-1
- initial build for Fedora Core
