gerbera/gerbera.spec

189 lines
6.2 KiB
RPMSpec
Raw Normal View History

#
# spec file for package gerbera
#
# Copyright (c) 2017 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 http://bugs.opensuse.org/
#
%define SYS_USER gerbera
%define SYS_GROUP gerbera
%define ffmpeg_includedir %(pkg-config --variable=includedir libavcodec)
Name: gerbera
Version: 1.2.0
Release: 0
Summary: UPnP Media Server
License: GPL-2.0
Group: Productivity/Multimedia/Other
Url: https://gerbera.io
Source0: https://github.com/v00d00/gerbera/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: gerbera.conf.in
Source2: gerbera.service.in
Source3: gerbera.tmpfile.in
Source4: gerbera.sysusers.in
Patch0: FFMpegThumbnailer.patch
BuildRequires: cmake
BuildRequires: fdupes
BuildRequires: file-devel
BuildRequires: hicolor-icon-theme
BuildRequires: mysql-devel
BuildRequires: pkgconfig
BuildRequires: update-desktop-files
BuildRequires: pkgconfig(duktape)
BuildRequires: pkgconfig(expat)
BuildRequires: pkgconfig(libavcodec)
BuildRequires: pkgconfig(libavformat)
BuildRequires: pkgconfig(libavutil)
BuildRequires: pkgconfig(libffmpegthumbnailer)
BuildRequires: pkgconfig(libcurl)
BuildRequires: pkgconfig(libexif)
BuildRequires: pkgconfig(libswscale)
BuildRequires: pkgconfig(libupnp) >= 1.8.3
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(taglib) >= 1.11
BuildRequires: pkgconfig(uuid)
BuildRequires: pkgconfig(systemd)
%{?systemd_requires}
# Use a supported version of GCC
%if 0%{?leap_version} >= 420200
BuildRequires: gcc7-c++
%else
BuildRequires: gcc-c++
%endif
%description
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.
%prep
%setup -q
#%patch0 -p1
cp %{SOURCE1} gerbera.conf.in
for _file in %{SOURCE2} %{SOURCE3} %{SOURCE4}; do
sed -e 's/@USER@/%{SYS_USER}/' \
-e 's/@GROUP@/%{SYS_GROUP}/' \
< $_file > ${_file##*/}
done
sed -i 's/mediatomb\.db/%{name}.db/g' $(grep -rl mediatomb.db)
sed -i 's/mediatomb\.html/%{name}.html/g' $(grep -rl mediatomb.html)
%build
# Use %%ffmpeg_includedir (check struct or class)
export CFLAGS="%{optflags} -I%{ffmpeg_includedir}"
export CXXFLAGS="${CFLAGS}"
%cmake \
-DWITH_AVCODEC=1 \
-DWITH_CURL=1 \
-DWITH_EXIF=1 \
-DWITH_JS=1 \
-DWITH_MAGIC=1 \
-DWITH_FFMPEGTHUMBNAILER=1 \
-DWITH_MYSQL=1 \
-DWITH_TAGLIB=1 \
%if 0%{?leap_version} >= 420200
-DCMAKE_C_COMPILER=gcc-7 \
-DCMAKE_CXX_COMPILER=g++-7
%endif
make %{?_smp_mflags}
%install
%cmake_install
install -d %{buildroot}%{_sbindir}
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}
#install -Dm 0644 %{name}.service.in %{buildroot}%{_unitdir}/%{name}.service
install -Dm 0644 %{name}.tmpfile.in %{buildroot}%{_tmpfilesdir}/%{name}.conf
install -Dm 0644 %{name}.sysusers.in %{buildroot}%{_sysusersdir}/%{name}.conf
install -d %{buildroot}%{_localstatedir}/lib/%{name}
install -Dm 0644 %{name}.conf.in %{buildroot}%{_sysconfdir}/%{name}.conf
touch %{buildroot}%{_localstatedir}/lib/%{name}/{config.xml,%{name}.db,%{name}.html}
install -Dm 0644 artwork/logo-orange.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{suse_update_desktop_file -c %{name} Gerbera "UPnP Media Server" \
'%{_bindir}/x-www-%{name} %{_localstatedir}/lib/%{name}/%{name}.html' %{name} AudioVideo Audio Music}
install -d %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/x-www-%{name}
ln -s %{_sysconfdir}/alternatives/x-www-%{name} %{buildroot}%{_bindir}/x-www-%{name}
%pre
%service_add_pre %{name}.service
%post
%icon_theme_cache_post
%service_add_post %{name}.service
%tmpfiles_create %{_tmpfilesdir}/%{name}.conf
%sysusers_create %{_sysusersdir}/%{name}.conf
if [ ! -e /.buildenv ]; then
for _browser in seamonkey konqueror qupzilla newmoon firefox chromium; do
if [ -x %{_bindir}/$_browser ]; then
%{_sbindir}/update-alternatives --install %{_bindir}/x-www-%{name} \
x-www-%{name} \
%{_bindir}/$_browser $((_count = $_count + 10 ))
fi
done
fi
if [ $1 -eq 1 ] ; then
mkdir -p %{_localstatedir}/adm/update-messages
rm -f %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}
cat > %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release} << EOF
INFO: Add a user to gerbera group
INFO: Run the server: systemctl start %{name}.service
INFO: Open on browser http://192.168.100.2:49152
INFO: The app configuration file is located in %{_sysconfdir}/%{name}.conf
EOF
fi
%preun
%service_del_preun %{name}.service
%postun
%icon_theme_cache_postun
%service_del_postun %{name}.service
if [ $1 -eq 0 ]; then
if [ ! -e /.buildenv ]; then
for _browser in $(%{_sbindir}/update-alternatives --list x-www-%{name}); do
%{_sbindir}/update-alternatives --remove x-www-%{name} $_browser
done
fi
fi
%files
%defattr(-,root,root)
%doc AUTHORS CONTRIBUTING.md ChangeLog.md LICENSE.md
%{_bindir}/%{name}
%{_bindir}/x-www-%{name}
%{_datadir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.??g
%{_unitdir}/%{name}.service
%{_sbindir}/rc%{name}
%{_tmpfilesdir}/%{name}.conf
%dir %{_sysusersdir}
%{_sysusersdir}/%{name}.conf
%{_mandir}/man?/%{name}.?%{ext_info}
%attr(0660,%{SYS_USER},%{SYS_GROUP}) %config(noreplace) %{_sysconfdir}/%{name}.conf
%ghost %attr(-,%{SYS_USER},%{SYS_GROUP}) %dir %{_localstatedir}/lib/%{name}
%ghost %attr(0660,%{SYS_USER},%{SYS_GROUP}) %{_localstatedir}/lib/%{name}/config.xml
%ghost %attr(0660,%{SYS_USER},%{SYS_GROUP}) %{_localstatedir}/lib/%{name}/%{name}.db
%ghost %attr(0660,%{SYS_USER},%{SYS_GROUP}) %{_localstatedir}/lib/%{name}/%{name}.html
%ghost %{_sysconfdir}/alternatives/x-www-%{name}
%changelog