File primecoin.spec of Package primecoin

#
# spec file for package primecoin
#
# Copyright (c) 2021 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/
#


Name:           primecoin
Version:        0.1.5
Release:        0
Summary:        P2P digital currency
License:        MIT
Group:          Productivity/Networking/Other
URL:            https://%{name}.io/
Source0:        %{name}-%{version}.tar.xz
Patch0:         %{name}-boost1.patch
Patch1:         %{name}-boost2.patch
Patch2:         %{name}-make.patch
Patch3:         %{name}-net.patch
ExcludeArch:    aarch64
%if 0%{?suse_version} && 0%{?suse_version} > 1320
%if 0%{?suse_version} && 0%{?suse_version} > 1500
BuildRequires:  libboost_chrono1_84_0-devel
BuildRequires:  libboost_filesystem1_84_0-devel
BuildRequires:  libboost_program_options1_84_0-devel
BuildRequires:  libboost_system1_84_0-devel
BuildRequires:  libboost_thread1_84_0-devel
BuildRequires:  libboost_timer1_84_0-devel
%else
BuildRequires:  libboost_chrono-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  (libboost_system-devel if libboost_filesystem-devel < 1.89.0)
BuildRequires:  libboost_thread-devel
BuildRequires:  libboost_timer-devel
%endif
BuildRequires:  libopenssl-1_0_0-devel
%else
BuildRequires:  boost-devel
BuildRequires:  libopenssl-devel
%endif
BuildRequires:  libdb-4_8-devel
BuildRequires:  libminiupnpc-devel
BuildRequires:  libqt4-devel
BuildRequires:  qrencode-devel
BuildRequires:  update-desktop-files

%global qt4_version qt
%global qt5_version qt5

%define qt_version %{qt4_version}
%define qt_version_obsolete %{qt5_version}
%define ___qmake qmake

%if 0%{?suse_version} && 0%{?is_opensuse} && 0%{?suse_version} == 1315 && 0%{?sle_version} && 0%{?sle_version} >= 120200
%define ___qmake_cxxflags QMAKE_CXXFLAGS="${QMAKE_CXXFLAGS} -DBOOST_NO_CXX11_SCOPED_ENUMS"
%endif

%if 0%{?suse_version} && 0%{?suse_version} > 1320
%define ___qmake_cxxflags QMAKE_CXXFLAGS="${QMAKE_CXXFLAGS} -DBOOST_ASIO_ENABLE_OLD_SERVICES"
%endif

%if 0%{?suse_version} && 0%{?suse_version} > 1500
%define ___qmake_cxxflags QMAKE_CXXFLAGS="${QMAKE_CXXFLAGS} -DBOOST_BIND_GLOBAL_PLACEHOLDERS -std=c++14"
%else
%if 0%{?suse_version} && 0%{?suse_version} <= 1320
%define ___qmake_cxxflags QMAKE_CXXFLAGS="${QMAKE_CXXFLAGS} -std=c++11"
%endif
%endif

%define daemon_name %{name}d
%define display_name PrimeCoin
%define gui_name %{name}-qt

%define description_text_1 PrimeCoin is an experimental cryptocurrency that introduces the first
%define description_text_2 scientific computing proof-of-work to cryptocurrency technology. PrimeCoin's
%define description_text_3 proof-of-work is an innovative design based on searching for prime number
%define description_text_4 chains, providing potential scientific value in addition to minting and
%define description_text_5 security for the network. Similar to BitCoin, PrimeCoin enables instant payments
%define description_text_6 to anyone, anywhere in the world. It also uses peer-to-peer technology to
%define description_text_7 operate with no central authority: managing transactions and issuing money are
%define description_text_8 carried out collectively by the network. PrimeCoin is also the name of the open
%define description_text_9 source software which enables the use of this currency.

%define description_text_11 This is the high performance version of Sunny King's PrimeCoin tree.

%define description_text_13 Features:
%define description_text_14 * Extended sieve algorithm
%define description_text_15 * Cache-friendly segmented sieve
%define description_text_16 * Adjustable sieve parameters
%define description_text_17 * Mining threads use GMP for faster bignum arithmetic

