A new user interface for you! Read more...

File BitShares2.spec of Package BitShares2

#
# spec file for package BitShares2
#
# Copyright (c) 2016-2019 Peter Conrad
#
# 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 http://bugs.opensuse.org/

%if 0%{?fedora} >= 16
%define _unitdir	%(pkg-config --variable=systemdsystemunitdir systemd)
%endif
%if 0%{?suse_version} < 1000
%define defined()	%{expand:%%{?%{1}:1}%%{!?%{1}:0}}
%define undefined()	%{expand:%%{?%{1}:0}%%{!?%{1}:1}}
%endif

%if 0%{?sle_version} == 150000 && 0%{?is_opensuse}
%define	_boost_version	1_66_0
%endif
%if 0%{?suse_version} == 1550 && 0%{?is_opensuse}
# Apparently cannot distinguish factory and tumbleweed :-/
%define	_boost_version	1_68_0
%endif

%define GIT_SHA		623aea265f2711adade982fc3248e6528dc8ac51
%define GIT_SHA_FC	8ebd99b786623bc8d55e89d42df82644a71a6885
%define GIT_SHA_SEC	bd067945ead3b514fba884abd0de95fc4b5db9ae
%define GIT_SHA_WSPP	792cb455bec45837d8d801e82c6fd86c38e1dbdb
%define GIT_SHA_EL	fbb1f8800adbb70264fa3893dc221f524e25708c
%define	GIT_TIME	1554754463

Name:		BitShares2
Version:	3.0.1
Release:	1
License:	GPL-3.0 and MIT and BSD-3-Clause and Zlib and BSL-1.0
Summary:	A Financial Smart Contract Platform
Url:		http://bitshares.org/
Group:		Productivity/Networking/Other
Source:		https://github.com/bitshares/bitshares-core/archive/%{version}.tar.gz
Source2:	https://github.com/bitshares/bitshares-fc/archive/%{GIT_SHA_FC}.tar.gz
Source3:	https://github.com/bitshares/secp256k1-zkp/archive/%{GIT_SHA_SEC}.tar.gz
Source4:	https://github.com/bitshares/websocketpp/archive/%{GIT_SHA_WSPP}.tar.gz
Source5:	licenses.tar.bz2
Source6:	%{name}_full_node.service
Source7:	https://github.com/troglobit/editline/archive/%{GIT_SHA_EL}.tar.gz
Source8:	config-full.ini
Source10:	README.LICENSE
Source11:	full_node.apparmor
BuildRequires:	cmake >= 2.8.12
BuildRequires:	autoconf automake libtool
BuildRequires:	boost-devel >= 1.57
BuildRequires:	libopenssl-devel
BuildRequires:	libcurl-devel
BuildRequires:	readline-devel
BuildRequires:	doxygen
%if 0%{?suse_version} > 0
BuildRequires:	apparmor-parser
Requires(pre):	pwdutils
%else
Requires(pre):	shadow-utils
%endif
%if 0%{?suse_version} > 0 && 0%{?suse_version} <= 1320
BuildRequires:	gcc5 gcc5-c++
#!BuildIgnore:	libgcc_s1-gcc5
%else
BuildRequires:	gcc-c++
%endif
%if %{defined _boost_version}
BuildRequires:	libboost_thread%{_boost_version}-devel
BuildRequires:	libboost_iostreams%{_boost_version}-devel
BuildRequires:	libboost_date_time%{_boost_version}-devel
BuildRequires:	libboost_system%{_boost_version}-devel
BuildRequires:	libboost_filesystem%{_boost_version}-devel
BuildRequires:	libboost_program_options%{_boost_version}-devel
BuildRequires:	libboost_chrono%{_boost_version}-devel
BuildRequires:	libboost_test%{_boost_version}-devel
BuildRequires:	libboost_context%{_boost_version}-devel
BuildRequires:	libboost_coroutine%{_boost_version}-devel
BuildRequires:	libboost_regex%{_boost_version}-devel
%endif
Requires(pre):	openssl
BuildRoot:	%{_tmppath}/%{name}-%{version}-build

%description

The BitShares platform is run and maintained by the BitShares community – an
open consortium of individuals and organizations committed to providing
universal access to the power of smart contracts.

The BitShares platform features:

* price-stable cryptocurrencies
* a decentralized asset exchange
* industrial performance and scalability
* dynamic account permissions
* a referral rewards program
* user-issued assets
* stakeholder-approved project funding
* transferrable named accounts
* delegated-proof-of-stake consensus

This package contains the witness_node binary as well as the command line
(CLI) wallet. If you only want the client, you may prefer to
go to https://openledger.io/ .

%prep
%if 0%{?suse_version} > 0
echo "Building for SUSE 0%{?suse_version} / 0%{?sle_version} / 0%{?sles_version} / 0%{?is_opensuse}"
%endif
%setup -q -a 2 -a 3 -a 4 -a 5 -a 7 -n bitshares-core-%{version}
%__cp "%{S:10}" .
rmdir libraries/fc
%__mv bitshares-fc-%{GIT_SHA_FC} libraries/fc
rmdir libraries/fc/vendor/secp256k1-zkp
%__mv secp256k1-zkp-%{GIT_SHA_SEC} libraries/fc/vendor/secp256k1-zkp
rmdir libraries/fc/vendor/websocketpp
%__mv websocketpp-%{GIT_SHA_WSPP} libraries/fc/vendor/websocketpp
rmdir libraries/fc/vendor/editline
%__mv editline-%{GIT_SHA_EL} libraries/fc/vendor/editline

