File gerbera.spec of Package gerbera

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

Name:           gerbera
Version:        1.3.2
Release:        0
Summary:        UPnP Media Server
License:        GPL-2.0-only
Group:          Productivity/Multimedia/Other
BuildRequires:  cmake
BuildRequires:  fdupes
BuildRequires:  file-devel
BuildRequires:  gcc-c++
BuildRequires:  gmock
BuildRequires:  gtest
BuildRequires:  hicolor-icon-theme
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(duktape)
BuildRequires:  pkgconfig(exiv2)
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavformat)
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(libcurl)
BuildRequires:  pkgconfig(libffmpegthumbnailer)
BuildRequires:  pkgconfig(libswscale)
BuildRequires:  pkgconfig(libupnp) >= 1.8.3
BuildRequires:  pkgconfig(sqlite3)
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(taglib) >= 1.11
BuildRequires:  pkgconfig(uuid)
BuildRequires:  pkgconfig(zlib)

Gerbera is a UPnP media server which allows you to stream your digital
media through your home network and consume it on a variety of UPnP
compatible devices.

%setup -q

# server test hardcodes alpha strings
sed -i -e '/test_server/d' test/CMakeLists.txt

cp %{SOURCE1}

for _file in %{SOURCE3} %{SOURCE4}; do
  sed -e 's/@USER@/gerbera/' \
      -e 's/@GROUP@/gerbera/' \
      < $_file > ${_file##*/}

%cmake \
    -DWITH_CURL=1 \
    -DWITH_JS=1 \
    -DWITH_MAGIC=1 \
    -DWITH_MYSQL=0 \
    -DWITH_TESTS=0 \
make %{?_smp_mflags}


install -d %{buildroot}%{_sbindir}
ln -s service  %{buildroot}%{_sbindir}/rc%{name}
install -Dm 0644 %{name} %{buildroot}%{_tmpfilesdir}/%{name}.conf
install -Dm 0644 %{name} %{buildroot}%{_sysusersdir}/%{name}.conf

install -d %{buildroot}%{_localstatedir}/lib/%{name}
install -Dm 0644 %{name} %{buildroot}%{_sysconfdir}/%{name}.conf
touch %{buildroot}%{_localstatedir}/lib/%{name}/{config.xml,%{name}.db,%{name}.html}


getent group gerbera >/dev/null || groupadd -r gerbera
getent passwd gerbera >/dev/null || \
useradd -r -g gerbera -d %{_sysconfdir}/gerbera -s /sbin/nologin \
    -c "To run Gerbera" gerbera
%service_add_pre %{name}.service

%service_add_post %{name}.service
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%sysusers_create %{_sysusersdir}/%{name}.conf

%service_del_preun %{name}.service

%service_del_postun %{name}.service

%attr(0660,gerbera,gerbera) %config(noreplace) %{_sysconfdir}/%{name}.conf
%ghost %attr(-,gerbera,gerbera) %dir %{_localstatedir}/lib/%{name}
%ghost %attr(0660,gerbera,gerbera) %{_localstatedir}/lib/%{name}/config.xml
%ghost %attr(0660,gerbera,gerbera) %{_localstatedir}/lib/%{name}/%{name}.db
%ghost %attr(0660,gerbera,gerbera) %{_localstatedir}/lib/%{name}/%{name}.html