%description
%{description_text_1}
%{description_text_2}
%{description_text_3}
%{description_text_4}
%{description_text_5}
%{description_text_6}
%{description_text_7}
%{description_text_8}
%{description_text_9}

%{description_text_11}

%{description_text_13}
%{description_text_14}
%{description_text_15}
%{description_text_16}
%{description_text_17}

%package %{qt_version}
Summary:        GUI for the %{display_name} crypto-currency
Group:          Productivity/Networking/Other
Obsoletes:      %{name}-%{qt_version_obsolete}

%description %{qt_version}
%{description_text_1}
%{description_text_2}
%{description_text_3}
%{description_text_4}
%{description_text_5}
%{description_text_6}
%{description_text_7}
%{description_text_8}
%{description_text_9}

%{description_text_11}

%{description_text_13}
%{description_text_14}
%{description_text_15}
%{description_text_16}
%{description_text_17}

This package provides %{display_name}-Qt, a GUI for %{display_name} based on Qt.

%package -n %{daemon_name}
Summary:        Headless daemon for %{name} crypto-currency
Group:          Productivity/Networking/Other

%description -n %{daemon_name}
%{description_text_1}
%{description_text_2}
%{description_text_3}
%{description_text_4}
%{description_text_5}
%{description_text_6}
%{description_text_7}
%{description_text_8}
%{description_text_9}

%{description_text_11}

%{description_text_13}
%{description_text_14}
%{description_text_15}
%{description_text_16}
%{description_text_17}

This package provides %{daemon_name}, a headless %{name} daemon.

%prep
%setup -q
%if 0%{?suse_version} && 0%{?suse_version} > 1320
%patch -P 0
%endif
%if 0%{?suse_version} && 0%{?suse_version} > 1500
%patch -P 1
%endif
%patch -P 2
%patch -P 3

%build
%{___qmake} USE_QRCODE=1 USE_DBUS=1 %{?___qmake_cxxflags}
%{__make} %{?_smp_mflags}
%{__strip} -s %{gui_name}
%if 0%{?suse_version} && 0%{?suse_version} > 1320
export CXXFLAGS="${CXXFLAGS} -DBOOST_ASIO_ENABLE_OLD_SERVICES"
#%else
#%if 0%{?suse_version} && 0%{?is_opensuse} && 0%{?suse_version} == 1315 && 0%{?sle_version} && 0%{?sle_version} >= 120200
#export CXXFLAGS="${CXXFLAGS} -DBOOST_NO_CXX11_SCOPED_ENUMS"
#%endif
%endif
%if 0%{?suse_version} && 0%{?suse_version} > 1500
export CXXFLAGS="${CXXFLAGS} -std=c++14"
%else
%if 0%{?suse_version} && 0%{?suse_version} <= 1320
export CXXFLAGS="${CXXFLAGS} -std=c++11"
%endif
%endif
%{__make} -C src -f makefile.unix %{?_smp_mflags}
%{__strip} -s src/%{daemon_name}

%install
%{__install} -dm 0755 %{buildroot}%{_bindir}
%{__install} -m 0755 %{gui_name} %{buildroot}%{_bindir}
%{__install} -m 0755 src/%{daemon_name} %{buildroot}%{_bindir}
%{__install} -dm 0755 %{buildroot}%{_datadir}/pixmaps
%{__install} -m 0644 src/qt/res/icons/primecoin.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
%suse_update_desktop_file -c %{gui_name} %{display_name} "%{display_name} Wallet" %{gui_name} %{name} Office Finance

%if 0%{?suse_version} && 0%{?suse_version} < 1500
%post %{qt_version}
%desktop_database_post

%postun %{qt_version}
%desktop_database_postun
%endif

%files %{qt_version}
%defattr(-,root,root,-)
%attr(755,root,root) %{_bindir}/%{gui_name}
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/%{gui_name}.desktop
%doc changlist.txt README.md
%license COPYING

%files -n %{daemon_name}
%defattr(-,root,root,-)
%attr(755,root,root) %{_bindir}/%{daemon_name}
%doc changlist.txt README.md
%license COPYING

%changelog
openSUSE Build Service is sponsored by