File ethash.spec of Package ethash
#
# spec file for package ethash
#
# Copyright (c) 2025 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 with_tests 0
Name: ethash
Version: 1.1.0
Release: 0
Summary: Ethereum PoW algorithm
License: Apache-2.0
Group: System/Libraries
URL: https://github.com/chfast/%{name}
Source0: %{name}-%{version}.tar.xz
Patch0: %{name}-cmake.patch
BuildRequires: cmake >= 3.13.4
BuildRequires: gcc-c++
BuildRequires: gtest
%if %{with_tests}
%define test_build ON
%else
%define test_build OFF
%endif
# set description
%define description_text C/C++ implementation of Ethash and ProgPoW – the Ethereum Proof of Work algorithms.
%description
%{description_text}
%package -n lib%{name}
Summary: ETHash C++ library
Group: System/Libraries
%description -n lib%{name}
%{description_text}
%package devel
Summary: Development files for %{name}
Group: Development/Libraries/C and C++
Requires: lib%{name} = %{version}
%description devel
The %{name}-devel package contains libraries and header files for developing applications that use %{name}.
%prep
%setup -q
%patch -P 0
%build
%cmake -DCMAKE_BUILD_TYPE=release -DHUNTER_ENABLED=OFF -DBUILD_STATIC_LIBS=NO -DBUILD_SHARED_LIBS=YES -DETHASH_NATIVE=ON -DETHASH_BUILD_TESTS=%{test_build}
%cmake_build
%{__strip} -s lib/*/*.so
%install
%cmake_install
%{__strip} -s %{buildroot}%{_libdir}/*.so
%if %{with_tests}
%check
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}${LD_LIBRARY_PATH:+:}${PWD}/build/lib/%{name}:${PWD}/build/lib/keccak"
cd build/test
./%{name}-test
%endif
%post -n lib%{name}
/sbin/ldconfig
%postun -n lib%{name}
/sbin/ldconfig
%files -n lib%{name}
%defattr(-,root,root,-)
%{_libdir}/*.so
%files devel
%defattr(-,root,root,-)
%{_includedir}/%{name}/
%{_libdir}/cmake/%{name}/
%{_libdir}/*.a
%doc CHANGELOG.md README.md
%license LICENSE
%changelog