File sygcpp.spec of Package sygcpp

%bcond_without qt

Name: sygcpp
Version: 5.1
Release: 1%{?dist}
Summary: Simple Yggdrasil address miner in C++
License: GPLv3
URL: https://notabug.org/acetone/SimpleYggGen-CPP
Source0: https://notabug.org/acetone/SimpleYggGen-CPP/archive/%{version}.tar.gz
Source1: sygcpp-qt.desktop
Patch0: sygcpp-fix-includes.patch
BuildRequires: gcc-c++
BuildRequires: cmake3 >= 3.0
BuildRequires: pkgconfig(libsodium)
%if %{with qt}
BuildRequires: pkgconfig(Qt5Core)
BuildRequires: pkgconfig(Qt5Gui)
BuildRequires: pkgconfig(Qt5Network)
BuildRequires: pkgconfig(Qt5Widgets)
%endif

%description
Simple Yggdrasil address miner in C++.

%package qt
Summary: Simple Yggdrasil address miner in C++ (GUI)

%description qt
Simple Yggdrasil address miner in C++ (GUI).

%prep
%autosetup -n simpleygggen-cpp -p1

%build
%cmake3
%{?cmake3_build}%{?!cmake3_build:%{make_build}}
%if %{with qt}
pushd src-qt
%qmake_qt5 syg-cpp.pro
%make_build
popd
%endif

%install
%if %{with qt}
%{__install} -D -m 755 src-qt/syg-cpp %{buildroot}%{_bindir}/sygcpp-qt
%{__install} -D -m 644 %{SOURCE1} %{buildroot}%{_datadir}/applications/sygcpp-qt.desktop
%{__install} -D -m 644  src/windows/syg-icon.ico %{buildroot}%{_datadir}/pixmaps/sygcpp.ico
%endif
%{?__cmake_builddir:cd %{__cmake_builddir}}
%{__install} -D -m 755 src/sygcpp %{buildroot}%{_bindir}/sygcpp

%files
%license LICENSE
%doc README.md
%{_bindir}/sygcpp

%if %{with qt}
%files qt
%license LICENSE
%doc README.md
%{_bindir}/sygcpp-qt
%{_datadir}/applications/sygcpp-qt.desktop
%{_datadir}/pixmaps/sygcpp.ico
%endif