File bitcoin.spec of Package bitcoin

#
# spec file for package bitcoin
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2011-2014  P Rusnak <prusnak@opensuse.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 http://bugs.opensuse.org/
#


Name:           bitcoin
Version:        0.11.0
Release:        0
Summary:        P2P Digital Currency
License:        MIT
Group:          Productivity/Networking/Other
Url:            http://www.bitcoin.org
Source:         https://github.com/%{name}/%{name}/archive/v%{version}.tar.gz
Source1:        bitcoind.service
Source2:        bitcoind.firewall
Source3:        bitcoind.conf
# PATCH-FIX-OPENSUSE bitcoin-fix-desktop-icon-name.patch prusnak@opensuse.org -- Rename icon in desktop file to remove size reference.
Patch0:         bitcoin-fix-desktop-icon-name.patch
Patch1:         bitcoin_missing_ppc64le_in_ax_boost_base.m4.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  boost-devel
BuildRequires:  gcc-c++
BuildRequires:  git
BuildRequires:  lcov
BuildRequires:  libdb-4_8-devel
BuildRequires:  libminiupnpc-devel
BuildRequires:  libqt5-qtbase-devel
BuildRequires:  libqt5-qttools-devel
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRequires:  python
BuildRequires:  systemd-rpm-macros
BuildRequires:  update-desktop-files
BuildRequires:  yasm-devel
BuildRequires:  pkgconfig(libqrencode)
BuildRequires:  pkgconfig(openssl)
BuildRequires:  pkgconfig(protobuf)
Requires(post): update-desktop-files
Requires(postun): update-desktop-files
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}

%description
Bitcoin is a free open source peer-to-peer electronic cash system that is completely decentralized, without the need for a central server or trusted parties. Users hold the crypto keys to their own money and transact directly with each other, with the help of a P2P network to check for double-spending.

Full transaction history is stored locally at each client. This requires several GB of space, slowly growing.

%package qt5
Summary:        An end-user Qt5 GUI for the Bitcoin crypto-currency
Group:          Development/Libraries/Other
Provides:       %{name} = %{version}
Obsoletes:      %{name} < %{version}

%description qt5
Bitcoin is a free open source peer-to-peer electronic cash system that is completely decentralized, without the need for a central server or trusted parties. Users hold the crypto keys to their own money and transact directly with each other, with the help of a P2P network to check for double-spending.

Full transaction history is stored locally at each client. This requires several GB of space, slowly growing.

This package provides Bitcoin-Qt, a GUI for Bitcoin based on Qt.

%package utils
Summary:        An end-user cli for the Bitcoin crypto-currency
Group:          Productivity/Networking/Other
Provides:       %{name}-cli = %{version}
Obsoletes:      %{name}-cli < %{version}

%description utils
Bitcoin is a free open source peer-to-peer electronic cash system that is completely decentralized, without the need for a central server or trusted parties. Users hold the crypto keys to their own money and transact directly with each other, with the help of a P2P network to check for double-spending.

Full transaction history is stored locally at each client. This requires several GB of space, slowly growing.

This package provides bitcoin-cli - CLI tool to interact with the daemon.

%package -n lib%{name}consensus0
Summary:        Bitcoin consensus library
Group:          System/Library

%description -n lib%{name}consensus0
The purpose of this library is to make the verification functionality that is critical to Bitcoin’s consensus available to other applications, e.g. to language bindings such as python-bitcoinlib or alternative node implementations.

%package -n lib%{name}consensus-devel
Summary:        Developmont files for bitcoin consensus library
Group:          Development/Languages/C and C++
Requires:       lib%{name}consensus0 = %{version}

%description -n lib%{name}consensus-devel
The purpose of this library is to make the verification functionality that is critical to Bitcoin’s consensus available to other applications, e.g. to language bindings such as python-bitcoinlib or alternative node implementations.

This package contains development files.

%package -n bitcoind
Summary:        Headless daemon for Bitcoin crypto-currency
Group:          Development/Libraries/Other
Requires(pre):  shadow

%description -n bitcoind
Bitcoin is a free open source peer-to-peer electronic cash system that is completely decentralized, without the need for a central server or trusted parties. Users hold the crypto keys to their own money and transact directly with each other, with the help of a P2P network to check for double-spending.

Full transaction history is stored locally at each client. This requires several GB of space, slowly growing.

This package provides bitcoind, headless bitcoin daemon.

%package test
Summary:        Automated tests for bitcoin client
Group:          Development/Libraries/Other

%description test
Bitcoin is a free open source peer-to-peer electronic cash system that is completely decentralized, without the need for a central server or trusted parties. Users hold the crypto keys to their own money and transact directly with each other, with the help of a P2P network to check for double-spending.