%build
cd libraries/fc
%__sed -i '/GetGit/d;s/^get_git_head.*/SET( FC_GIT_REVISION_SHA "%{GIT_SHA}" )/;s/^get_git_unix.*/SET( FC_GIT_REVISION_UNIX_TIMESTAMP %{GIT_TIME} )/' CMakeLists.txt
cd ../..

%__sed -i '/compile_date/s=^=//=' libraries/wallet/wallet.cpp
%__sed -i '/^get_git_\|GetGitRev\|git_descr/d' CMakeLists.txt libraries/utilities/CMakeLists.txt
%__sed -i 's=.*GitVersion.*=SET(GRAPHENE_GIT_REVISION_UNIX_TIMESTAMP %{GIT_TIME})=' libraries/utilities/CMakeLists.txt
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo \
      -DCMAKE_C_FLAGS_RELEASE=-DWEBSOCKETPP_STRICT_MASKING \
      -DCMAKE_CXX_FLAGS_RELEASE=-DWEBSOCKETPP_STRICT_MASKING \
%if 0%{?suse_version} > 0 && 0%{?suse_version} <= 1320
      -DCMAKE_C_COMPILER=/usr/bin/gcc-5 \
      -DCMAKE_CXX_COMPILER=/usr/bin/g++-5 \
%endif
      -DBoost_USE_STATIC_LIBS=OFF .
%__make cli_wallet witness_node # %{?_smp_mflags} # needs too much RAM
#touch programs/witness_node/witness_node programs/cli_wallet/cli_wallet

%install
%__mkdir_p "%{buildroot}%{_bindir}"
%__install -m 0755 programs/cli_wallet/cli_wallet "%{buildroot}%{_bindir}/%{name}_cli_wallet"
%__mkdir_p "%{buildroot}%{_sbindir}"
%__install -m 0755 programs/witness_node/witness_node "%{buildroot}%{_sbindir}/%{name}_witness_node"
%__ln_s /usr/sbin/service %{buildroot}%{_sbindir}/rc%{name}_full_node
if [ -d /etc/apparmor.d ]; then
    %__install -dm 755 "%{buildroot}/etc/apparmor.d"
    %__install -m 644 "%{S:11}" "%{buildroot}/etc/apparmor.d/usr.sbin.%{name}_witness_node"
fi
%__mkdir_p "%{buildroot}%{_unitdir}"
%__install -m 0644 "%{S:6}" "%{buildroot}%{_unitdir}"
%__mkdir_p "%{buildroot}%{_localstatedir}/cache/%{name}/full_node/blockchain"
%__mkdir_p "%{buildroot}%{_localstatedir}/cache/%{name}/full_node/object_database"
%__mkdir_p "%{buildroot}%{_localstatedir}/lib/%{name}/full_node/p2p"
%__mkdir_p "%{buildroot}%{_localstatedir}/log/%{name}/full_node"
%__mkdir_p "%{buildroot}%{_sysconfdir}/%{name}"
%__ln_s "../../../log/%{name}/full_node" "%{buildroot}%{_localstatedir}/lib/%{name}/full_node/logs"
%__ln_s "../../../cache/%{name}/full_node"/{blockchain,object_database} "%{buildroot}%{_localstatedir}/lib/%{name}/full_node/"
%__ln_s "%{_sysconfdir}/%{name}/config-full.ini" "%{buildroot}%{_localstatedir}/lib/%{name}/full_node/config.ini"
touch "%{buildroot}%{_sysconfdir}/%{name}/p2p-full.json"
chmod 600 "%{buildroot}%{_sysconfdir}/%{name}/p2p-full.json"
%__ln_s "%{_sysconfdir}/%{name}/p2p-full.json" "%{buildroot}%{_localstatedir}/lib/%{name}/full_node/p2p/node_config.json"
%__install -m 0600 "%{S:8}" "%{buildroot}%{_sysconfdir}/%{name}"

%__debug_install_post

%pre
getent group bitshares >/dev/null || groupadd -r bitshares
getent passwd bitshares >/dev/null || useradd -r -g bitshares -d "%{_sysconfdir}/%{name}" -s /sbin/nologin -c "User for bitshares node daemons" bitshares
%if %{defined service_add_pre}
%service_add_pre %{name}_full_node.service
%endif

%post
%if %{defined service_add_post}
%service_add_post %{name}_full_node.service
%endif
P2P="%{_sysconfdir}/%{name}/p2p-full.json"
if [ -e "$P2P" -a ! -s "$P2P" ]; then
    cat >"$P2P" <<__EOJ__
{
  "listen_endpoint": "0.0.0.0:0",
  "accept_incoming_connections": true,
  "wait_if_endpoint_is_busy": false,
  "private_key": "`openssl rand -hex 32`"
}
__EOJ__
fi

%preun
%if %{defined service_del_preun}
%service_del_preun %{name}_full_node.service
%endif

%postun
%if %{defined service_del_postun}
%service_del_postun %{name}_full_node.service
%endif

%files
%defattr(-,root,root,-)
%doc LICENSE.txt README.LICENSE README.md licenses/
%{_bindir}/%{name}_cli_wallet
%{_sbindir}/%{name}_witness_node
%attr(-,bitshares,bitshares) %{_localstatedir}/cache/%{name}/
%attr(-,bitshares,bitshares) %{_localstatedir}/lib/%{name}/
%attr(-,bitshares,bitshares) %{_localstatedir}/log/%{name}/
%attr(-,bitshares,bitshares) %config %{_sysconfdir}/%{name}/
%if 0%{?suse_version} > 0
%config %{_sysconfdir}/apparmor.d/usr.sbin.%{name}_witness_node
%endif
%{_unitdir}/%{name}_full_node.service
%{_sbindir}/rc%{name}_full_node

%changelog