File minidlna.spec of Package minidlna
#
# spec file for package minidlna
#
# Copyright (c) 2023 SUSE LLC
#
# 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
Summary: DLNA server software
License: BSD-2-Clause AND GPL-2.0-only
Group: Productivity/Multimedia/Other
Version: 1.3.3
Release: 0
URL: http://%{name}.sourceforge.net/
Source0: %{name}-%{version}.tar.xz
Source1: %{name}config
Source2: %{name}.sysconfig
Source3: %{name}.logrotate
Source4: %{name}.service
Source5: %{name}.template
Source6: README.SUSE
Patch0: %{name}-configure.patch
Patch1: 0001-libav.h-fix-build-with-ffmpeg-7.0.patch
BuildRequires: automake
BuildRequires: fdupes
BuildRequires: flac-devel
%if 0%{?suse_version} && 0%{?is_opensuse} && ( 0%{?suse_version} >= 1500 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} && 0%{?sle_version} >= 120300 ) )
BuildRequires: libavformat-devel >= 4.0
%else
BuildRequires: libavformat-devel < 4.0
%endif
BuildRequires: libexif-devel
BuildRequires: libid3tag-devel
BuildRequires: libjpeg-devel
BuildRequires: libvorbis-devel
BuildRequires: sqlite-devel
BuildRequires: zlib-devel
Requires: /bin/ifconfig
Requires: /usr/bin/egrep
Requires: /usr/bin/sed
Requires: logrotate
Requires: util-linux
Requires(post): %{fillup_prereq}
%if ! %{defined systemd_ordering}
%{?systemd_requires}
%else
%{?systemd_ordering}
%endif
%if ! %{defined _fillupdir}
%define _fillupdir %{_localstatedir}/adm/fillup-templates
%endif
# set binary names
%define daemon_name %{name}d
%define config_name %{name}config
# example sysconfig
%define instance_config server1
%description
The MiniDLNA daemon is an UPnP-A/V and DLNA service which serves multimedia content to compatible clients on the network.
%prep
%setup -q
%patch -P 0
%if 0%{?suse_version} > 1500
%patch -P 1 -p 1
%endif
%{__cp} -a %{S:6} .
# compress man pages
%{__gzip} %{name}.conf.5
%{__gzip} %{daemon_name}.8
%build
./autogen.sh
%configure --docdir=%{_defaultdocdir}/%{name} --with-os-name=%{_target_os} --with-os-version=%{_target_vendor} --enable-silent-rules --disable-static
%{__make} %{?_smp_mflags}
%{__strip} -s %{daemon_name}
%install
%make_install
# install daemon supplementary files
%{__install} -D -m 0755 -p %{S:1} %{buildroot}%{_sbindir}/%{config_name}
%{__install} -D -m 0644 -p %{S:2} %{buildroot}%{_fillupdir}/sysconfig.%{name}
%{__install} -D -m 0644 -p %{S:2} %{buildroot}%{_fillupdir}/sysconfig.%{instance_config}-%{name}
%{__install} -D -m 0644 -p %{S:3} %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
%{__install} -D -m 0644 -p %{S:4} %{buildroot}%{_unitdir}/%{name}.service
%{__install} -D -m 0644 -p %{S:5} %{buildroot}%{_unitdir}/%{name}@.service
%{__install} -d -m 0755 %{buildroot}%{_sysconfdir}/sysconfig/%{name}
%{__install} -d -m 0755 %{buildroot}%{_localstatedir}/cache/%{name}
%{__install} -d -m 0755 %{buildroot}%{_localstatedir}/lib/%{name}
%{__install} -d -m 0755 %{buildroot}%{_localstatedir}/log/%{name}
%{__ln_s} %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
%fdupes %{buildroot}%{_fillupdir}
# install man pages
%{__install} -D -m 0644 -p %{name}.conf.5%{?ext_man} %{buildroot}%{_mandir}/man5/%{name}.conf.5%{?ext_man}
%{__install} -D -m 0644 -p %{daemon_name}.8%{?ext_man} %{buildroot}%{_mandir}/man8/%{daemon_name}.8%{?ext_man}
# mark language dependend files
%find_lang %{name}
%check
%pre
%service_add_pre %{name}.service
%service_add_pre %{name}@.service
%post
%fillup_only %{name}
%fillup_only -dns %{instance_config} %{name} %{name}.d
%service_add_post %{name}.service
%service_add_post %{name}@.service
%preun
%service_del_preun %{name}.service
%service_del_preun %{name}@.service
%postun
%service_del_postun %{name}.service
%service_del_postun %{name}@.service
%files -f %{name}.lang
%defattr(-,root,root)
%attr(755,root,root) %{_sbindir}/%{config_name}
%attr(755,root,root) %{_sbindir}/%{daemon_name}
%{_sbindir}/rc%{name}
%{_unitdir}/%{name}.service
%{_unitdir}/%{name}@.service
%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
%{_fillupdir}/sysconfig.%{name}
%{_fillupdir}/sysconfig.%{instance_config}-%{name}
%dir %{_localstatedir}/cache/%{name}
%dir %{_localstatedir}/lib/%{name}
%dir %{_localstatedir}/log/%{name}
%{_mandir}/man5/%{name}.conf.5%{?ext_man}
%{_mandir}/man8/%{daemon_name}.8%{?ext_man}
%doc AUTHORS NEWS README README.SUSE TODO
%license COPYING LICENCE.miniupnpd
%changelog