File peerunity.spec of Package peerunity

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


%global qt4_version qt
%global qt5_version qt5
%define qt_version %{qt4_version}
%define qt_version_obsolete %{qt5_version}
%define daemon_name %{name}d
%define display_name Peerunity
%define gui_name %{name}-qt
%define description_text Peerunity is a PeerCoin network-compatible, community-developed wallet client.
#
# it looks like the Fedora 23 repository has some differences to the rest
# of the repositories I am building against
#
%if 0%{?fedora} || 0%{?centos_version}
%global debug_package %{nil}
%endif
Name:           peerunity
Version:        0.2.2
Release:        0
Summary:        Peercoin wallet client
License:        MIT
Group:          Productivity/Networking/Other
Url:            https://github.com/%{name}/%{name}/
Source0:        %{name}-%{version}.tar.gz
Patch0:         gcc6.patch
BuildRequires:  boost-devel
BuildRequires:  libqt4-devel
BuildRequires:  openssl-devel
BuildRequires:  qrencode-devel
# ExcludeArch:    aarch64
%if 0%{?fedora} || 0%{?centos_version}
BuildRequires:  libdb-devel
BuildRequires:  libdb4-cxx-devel
BuildRequires:  miniupnpc-devel
BuildRequires:  qt-devel
%else
BuildRequires:  libdb-4_8-devel
BuildRequires:  libminiupnpc-devel
BuildRequires:  update-desktop-files
%endif

%description

%package %{qt_version}
Summary:        GUI for %{display_name}
Group:          Productivity/Networking/Other
Obsoletes:      %{name}-%{qt_version_obsolete}

%description %{qt_version}
%{description_text}

This package provides %{display_name}-Qt, a GUI for %{display_name} based on Qt.

%package -n %{daemon_name}
Summary:        Headless daemon for %{name}
Group:          Productivity/Networking/Other

%description -n %{daemon_name}
%{description_text}

This package provides %{daemon_name}, a headless %{name} daemon.

%prep
%setup -q

%patch0 -p1

%build

%if 0%{?fedora} || 0%{?centos_version}
alias qmake="%{_bindir}/qmake-qt4"
%endif

qmake USE_QRCODE=1 USE_DBUS=1 BDB_LIB_PATH=%{_libdir}/libdb4/ BDB_INCLUDE_PATH=%{_includedir}/libdb4
#%if 0%{?fedora} || 0%{?centos_version}
#%endif
make %{?_smp_mflags}
mv %{name} %{gui_name}
strip -s %{gui_name}
BDB_LIB_PATH=%{_libdir}/libdb4/ BDB_INCLUDE_PATH=%{_includedir}/libdb4 make -C src  -f makefile.unix %{?_smp_mflags}
strip -s src/%{daemon_name}

%install
install -dm 0755 %{buildroot}%{_bindir}
install -m 0755 %{gui_name} %{buildroot}%{_bindir}
install -m 0755 src/%{daemon_name} %{buildroot}%{_bindir}
install -dm 0755 %{buildroot}%{_datadir}/pixmaps
install -m 0644 src/qt/res/icons/peerunity.png %{buildroot}%{_datadir}/pixmaps/%{name}.png

%if 0%{?suse_version}
%suse_update_desktop_file -c %{gui_name} %{display_name} "%{display_name} Wallet" %{gui_name} %{name} Office Finance
%endif

%post %{qt_version}
%desktop_database_post

%postun %{qt_version}
%desktop_database_postun

%files %{qt_version}
%defattr(-,root,root,-)
%attr(755,root,root) %{_bindir}/%{gui_name}
%{_datadir}/pixmaps/%{name}.png
%if 0%{?suse_version}
%{_datadir}/applications/%{gui_name}.desktop
%endif
%doc README.md

%files -n %{daemon_name}
%defattr(-,root,root,-)
%attr(755,root,root) %{_bindir}/%{daemon_name}
%doc README.md

%changelog
openSUSE Build Service is sponsored by