Full transaction history is stored locally at each client. This requires several GB of space, slowly growing.

This package provides automated tests for bitcoin-qt5 and bitcoind.

%prep
%setup -q
%patch0 -p1
%patch1 -p1

%build
autoreconf -fiv
export CXXFLAGS="$CXXFLAGS %{optflags} -fPIC"
export CFLAGS="$CFLAGS %{optflags} -fPIC"
%configure \
	--with-cli=yes \
	--with-daemon=yes \
	--with-gui=qt5 \
	--with-miniupnpc \
	--with-qrencode \
  --disable-hardening

make %{?_smp_mflags} V=1

%check
make %{?_smp_mflags} check

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}

install -D -m 0644 share/pixmaps/bitcoin256.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
install -D -m 0644 contrib/debian/bitcoin-qt.desktop %{buildroot}%{_datadir}/applications/%{name}-qt.desktop
%suse_update_desktop_file %{buildroot}%{_datadir}/applications/%{name}-qt.desktop
install -D -m 0644 contrib/debian/manpages/bitcoind.1 %{buildroot}%{_mandir}/man1/bitcoind.1
install -D -m 0644 contrib/debian/manpages/bitcoin-qt.1 %{buildroot}%{_mandir}/man1/bitcoin-qt.1
install -D -m 0644 contrib/debian/manpages/bitcoin.conf.5 %{buildroot}%{_mandir}/man5/bitcoin.conf.5
install -D -m 0644 contrib/debian/examples/bitcoin.conf  %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
mkdir -p %{buildroot}/%{_localstatedir}/lib/%{name}
install -d %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/bitcoind
mkdir %{buildroot}%{_sbindir}
ln -sv %{_sbindir}/service %{buildroot}%{_sbindir}/rcbitcoind
install -D -m 0644 $RPM_SOURCE_DIR/bitcoind.service %{buildroot}/%{_unitdir}/bitcoind.service
install -d -m 0755 %{buildroot}/%{_tmpfilesdir}/
install -m 0644 %{SOURCE3} %{buildroot}/%{_tmpfilesdir}/bitcoind.conf

# do not ship these
rm -rf %{buildroot}%{_libdir}/libbitcoinconsensus.a
rm -rf %{buildroot}%{_libdir}/libbitcoinconsensus.la

%post qt5
%desktop_database_post

%postun qt5
%desktop_database_postun

%pre -n bitcoind
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 "Bitcoin daemon" %{name}
%service_add_pre bitcoind.service

%post -n bitcoind
%service_add_post bitcoind.service
%if 0%{?suse_version} <= 1320
systemd-tmpfiles --create %{_tmpfilesdir}/bitcoind.conf >/dev/null 2>&1 || :
%else
%tmpfiles_create %{_tmpfilesdir}/bitcoind.conf
%endif

%preun -n bitcoind
%service_del_preun bitcoind.service

%postun -n bitcoind
%service_del_postun bitcoind.service

%post -n lib%{name}consensus0 -p /sbin/ldconfig

%postun -n lib%{name}consensus0  -p /sbin/ldconfig

%files qt5
%defattr(-,root,root)
%doc COPYING README.md
%{_bindir}/bitcoin-qt
%{_datadir}/applications/%{name}-qt.desktop
%{_mandir}/man1/bitcoin-qt.1%{?ext_man}
%{_datadir}/pixmaps/%{name}.png

%files utils
%defattr(-,root,root)
%doc COPYING README.md
%{_bindir}/%{name}-cli
%{_bindir}/%{name}-tx

%files -n lib%{name}consensus0
%defattr(-,root,root)
%doc COPYING README.md
%{_libdir}/lib%{name}consensus.so.*

%files -n lib%{name}consensus-devel
%defattr(-,root,root)
%doc COPYING README.md
%{_libdir}/lib%{name}consensus.so
%{_includedir}/%{name}consensus.h
%{_libdir}/pkgconfig/lib%{name}consensus.pc

%files -n bitcoind
%defattr(-,root,root)
%doc COPYING README.md
%{_mandir}/man1/bitcoind.1%{?ext_man}
%{_mandir}/man5/%{name}.conf.5%{?ext_man}
%{_bindir}/bitcoind
%dir %attr(700,%{name},%{name}) %{_var}/lib/%{name}
%dir %{_sysconfdir}/%{name}
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/bitcoind
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%{_unitdir}/bitcoind.service
%{_sbindir}/rcbitcoind
%{_tmpfilesdir}/bitcoind.conf

%files test
%defattr(-,root,root)
%doc COPYING README.md
%{_bindir}/test_bitcoin
%{_bindir}/test_bitcoin-qt

%changelog
openSUSE Build Service is sponsored by