File ain.spec of Package ain
#
# spec file for package ain
#
# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 soversion 0
%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
%global username defid
%global groupname defid
Name: ain
Version: 1.0.2
Release: 0
Summary: DeFiChain daemon and client
License: MIT
Group: Development/Tools/Other
URL: https://defichain.io
Source: %{name}-%{version}.tar.xz
Source1: defid.service
Source2: defi.conf
Patch1: factory-fix-compile.patch
BuildRequires: c++_compiler
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: db-devel
BuildRequires: libtool
BuildRequires: libevent-devel
BuildRequires: libboost_filesystem-devel
BuildRequires: libboost_system-devel
BuildRequires: libboost_test-devel
BuildRequires: libboost_thread-devel
BuildRequires: openssl-devel
# optional:
BuildRequires: libminiupnpc-devel
BuildRequires: czmq-devel
%description
DeFi Blockchain tooling. The daemon can get configured via /etc/defi/defi.conf
%package devel
Summary: DeFiChain development files
%description devel
Static libs and header files
%package -n libdeficonsensus%soversion
Summary: DeFiChain dynamic lib
%description -n libdeficonsensus%soversion
%prep
%setup -q
%patch1 -p1
%build
bash autogen.sh
%configure \
%ifnarch x86_64 aarch64
--disable-asm
%endif
make %{?jobs:-j%jobs}
%install
%make_install
mkdir -p %buildroot/etc/systemd/system
mkdir -p %buildroot/etc/defi
install -m 0644 %{S:1} %buildroot/etc/systemd/system/defid.service
install -m 0644 %{S:2} %buildroot/etc/defi/defi.conf
%check
export LC_ALL=C.UTF-8
make check
%post -n libdeficonsensus%soversion -p /sbin/ldconfig
%postun -n libdeficonsensus%soversion -p /sbin/ldconfig
%pre
getent group %{groupname} >/dev/null || groupadd -r %{groupname}
getent passwd %{username} >/dev/null || \
useradd -r -g %{groupname} -d /var/lib/empty -s /sbin/nologin \
-c '%{name} User' %{username}
%service_add_pre defid.service
%preun
%service_del_preun defid.service
%post
%service_add_post defid.service
%postun
%service_del_postun defid.service
%files
%dir /etc/defi
%dir /etc/systemd
%dir /etc/systemd/system
%_bindir/defid
%_bindir/defi-cli
%_bindir/defi-tx
%_bindir/defi-wallet
%_mandir/man*/defid.1*
%_mandir/man*/defi-cli.1*
%_mandir/man*/defi-tx.1*
%_mandir/man*/defi-wallet.1*
%_prefix/share/bash-completion/completions/defi-cli.bash-completion
%_prefix/share/bash-completion/completions/defi-tx.bash-completion
%_prefix/share/bash-completion/completions/defid.bash-completion
%_prefix/share/defi
%_prefix/share/defi/examples
%_prefix/share/defi/examples/default.conf
%_prefix/share/defi/examples/pruned.conf
%_prefix/share/defi/rpcauth
%_prefix/share/defi/rpcauth/rpcauth.py
%_prefix/share/defi/rpcauth/README.md
%_prefix/share/defi/service
%_prefix/share/defi/service/defid.conf
%_prefix/share/defi/service/defid.init
%_prefix/share/defi/service/defid.openrc
%_prefix/share/defi/service/defid.openrcconf
%_prefix/share/defi/service/defid.service
/etc/systemd/system/defid.service
%attr(0640,root,%{groupname}) %config(noreplace) /etc/defi/defi.conf
%files -n libdeficonsensus%soversion
%_libdir/libdeficonsensus.so.%soversion
%_libdir/libdeficonsensus.so.%soversion.*
%files devel
%_libdir/libdeficonsensus.so
%_libdir/libdeficonsensus.la
%_libdir/libdeficonsensus.a
%_libdir/pkgconfig/libdeficonsensus.pc
%_includedir
%_bindir/test_defi
%_bindir/bench_defi