File vdr.spec of Package vdr
#
# spec file for package vdr
#
# 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/
#
Name: vdr
BuildRequires: doxygen
BuildRequires: fdupes
BuildRequires: fontconfig-devel
BuildRequires: freetype2-devel
BuildRequires: gcc-c++
BuildRequires: graphviz
BuildRequires: libcap-devel
BuildRequires: libjpeg-devel
BuildRequires: linux-glibc-devel
BuildRequires: ncurses-devel
%if 0%{?suse_version} >= 1330
BuildRequires: ncurses5-devel
%endif
BuildRequires: pkg-config
BuildRequires: systemd-devel
#
%define vdrname vdr
%define vdr_apiversion 2.2.0
%define vdr_localedir %{_datadir}/vdr/locale
%define vdr_libdir %{_libdir}/vdr
%define vdr_includedir %{_includedir}/vdr
%define vdr_videodir /var/spool/video
%define vdr_sysconfdir /etc/vdr
#
Url: http://www.tvdr.de/
PreReq: /usr/sbin/useradd
Version: 2.2.0
Release: 0
Summary: Video Disk Recorder
License: GPL-2.0+
Group: Hardware/TV
Source: ftp://ftp.tvdr.de/vdr/vdr-%{version}.tar.bz2
Source10: vdr.macros
Source11: vdr.firewall
Source42: msgmerge
# generated from wiki page
Source90: README.SUSE-vdr.txt
Source91: README.SUSE-vdr.html
Source92: greenish.css
Source95: vdr-doc.desktop
#
Patch1: vdr-1.7.29-menuselection.patch
Patch2: vdr-1.7.21-pluginmissing.patch
Patch3: vdr-1.7.36-wareagle.patch
Patch4: vdr-2.2.0-dynamite.diff
Patch5: vdr-2.0.4-MainMenuHooks-v1_0_1.patch
Patch6: vdr-2.0.6-wareagle-fix.patch
Patch7: vdr-2.2.0-use-ncurses5.diff
Patch8: vdr-2.2.0-gcc7.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: vdr-devel
Provides: vdr(abi) = %vdr_apiversion
Obsoletes: vdr(abi) < %vdr_apiversion
Provides: vdrapi = %vdr_apiversion
Requires: xorg-x11-fonts-scalable
%if 0%{?suse_version} >= 1220
Recommends: runvdr-extreme-systemd
%else
Recommends: vdr-runvdr
%endif
%package devel
Summary: Video Disk Recorder
Group: Hardware/TV
PreReq: vdr = %version
%package devel-doc
Summary: Video Disk Recorder
Group: Hardware/TV
PreReq: vdr-devel = %version
BuildArch: noarch
%description
Version 2.0 of VDR, the Linux Video Disk Recorder provides HDTV support, the
Transport Stream recording format, DVB subtitles, ATSC support, and improved
Electronic Program Guides handling.
%description devel
Development files for VDR, needed for building plugins.
%description devel-doc
API documentation for VDR.
%lang_package
%prep
%setup -q -n vdr-%{version}
#
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
#
## hack to apply patch7 either in rpmbuild if ncurses6 or during "quilt setup"
case "`rpm -q ncurses-devel`" in
ncurses-devel-6*) NCURSES6=true ;;
*) NCURSES6=false ;;
esac
if $NCURSES6 || [ "$TEXTDOMAIN" = quilt ]; then
%patch7 -p1
fi
%patch8 -p1
#should be a patch, but anyway...
%if 0%{?suse_version} >= 1330
sed -i -e 's/libsystemd-daemon/libsystemd/g' Makefile
%endif
#
#
cat > Make.config <<EOF
### The C compiler options:
CFLAGS = $RPM_OPT_FLAGS -fPIC -Wall
CXXFLAGS = $RPM_OPT_FLAGS -fPIC -Wall -Werror=overloaded-virtual -Wparentheses
### The directory environment:
PREFIX = %{_prefix}
BINDIR = %{_bindir}
INCDIR = %{_includedir}
LIBDIR = %{vdr_libdir}
LOCDIR = %{vdr_localedir}
MANDIR = %{_mandir}
PCDIR = %{_libdir}/pkgconfig
RESDIR = %{_datadir}/vdr
VIDEODIR = %{vdr_videodir}
CONFDIR = %{vdr_sysconfdir}
CACHEDIR = %{_localstatedir}/cache/vdr
LIRC_DEVICE = /var/run/lirc/lircd
VDR_USER = vdr
SDNOTIFY = 1
EOF
#
APIVERSION=`sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$/\1/p' config.h`
if [ "%vdr_apiversion" != "$APIVERSION" ]; then
echo "*** APIVERSION must be $APIVERSION, fix definition!"
false
fi
# for some reason, graphviz doesn't like png here
sed -i 's|^\(DOT_IMAGE_FORMAT\s\+= \).*$|\1svg|g
s|^\(INTERACTIVE_SVG\s\+= \).*$|\1YES|g' Doxyfile
# do not include build date in locale files
cp -a %{SOURCE42} .
chmod 0755 msgmerge
%build
# to use msgmerge script
export PATH=`pwd`:$PATH
make %{?jobs:-j%jobs}
make plugins
make srcdoc
%install
%makeinstall
install -m 644 *.conf %{buildroot}%{vdr_sysconfdir}
install -m 644 Make.config %{buildroot}%{vdr_includedir}
install -d -m 755 %{buildroot}%{_localstatedir}/cache/vdr
# create plugins doc dir
mkdir plugins
for d in PLUGINS/src; do
test -d PLUGINS/src/$d && {
for f in README HISTORY COPYING; do
test -f PLUGINS/src/$d/$f && cp -a PLUGINS/src/$d/$f plugins/$f.$d
done
}
done
#
# docu
#
cp %{SOURCE90} README.SUSE
cp %{SOURCE91} README.SUSE.html
cp %{SOURCE92} .
#
install -d -m 755 %{buildroot}%{_datadir}/susehelp/meta/Manuals/Productivity
install -m 644 %{SOURCE95} %{buildroot}%{_datadir}/susehelp/meta/Manuals/Productivity/vdr.desktop
# locale files
echo '%%defattr (644, root, root, 755)' > vdr.lang
find %{buildroot}%{vdr_localedir} -type f -printf '%%P\n' | while read f; do
echo "%%lang(${f%%%%/*}) %{vdr_localedir}/$f"
done >> vdr.lang
#
# source code docu (installed manually for the sake of fdupes' success)
install -d -m 755 %{buildroot}%{_docdir}/%{name}-devel
cp -a srcdoc/html %{buildroot}%{_docdir}/%{name}-devel
%fdupes %{buildroot}%{_docdir}/%{name}-devel
#
# rpm macro file
install -d -m 755 %{buildroot}/etc/rpm
cat > %{buildroot}/etc/rpm/macros.vdr <<EOF
%%vdrname %vdrname
%%vdr_apiversion %vdr_apiversion
%%vdr_localedir %vdr_localedir
%%vdr_libdir %vdr_libdir
%%vdr_includedir %vdr_includedir
%%vdr_videodir %vdr_videodir
%%vdr_sysconfdir %vdr_sysconfdir
%%vdr_prereq vdr(abi) = %{vdr_apiversion}
EOF
cat %{SOURCE10} >> %{buildroot}/etc/rpm/macros.vdr
#
# msgmerge helper for plugins
install -m 0755 msgmerge %{buildroot}%{_datadir}/vdr/msgmerge
#
# firewall config
install -m 644 -D %{SOURCE11} %{buildroot}/%{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
%pre
/usr/sbin/useradd -r -d %{vdr_videodir} -s /bin/false -c "Video Disk Recorder" -g video vdr 2> /dev/null || :
%files
%defattr(-,root,root)
%doc README.SUSE README.SUSE.html greenish.css
%doc %{_datadir}/susehelp
%doc COPYING README* UPDATE* CONTRIBUTORS HISTORY
%doc MANUAL channels.conf.* PLUGINS.html plugins
%attr(755,vdr,root) %dir %{vdr_videodir}
%attr(755,vdr,root) %dir %{vdr_sysconfdir}
%attr(755,vdr,root) %dir %{_localstatedir}/cache/vdr
%dir %{vdr_libdir}
%dir %{_datadir}/vdr
%dir %{vdr_localedir}
%dir %{vdr_localedir}/*
%dir %{vdr_localedir}/*/LC_MESSAGES
%attr(-,vdr,root) %config(noreplace) %{vdr_sysconfdir}/*
%{_bindir}/*
%{vdr_libdir}/*
%{_mandir}/man?/*
%config(noreplace) %attr(0644,root,root) %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/%{name}
%files devel
%defattr(-,root,root)
%config /etc/rpm/macros.vdr
%{vdr_includedir}
%{_includedir}/libsi
%{_libdir}/pkgconfig/*
%{_datadir}/vdr/msgmerge
%files devel-doc
%defattr(-,root,root)
%{_docdir}/%{name}-devel
%files lang -f %{name}.lang
%changelog