File minidlna.spec of Package minidlna

#
# spec file for package minidlna
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2012 by Lars Vogdt <lars@linux-schulserver.de>
#
# 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:           minidlna
Version:        1.3.3
%define oversion 1.3.3
Release:        0
Summary:        DLNA compatible server
License:        GPL-2.0-or-later
Group:          Productivity/Multimedia/Other
URL:            https://sourceforge.net/projects/minidlna/
Source0:        https://prdownloads.sourceforge.net/minidlna/%{name}-%{oversion}.tar.gz
# Systemd unit file
Source1:        %{name}.service
# tmpfiles configuration for the /run directory
Source2:        %{name}-tmpfiles.conf
# logrotate configuration
Source3:        minidlna_logrotate
# systemd-sysusers user configuration
Source4:        %{name}-user.conf
# VDR FIX thanks to Boris from openSuse
Patch1:         minidlna-vdr.diff
Patch2:         01-run-instead-of-var-run.patch
Patch3:         07-fix-multi-artist-album-handling.patch
Patch4:         08-Fix-testupnpdescgen-build.patch
Patch5:         10-do-not-close-socket-on-sighup.patch
Patch6:         13-spelling-and-typos.patch
Patch7:         15-thumbnails.patch
Patch8:         16-Add-compatibility-with-FFMPEG-7.0.patch
BuildRequires:  automake
BuildRequires:  flac-devel
BuildRequires:  libexif-devel
BuildRequires:  libid3tag-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libvorbis-devel
BuildRequires:  sqlite-devel
BuildRequires:  sysuser-shadow
BuildRequires:  sysuser-tools
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(libavcodec)
BuildRequires:  pkgconfig(libavformat)
BuildRequires:  pkgconfig(libavutil)
BuildRequires:  pkgconfig(libffmpegthumbnailer)
Recommends:     logrotate
Provides:       ReadyMedia = %{version}
%sysusers_requires

%description
MiniDLNA (aka ReadyDLNA) is server software with the aim of being fully
compliant with DLNA/UPnP-AV clients.

%prep
%setup -q -n %{name}-%{oversion}
%autopatch -p1

%build
./autogen.sh

# Edit the default config file
sed -i 's/#log_dir=\/var\/log/#log_dir=\/var\/log\/minidlna/' \
  %{name}.conf

CFLAGS="%{optflags} -I/usr/include/ffmpeg"
%configure \
  --with-db-path=%{_localstatedir}/cache/%{name} \
  --with-log-path=%{_localstatedir}/log/%{name} \
  --enable-thumbnail \
  --enable-tivo

make %{?_smp_mflags}
%sysusers_generate_pre %{SOURCE4} minidlna

%install
%make_install
# install service file
install -D -m0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{name}.service
# install tmpfiles configuration
install -D -m0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/%{name}.conf
#
install -d %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
# install logrotate file
install -D -m0644 %{SOURCE3} %{buildroot}/%{_sysconfdir}/logrotate.d/%{name}
# install cache directory
install -d -m0700 %{buildroot}%{_var}/cache/%{name}
# install log directory
install -d -m0700 %{buildroot}%{_var}/log/%{name}
# install manpages
install  -D -m0644 minidlna.conf.5 %{buildroot}/%{_mandir}/man5/minidlna.conf.5
install  -D -m0644 minidlnad.8 %{buildroot}/%{_mandir}/man8/minidlnad.8
# install example config
install  -D -m0644 minidlna.conf %{buildroot}/%{_sysconfdir}/minidlna.conf
# install sysusers config
install -D -m0644 %{SOURCE4} %{buildroot}%{_sysusersdir}/minidlna.conf

# find language dependent files
%find_lang minidlna

%pre -f minidlna.pre
%service_add_pre minidlna.service

%preun
%service_del_preun minidlna.service

%post
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%service_add_post minidlna.service

%postun
%service_del_postun minidlna.service

%files -f minidlna.lang
%license LICENCE* COPYING
%doc NEWS README TODO
%attr(-,minidlna,minidlna) %config(noreplace) %{_sysconfdir}/%{name}.conf
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_mandir}/man5/*
%{_mandir}/man8/*
%{_sbindir}/*
%{_sysusersdir}/%{name}.conf
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/%{name}.service
%attr(0700,minidlna,minidlna) %{_var}/cache/%{name}
%attr(0700,minidlna,minidlna) %{_var}/log/%{name}

%changelog
openSUSE Build Service is sponsored by