File ethereum-cpp.spec of Package ethereum-cpp

# spec file for package ethereum-cpp
# 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

Name:           ethereum-cpp
Version:        1.8.0
Release:        0
Summary:        Ethereum C++ implementation
License:        GPL-3.0-only
Group:          System/Libraries
Source0:        %{name}-%{version}.tar.xz
Patch0:         00_disable_wasm.patch
Patch1:         01_find_libs.patch
Patch2:         02_cryptopp.patch
Patch4:         04_secp256k1.patch
Patch5:         05_use_system_json_spirit.patch
Patch6:         06_disable_broken_test.patch
Patch7:         07_longer_test_timeout.patch
Patch9:         09_fix_lto.patch
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gtest
BuildRequires:  intx-devel
BuildRequires:  json_spirit-devel
BuildRequires:  libboost_atomic-devel
BuildRequires:  libboost_context-devel
BuildRequires:  libboost_fiber-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_headers-devel
BuildRequires:  libboost_log-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
BuildRequires:  libff-devel
BuildRequires:  libleveldb-devel
BuildRequires:  libscrypt-devel
BuildRequires:  pkg-config
BuildRequires:  rocksdb-devel
BuildRequires:  solidity
BuildRequires:  cmake(Snappy)
BuildRequires:  cmake(ethash)
BuildRequires:  cmake(fmt)
BuildRequires:  cmake(yaml-cpp)
BuildRequires:  pkgconfig(cryptopp)
BuildRequires:  pkgconfig(jsoncpp)
BuildRequires:  pkgconfig(libjsonrpccpp-client) = 0.7.0
BuildRequires:  pkgconfig(libjsonrpccpp-server) = 0.7.0
BuildRequires:  pkgconfig(libsecp256k1)

Ethereum is a decentralized platform that runs smart contracts: applications
that run exactly as programmed without any possibility of downtime, censorship,
fraud or third party interference.

These apps run on a custom built blockchain, an enormously powerful shared
global infrastructure that can move value around and represent the ownership of
property. This enables developers to create markets, store registries of debts
or promises, move funds in accordance with instructions given long in the past
(like a will or a futures contract) and many other things that have not been
invented yet, all without a middle man or counterparty risk.

%package -n libethereum
Summary:        Ethereum C++ library
Group:          System/Libraries

%description -n libethereum
Libraries for the Ethereum C++ implementation.

%package -n libethereum-devel
Summary:        Development files for libethereum
Group:          Development/Libraries/C and C++
Requires:       libethereum = %{version}
BuildRequires:  cmake(ethash)
BuildRequires:  intx-devel
BuildRequires:  json_spirit-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libboost_headers-devel
BuildRequires:  libboost_log-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_thread-devel
BuildRequires:  libleveldb-devel
BuildRequires:  pkgconfig(jsoncpp)
BuildRequires:  pkgconfig(libjsonrpccpp-server) = 0.7.0
BuildRequires:  rocksdb-devel

%description -n libethereum-devel
The %{name}-devel package contains libraries and header files for developing applications that use libethereum.

%package doc
Summary:        Documentation for %{name}
Group:          Documentation/Man
BuildArch:      noarch

%description doc
This package contains the documentation for %{name}.

%setup -q -n ethereum-cpp-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch9 -p1

# let's pretend that submodules are pulled
touch evmc/.git
touch cmake/cable/.git

%cmake \
%if %suse_version > 1500
cd ../doc
doxygen Doxyfile

# install common binaries and libs

for i in ${execs[@]}; do
    install -D -m 755 build/$i/$i %{buildroot}%{_bindir}/$i
for i in ${libs[@]}; do
    install -D -m 755 build/$i/$ %{buildroot}%{_libdir}/$
    mkdir -p %{buildroot}%{_includedir}/$i
    cp $i/*.h %{buildroot}%{_includedir}/$i/

# install evmc
install -D -m 644 build/evmc/lib/instructions/libevmc-instructions.a %{buildroot}%{_libdir}/libevmc-instructions.a
install -D -m 644 build/evmc/lib/loader/libevmc-loader.a %{buildroot}%{_libdir}/libevmc-loader.a
cp -r evmc/include/evmc %{buildroot}%{_includedir}/

# install documentation
install -d -m 0755 %{buildroot}%{_defaultdocdir}/%{name}
install -m 0644 -p -t %{buildroot}%{_defaultdocdir}/%{name}
cp -a doc/html %{buildroot}%{_defaultdocdir}/%{name}/
%fdupes %{buildroot}%{_defaultdocdir}/%{name}

export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
# network tests get stuck when run in parallel
#%%ctest -j1
cd build
ctest --output-on-failure --force-new-ctest-process

%post -n libethereum -p /sbin/ldconfig
%postun -n libethereum -p /sbin/ldconfig

%attr(755,root,root) %{_bindir}/*

%files -n libethereum

%files -n libethereum-devel

%files doc

openSUSE Build Service is sponsored by