File spectrum2.spec of Package spectrum2

#
# spec file for package spectrum2
#
# 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/
#


Name:           spectrum2
Version:        2.2.1
Release:        0
Summary:        XMPP Transports
License:        GPL-3.0+
Group:          Productivity/Networking/Instant Messenger
Url:            http://www.spectrum.im
Source:         https://github.com/SpectrumIM/spectrum2/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        %{name}.service
BuildRequires:  avahi-devel
BuildRequires:  boost-devel
BuildRequires:  libboost_regex-devel
BuildRequires:  libboost_system-devel
BuildRequires:  libboost_thread-devel
# FIXME: report to upstream
BuildRequires:  libboost_serialization-devel
BuildRequires:  libboost_signals-devel
BuildRequires:  libboost_locale-devel
BuildRequires:  libboost_program_options-devel
BuildRequires:  libboost_date_time-devel
BuildRequires:  libboost_filesystem-devel
BuildRequires:  libcommuni-devel
BuildRequires:  cmake
BuildRequires:  libcurl-devel
# BuildRequires:  libev-devel
BuildRequires:  libidn-devel
BuildRequires:  libminiupnpc-devel
BuildRequires:  liblog4cxx-devel
BuildRequires:  libpurple-devel
# FIXME: report to upstream
BuildRequires:  gconf2-devel
%if %suse_version == 1330
BuildRequires:  libXss-devel
%endif
BuildRequires:  mysql-devel
BuildRequires:  openssl-devel
BuildRequires:  popt-devel
# BuildRequires:  protobuf-c
BuildRequires:  protobuf21-devel
BuildRequires:  swiften-devel
BuildRequires:  systemd
BuildRequires:  unzip
BuildRequires:  gcc10 gcc10-c++
Buildrequires:  pkgconfig(jsoncpp)
# BuildRequires:  pkgconfig(sqlite3)
# BuildRequires:  pkgconfig(libpqxx)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}

%description
Spectrum is an XMPP transport/gateway. It allows XMPP users to communicate
with their friends who are using one of the supported networks.
It supports a wide range of different networks such as ICQ, XMPP (Jabber, GTalk),
AIM, MSN, Facebook, Twitter, Gadu-Gadu, IRC and SIMPLE.
Spectrum is written in C++ and uses the Gloox XMPP library and libpurple for legacy networks.
Spectrum is open source and released under the GNU GPL.

%package devel
Summary:        XMPP Transports devel files
Group:          Development/Languages/C and C++
Requires:       %{name}

%description devel
Spectrum is an XMPP transport/gateway. It allows XMPP users to communicate
with their friends who are using one of the supported networks.
It supports a wide range of different networks such as ICQ, XMPP (Jabber, GTalk),
AIM, MSN, Facebook, Twitter, Gadu-Gadu, IRC and SIMPLE.
Spectrum is written in C++ and uses the Gloox XMPP library and libpurple for legacy networks.
Spectrum is open source and released under the GNU GPL.

%prep
%setup -q

%build
# FIXME: you should use %%cmake macros
cmake -DCMAKE_INSTALL_PREFIX=/ \
      -DLIB_INSTALL_DIR=%{_libdir} \
      -DENABLE_SWIFTEN=ON \
      -DENABLE_QT=OFF \
      -DIRC_INCLUDE_DIR=%{_libqt5_includedir}/Communi/ \
      -DCMAKE_INSTALL_LIBEXECDIR=%{_bindir} \
      -DCMAKE_INSTALL_SYSCONFDIR=%{_sysconfdir}

make %{?_smp_mflags}

%install
make %{?_smp_mflags} DESTDIR=%{buildroot} install
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}
cat > %{buildroot}%{_sbindir}/rc%{name} << EOF
#!/bin/bash
systemctl \$1 %{name} && echo "Request send via systemctl"
EOF

%pre
%{_sbindir}/useradd --system --gid jabber --comment "Jabber Server" \
    --home %{_localstatedir}/lib/jabberd --shell /bin/false jabber 2>/dev/null ||:
%service_add_pre %{name}.service

%post
/sbin/ldconfig
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
/sbin/ldconfig
%service_del_postun %{name}.service

%files
%defattr(-,root,root)
%attr(0755, root, root) %{_bindir}/*
%attr(0755, root, root) %{_sbindir}/*
%{_libdir}/*.so.*
%{_unitdir}/*
%{_localstatedir}/lib/spectrum2_manager
%config(noreplace) %{_sysconfdir}/spectrum2

%files devel
%defattr(-,root,root)
%{_libdir}/*.so
%{_includedir}/*

%changelog
openSUSE Build Service is sponsored by