description="Network Sniffer with nice GUI"
url="http://www.wireshark.org"

packager="spiky <spiky@nutyx.org>"
contributors="Fanch,Tnut,Greg,Rémy,Fabienwang"

makedepends=(cmake c-ares ninja shared-mime-info gtk3 libpcap pcre hicolor-icon-theme
             qt6-tools qt6-multimedia qt6-svg qt6-5compat)
run=(shared-mime-info hicolor-icon-theme)


name=wireshark
version=4.2.5

source=(https://www.wireshark.org/download/src/all-versions/wireshark-$version.tar.xz)

prepare() {
getent group wireshark ||groupadd -g 62 wireshark
}
build() {
  cd $name-$version

  mkdir build
  cd    build
  cmake  -DCMAKE_INSTALL_PREFIX=/usr \
         -DCMAKE_BUILD_TYPE=Release \
         -DMAKE_INSTALL_DOCDIR=/usr/share/doc/$name-$version \
         -G Ninja ..

  ninja
  DESTDIR=$PKG ninja install

  install -v -m755 -d $PKG/usr/share/doc/wireshark-$version
  install -v -m644    ../README.linux ../doc/README.* ../doc/{*.adoc,randpkt.txt} \
                      $PKG/usr/share/doc/wireshark-$version

  pushd $PKG/usr/share/doc/wireshark-$version
     for FILENAME in ../../wireshark/*.html; do
         ln -s -v -f $FILENAME .
     done
  popd
  unset FILENAME
}
