File gridcoinresearch.spec of Package gridcoin
#
# spec file for package gridcoinresearch
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2021 Matthias Bach <marix@marix.org>
#
# 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: gridcoinresearch
Version: 5.4.9.0
Release: 0
Summary: P2P Digital Currency
License: MIT
Group: Productivity/Networking/Other
URL: http://www.gridcoin.us
Source: %{name}-%{version}.tar.xz
Source3: %{name}.xml
Patch1: avoid-cmake-messing-with-bdb-cflags.patch
Patch4: adapt-paths-and-user-in-Systemd-unit-to-match-SUSE-package.patch
Patch6: don-t-use-forking-launch-mode-in-Systemd-unit.patch
BuildRequires: cmake
%if 0%{?suse_version}
BuildRequires: firewall-macros
%endif
%if 0%{?suse_version} && 0%{?suse_version} <= 1540
# We need at least GCC8
BuildRequires: gcc8-c++
%else
%ifarch i586
%if 0%{?suse_version}
# On Tumbleweed i586 checks fail if gcc13 is used, see https://github.com/gridcoin-community/Gridcoin-Research/issues/2691
BuildRequires: gcc12-c++
%else
BuildRequires: gcc-c++
%endif
%endif
%endif
BuildRequires: git
BuildRequires: hicolor-icon-theme
BuildRequires: libQt5Charts5-devel
BuildRequires: libQt5Concurrent-devel
BuildRequires: libQt5DBus-devel
BuildRequires: libQt5Network-devel
BuildRequires: libQt5Test-devel
BuildRequires: libQt5Widgets-devel
BuildRequires: libqt5-linguist-devel
BuildRequires: libcurl-devel
BuildRequires: libminiupnpc-devel
BuildRequires: libopenssl-devel
BuildRequires: libqt5-linguist
BuildRequires: libtool
BuildRequires: libzip-devel
BuildRequires: libzip-tools
BuildRequires: protobuf-devel
BuildRequires: qrencode-devel
BuildRequires: sed
BuildRequires: update-desktop-files
%if 0%{?suse_version}
%if 0%{?suse_version} <= 1560
BuildRequires: libboost_chrono1_75_0-devel
BuildRequires: libboost_filesystem1_75_0-devel
BuildRequires: libboost_iostreams1_75_0-devel
BuildRequires: libboost_program_options1_75_0-devel
BuildRequires: libboost_system1_75_0-devel
BuildRequires: libboost_test1_75_0-devel
BuildRequires: libboost_thread1_75_0-devel
%else
BuildRequires: libboost_chrono-devel
BuildRequires: libboost_filesystem-devel
BuildRequires: libboost_iostreams-devel
BuildRequires: libboost_program_options-devel
BuildRequires: libboost_system-devel
BuildRequires: libboost_test-devel
BuildRequires: libboost_thread-devel
%endif
%else
BuildRequires: boost-devel
%if 0%{?fedora} >= 41
BuildRequires: openssl-devel-engine
%endif
%endif
%if %{defined suse_version}
Recommends: boinc-client
%endif
%description
Gridcoin is an open source peer-to-peer cryptocurrency using a BOINC based Proof
of Research instead of the more common Proof of Work for block generation.
%package -n gridcoinresearchd
Summary: Headless daemon for the Gridcoin crypto-currency
Group: Productivity/Networking/Other
Recommends: gridcoinresearch-firewall
Requires(post): pwgen
%description -n gridcoinresearchd
Gridcoin is an open source peer-to-peer cryptocurrency using a BOINC based Proof
of Research instead of the more common Proof of Work for block generation
This package provides gridcoinresearchd, headless gridcoin daemon.
%package qt
Summary: An end-user Qt GUI for the Gridcoin crypto-currency
Group: Productivity/Networking/Other
Recommends: gridcoinresearch-firewall
Requires: hicolor-icon-theme
%description qt
Gridcoin is an open source peer-to-peer cryptocurrency using a BOINC based Proof
of Research instead of the more common Proof of Work for block generation
This package provides gridcoinresearch, a GUI for Gridcoin based on Qt.
%package firewall
Summary: Firewall rules for Gridcoin
Group: Productivity/Networking/Other
BuildArch: noarch
%if 0%{?fedora_version}
Requires: firewalld-filesystem
%endif
%description firewall
Service definition to expose Gridcoin via firewalld.
%prep
%autosetup -p1
%build
%if 0%{?suse_version} && 0%{?suse_version} <= 1540
export CC='gcc-8'
export CXX='g++-8'
%endif
%ifarch i586
%if 0%{?suse_version}
# On Tumbleweed i586 checks fail if gcc13 is used, see https://github.com/gridcoin-community/Gridcoin-Research/issues/2691
export CC='gcc-12'
export CXX='g++-12'
%endif
%endif
# Redhat's hardening flags include -Werror=implicit-function-declaration. But this causes BDB configure to fail.
# A nicer fix would be to not use the vendored BDB but then we'd need to ensure we don't accidentally switch versions.
export CFLAGS="${CFLAGS} -Wno-error=implicit-function-declaration -Wno-error=incompatible-pointer-types"
# BDB's configure script cannot handle --runstatedir
%undefine _configure_use_runstatedir
# CMAKE_POLICY_VERSION_MINIMUM is needed to avoid CMake stumbling over old minimum cmake version declarations on Fedora Rawhide
%cmake -DENABLE_GUI=ON -DENABLE_TESTS=ON -DENABLE_PIE=ON -DENABLE_QRENCODE=ON -DENABLE_UPNP=ON -DUSE_DBUS=ON -DCMAKE_POLICY_VERSION_MINIMUM=3.5
%cmake_build \
%ifarch ppc64le
-j8 \
%endif
# end of make_build
%install
%cmake_install
# Install the service definition
install -D -m 644 %{SOURCE3} %{buildroot}%{_prefix}/lib/firewalld/services/%{name}.xml
mkdir -p %{buildroot}%{_sbindir}
ln -sv %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}d
install -dpm 0755 %{buildroot}%{_sysconfdir}/%{name}
%check
%ctest
%pre -n %{name}d
getent group %{name} >/dev/null || groupadd -r %{name}
getent passwd %{name} >/dev/null || useradd -r -g %{name} -d %{_localstatedir}/lib/%{name} -s /sbin/nologin -c "Gridcoin Research daemon" %{name}
%if 0%{?suse_version}
%service_add_pre %{name}d.service
%endif
%post -n %{name}d
%if 0%{?fedora_version}
%systemd_post %{name}d.service
%else
%service_add_post %{name}d.service
%endif
test -f %{_sysconfdir}/%{name}/%{name}.conf || { echo -e "rpcuser=gridcoinrpc\nrpcpassword=$(pwgen -n 24)" > %{_sysconfdir}/%{name}/%{name}.conf && chown root:%{name} %{_sysconfdir}/%{name}/%{name}.conf && chmod 0640 %{_sysconfdir}/%{name}/%{name}.conf; }
%if 0%{?suse_version}
%post firewall
%firewalld_reload
%endif
%preun -n %{name}d
%if 0%{?fedora_version}
%systemd_ipreun %{name}d.service
%else
%service_del_preun %{name}d.service
%endif
%postun -n %{name}d
%if 0%{?fedora_version}
%systemd_postun %{name}d.service
%else
%service_del_postun %{name}d.service
%endif
%files -n %{name}d
%{_bindir}/%{name}d
%{_mandir}/man1/%{name}d.1%{?ext_man}
%ghost %{_var}/lib/%{name}
%dir %attr(750,root,%{name}) %{_sysconfdir}/%{name}
%config %ghost %{_sysconfdir}/%{name}/%{name}.conf
%ghost %{_rundir}/%{name}
%{_unitdir}/%{name}d.service
%{_sbindir}/rc%{name}d
%files qt
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%{_datadir}/icons/hicolor/*/apps/gridcointestnet.png
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_mandir}/man1/%{name}.1%{?ext_man}
%files firewall
%dir %{_prefix}/lib/firewalld
%dir %{_prefix}/lib/firewalld/services
%{_prefix}/lib/firewalld/services/%{name}.xml
%changelog