File turnserver.spec of Package TurnServer

#
# spec file for package TurnServer
#
# Copyright (c) 2014 SUSE LINUX Products 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/
#


# See also http://en.opensuse.org/openSUSE:Shared_library_packaging_policy

Name:           turnserver
Version:        0.7.3
Release:        1.0
Summary:        Open-source TURN server implementation
License:        GPL-3.0
Group:          Productivity/Telephony/SIP/Servers
Url:            http://www.turnserver.org/
Source0:        turnserver-%{version}.tar.bz2
Source1:        turnserver.service
BuildRequires:  libopenssl-devel libconfuse-devel systemd
Conflicts:      rfc5766-turn-server
BuildRoot:     %{_tmppath}/%{name}-%{version}-build

%description
TurnServer is a implementation of Traversal Using Relay around NAT (TURN) protocol. This protocol allows a client to obtain IP addresses and ports from such a relay.

%debug_package

%prep
%setup -q -n turnserver-%{version}

%build
%configure
make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot}
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/
mkdir -p %{buildroot}/etc/
install -m 0644 extra/turnserver.conf.template %{buildroot}/etc/turnserver.conf
install -m 0644 extra/turnusers.txt.template %{buildroot}/etc/turnusers.txt
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/

%pre
getent group return >/dev/null || groupadd -r return
getent passwd return >/dev/null || \
    useradd -r -g return -d / -s /sbin/nologin \
    -c "reTurn TURN server" return
%service_add_pre turnserver.service

%post
%service_add_post turnserver.service

%preun
%service_del_preun turnserver.service

%postun
%service_del_postun turnserver.service

%files
%defattr(-,root,root,-)
%config /etc/turnserver.conf
%config /etc/turnusers.txt
%{_bindir}/test_echo_server
%{_bindir}/test_turn_client
%{_sbindir}/turnserver
%{_mandir}/man1/turnserver.1.gz
%{_mandir}/man5/turnserver.conf.5.gz
%{_unitdir}/turnserver.service

%changelog