File netvisix.spec of Package netvisix

#
# spec file for package netvisix
#
# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define hash 969fbcbcd74f
%define includedir_tins %(pkg-config --cflags-only-I libtins)
Name:           netvisix
Version:        1.4.0
Release:        0
Summary:        Visualizes the network packet flow between hosts
License:        GPL-3.0-or-later
Group:          Productivity/Networking/Other
URL:            https://github.com/bewue/Netvisix
Source0:        https://github.com/bewue/Netvisix/archive/v%{version}/%{name}-%{version}.tar.gz
Source1:        %{name}.policy
Source2:        icon.png
# PATCH-FIX-OPENSUSE libtins.patch avvissu@yandex.ru -- Use package from openSUSE instead of static library
Patch0:         %{name}-1.1.0_libtins.patch
BuildRequires:  dos2unix
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  libpcap-devel
BuildRequires:  pkgconfig
BuildRequires:  polkit
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Network)
BuildRequires:  pkgconfig(Qt5Widgets) >= 5.2.0
BuildRequires:  pkgconfig(libtins)
Requires:       polkit

%description
Netvisix listens on your local network interface and visualizes the network
packet flow between hosts. Also packet statistics per host are available.

Supported Protocols (colored and handeld in statistics): ARP, IPv4, IPv6, ICMP,
ICMPv6, IGMP, TCP, UDP, DNS, DHCP, DHCPv6

%prep
%setup -q -n Netvisix-%{version}
%patch -P0 -p1

dos2unix -k README.md

# Fix files is compiled without RPM_OPT_FLAG
find . -type f -name \*.pro | while read file; do
echo "QMAKE_CXXFLAGS += %{optflags} %{includedir_tins}" >> "$file"; done

%build
mkdir Build
pushd Build
# FIXME: you should use the %%qmake5 macro
qmake-qt5 ../Netvisix/Netvisix.pro
%make_build PREFIX=%{_prefix}
popd

%install
install -Dm 0755 Build/Netvisix %{buildroot}%{_bindir}/%{name}
install -Dm 0644 %{SOURCE1} %{buildroot}%{_datadir}/polkit-1/actions/org.opensuse.policykit.%{name}.policy
install -Dm 0644 %{SOURCE2} %{buildroot}%{_datadir}/pixmaps/%{name}.png
%{suse_update_desktop_file -c \
%{name} Netvisix "Visualizes the network packet flow" 'pkexec %{_bindir}/%{name}' %{name} Qt Network Monitor}

%files
%license LICENSE
%doc README*.md
%{_bindir}/%{name}
%{_datadir}/polkit-1/actions/org.opensuse.policykit.%{name}.policy
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/%{name}.desktop

%changelog
openSUSE Build Service is sponsored by