# Description: Network Sniffer with nice GTK+ UI
# URL: http://www.wireshark.org
# Packager: fanch at nutyx dot org
# Depends on: gtk3 libpcap pcre

name=wireshark
version=2.0.1
release=1
source=(http://www.$name.org/download/src/all-versions/$name-$version.tar.bz2
 http://www.linuxfromscratch.org/patches/blfs/svn/wireshark-2.0.1-lua_5_3_1-1.patch)

build() {
  cd $name-$version
patch -Np1 -i ../wireshark-2.0.1-lua_5_3_1-1.patch
  ./configure --prefix=/usr \
              --mandir=/usr/man \
              --with-plugins=/usr/lib/$name/plugins \
              --disable-nls \
              --enable-snmp \
              --disable-gcry \
              --without-krb5 \
              --with-qt4=no \
              --with-gtk3=yes

   make
   make DESTDIR=$PKG install
   install -v -m755 -d $PKG/usr/share/doc/$name-$version
   install -v -m644    README{,.linux} doc/README.* doc/*.{pod,txt} \
                    $PKG/usr/share/doc/$name-$version

   pushd $PKG/usr/share/doc/$name-$version
   for FILENAME in ../../wireshark/*.html; do
      ln -s -v -f $FILENAME .
   done 
   popd
   unset FILENAME
 
  chown -v root:wireshark $PKG/usr/bin/{tshark,dumpcap} &&
  chmod -v 6550 $PKG/usr/bin/{tshark,dumpcap} 

  install -Dm755 .libs/wireshark-gtk ${PKG}/usr/bin/wireshark-gtk
  install -Dm644 wireshark-gtk.desktop ${PKG}/usr/share/applications/wireshark-gtk.desktop
}
