File coturn.spec of Package coturn

#
# spec file for package coturn
#
# Copyright (c) 2018 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/
#


Name:           coturn
Version:        4.5.0.8
Release:        0
Summary:        Coturn TURN Server
License:        BSD-3-Clause
Group:          Productivity/Networking/Talk/Servers
URL:            https://github.com/coturn/coturn/
Source0:        https://github.com/coturn/coturn/archive/%{version}.tar.gz
Source1:        coturn.service
BuildRequires:  fdupes
BuildRequires:  hiredis-devel
BuildRequires:  libevent-devel
BuildRequires:  libopenssl-devel
BuildRequires:  openssl
BuildRequires:  systemd

%description
The TURN Server is a VoIP media traffic NAT traversal server and gateway. It
can be used as a general-purpose network traffic TURN server/gateway, too.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/Other
Requires:       %{name} = %{version}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%prep
%setup -q

%build
%configure \
    --datadir=%{_datadir}/coturn \
    --sysconfdir=%{_sysconfdir}/coturn \
    --docdir=%{_docdir}/coturn \
    --examplesdir=%{_datadir}/coturn/examples \
    --mandir=%{_datadir} \
    --disable-rpath
make %{?_smp_mflags}

%install
%make_install
mkdir -p %{buildroot}%{_unitdir}
install -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/
%fdupes -s %{buildroot}/%{_mandir}
%fdupes %{buildroot}/%{_prefix}
find %{buildroot}%{_datadir} -type f -exec chmod a-x \{\} \+
find %{buildroot}%{_datadir} -name '*.sh' -type f -exec chmod a+x \{\} \+
find %{buildroot}%{_datadir} -name '*.pl' -type f -exec chmod a+x \{\} \+
rm -f %{buildroot}%{_datadir}/coturn/examples%{_sysconfdir}/*.pem \
%{buildroot}%{_docdir}/coturn/INSTALL
chmod 0755 %{buildroot}/%{_bindir}/*
mkdir -p %{buildroot}%{_sbindir}
ln -sf service %{buildroot}%{_sbindir}/rccoturn

%pre
%service_add_pre coturn.service
getent group coturn >/dev/null 2>&1 || groupadd -r coturn
getent passwd coturn >/dev/null 2>&1 || useradd -r -g coturn -c "coturn TURN/STUN server" coturn -s /sbin/nologin

%post
%service_add_post coturn.service
%{fillup_only coturn}

%preun
%service_del_preun coturn.service

%postun
%service_del_postun coturn.service

%files
%dir %{_sysconfdir}/coturn
%config %attr(644,root,root) %{_sysconfdir}/coturn/*
%{_bindir}/turnadmin
%{_bindir}/turnserver
%{_bindir}/turnutils_peer
%{_bindir}/turnutils_stunclient
%{_bindir}/turnutils_uclient
%{_bindir}/turnutils_natdiscovery
%{_bindir}/turnutils_oauth
%{_mandir}/man1/*
%dir %{_docdir}/coturn
%{_docdir}/coturn/*
%{_datadir}/coturn
%{_unitdir}/coturn.service
%{_sbindir}/rccoturn

%files devel
%dir %{_includedir}/turn
%attr(0644,root,root) %{_includedir}/turn/*.h
%dir %{_includedir}/turn/client
%attr(0644,root,root) %{_includedir}/turn/client/*.h
%attr(0644,root,root) %{_libdir}/*.a

%changelog
openSUSE Build Service is sponsored by