File janus-gateway.spec of Package janus-gateway

#
# spec file for janus-gateway
#
# 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/
#

%if 0%{?suse_version} > 1230
%bcond_without systemd
%else
%bcond_with    systemd
%endif

%if 0%{?suse_version} > 1320
%bcond_without janus_postprocessing
%endif

Name:           janus-gateway
Version:        0.10.8
Release:        0
License:        GPL-3.0
Summary:        Janus WebRTC Gateway
Url:            https://github.com/meetecho/janus-gateway
Group:          Productivity/Networking/Other
Source:         %{name}-%{version}.tar.xz
Source1:        janus.service
Source2:        config-files-warning.txt
# for run autogen.sh
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
# basic dependencies
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(libmicrohttpd)
BuildRequires:  pkgconfig(ini_config)
BuildRequires:  pkgconfig(jansson)
BuildRequires:  pkgconfig(nice)
BuildRequires:  pkgconfig(libsrtp) >= 1.4.5
BuildRequires:  pkgconfig(openssl) >= 1.0.1e
BuildRequires:  pkgconfig(lua)
BuildRequires:  sofia-sip-devel
BuildRequires:  gengetopt
BuildRequires:  pkgconfig(ogg)
BuildRequires:  pkgconfig(opus)
BuildRequires:  curl-devel
BuildRequires:  libconfig-devel
%if %{with janus_postprocessing}
BuildRequires:  libavformat-devel
BuildRequires:  libavcodec-devel
BuildRequires:  libavutil-devel
%endif
# data channel support
BuildRequires:  usrsctp-devel
# websockets support
BuildRequires:  libwebsockets-devel >= 4.0.0
# MQTT support
BuildRequires:  libpaho-mqtt-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         /usr/sbin/useradd /usr/sbin/groupadd
%if %{with systemd}
BuildRequires:  pkgconfig(systemd)
%{?systemd_requires}
%else
PreReq:        %{insserv_prereq} %{fillup_prereq}
%endif

%define user_name janus
%define home      /var/lib/janus/
%description
Janus is an open source, general purpose, WebRTC gateway designed and developed
by Meetecho. This version of the gateway can only be installed on Linux systems:
next versions will take into account cross compilation on different environments.

%package devel
Requires:       %{name} = %{version}
Summary:        Development files for Janus Gateway plugins
Group:          Development/Libraries/C and C++
%description devel
Janus is an open source, general purpose, WebRTC gateway designed and developed
by Meetecho. This version of the gateway can only be installed on Linux systems:
next versions will take into account cross compilation on different environments.

This package holds the file needed to compile plugins for Janus Gateway.

%prep
%setup -q

%build
./autogen.sh
%configure --disable-silent-rules \
        --disable-static \
        --with-pic \
        %if %{with janus_postprocessing}
        --enable-post-processing \
        %endif
        --disable-rabbitmq \
        --disable-docs
make

%install
make install DESTDIR=%{buildroot}
rm -f %{buildroot}%{_libdir}/janus/plugins/*.la
make configs DESTDIR=%{buildroot}
#
%if %{with systemd}
install -D -d -m 755 %{buildroot}%{_sbindir}
install -D -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/janus.service
ln -sf %{_sbindir}/service %{buildroot}%{_sbindir}/rcjanus
%endif
#
pushd %{buildroot}%{_sysconfdir}/janus/
rm -rv *.jcfg.sample
chmod -R o= .
popd
rm -rv %{buildroot}%{_datadir}/doc/%{name}
#
install -D %{SOURCE2} %{buildroot}/var/adm/update-messages/%{name}-%{version}-%{release}-config-files-warning.txt
#
install -D -d -m 0750 %{buildroot}%{home}

%pre
/usr/sbin/groupadd -r %{user_name} >/dev/null 2>&1 || :
/usr/sbin/useradd -g %{user_name} -s /bin/false -r -c "Janus Gateway" -d %{home} %{user_name} >/dev/null 2>&1 || :
%if %{with systemd}
%service_add_pre janus.service

%post
%service_add_post janus.service
if [ "$FIRST_ARG" -eq 1 -a ! -e /etc/janus/cert.pem ]; then
	echo "make sure to generate /etc/janus/cert.pem for janus to work"
fi

%preun
%service_del_preun janus.service

%postun
%service_del_postun janus.service
%endif

%files
%defattr(-,root,root)
%doc README.md COPYING
%config(noreplace) %attr(-,root,%{user_name}) %{_sysconfdir}/janus/
%{_sbindir}/rcjanus
%{_bindir}/janus
%{_bindir}/janus-cfgconv
%{_mandir}/man1/janus.1*
%{_mandir}/man1/janus-cfgconv.1*
%if %{with janus_postprocessing}
%{_bindir}/janus-pp-rec
%{_bindir}/mjr2pcap
%{_mandir}/man1/janus-pp-rec.1*
%{_mandir}/man1/mjr2pcap.1*
%endif
%{_libdir}/janus/
%{_datadir}/janus/
%if %{with systemd}
%{_unitdir}/janus.service
%endif
/var/adm/update-messages/%{name}-%{version}-%{release}-config-files-warning.txt
%dir %attr(750,%{user_name},%{user_name}) %{home}

%files devel
%defattr(-,root,root)
%{_includedir}/janus/

%changelog
openSUSE Build Service is sponsored by