3 %bcond_without systemd # without systemd support
5 Summary: TV streaming server
7 # https://tvheadend.org/projects/tvheadend/wiki/Releases
11 Group: Applications/Multimedia
12 Source0: https://github.com/tvheadend/tvheadend/archive/v%{version}/%{name}-%{version}.tar.gz
13 # Source0-md5: b9571efa46dd489f9fe87acdb391d591
14 Source1: %{name}.service
15 Source2: %{name}.sysconfig
17 Patch0: format-security.patch
21 URL: https://tvheadend.org/projects/tvheadend
22 BuildRequires: avahi-devel
23 BuildRequires: dbus-devel
24 BuildRequires: ffmpeg-devel >= 3.0
25 BuildRequires: gettext-tools
26 BuildRequires: libdvbcsa-devel
27 BuildRequires: openssl-devel
28 BuildRequires: pkgconfig
29 BuildRequires: python3-modules
30 BuildRequires: rpmbuild(macros) >= 1.647
31 %{?with_systemd:BuildRequires: systemd-devel}
32 BuildRequires: uriparser-devel
33 BuildRequires: zlib-devel
34 Requires(post): sed >= 4.0
35 Requires(post,preun): /sbin/chkconfig
36 %{?with_systemd:Requires(post,preun,postun): systemd-units >= 38}
37 Requires(postun): /usr/sbin/userdel
38 Requires(pre): /bin/id
39 Requires(pre): /usr/sbin/useradd
41 %{?with_systemd:Requires: systemd-units >= 0.38}
42 Provides: user(tvheadend)
43 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
46 Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
47 DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.
59 export CFLAGS="%{rpmcflags}"
60 export LDFLAGS="%{rpmldflags}"
62 # tvheadend uses a custom script, so %%configure cannot be used
63 # as not all options are supported
70 --python=%{__python3} \
72 --disable-ffmpeg_static \
73 --disable-hdhomerun_static \
74 --disable-libfdkaac_static \
75 --disable-libmfx_static \
76 --disable-libtheora_static \
77 --disable-libvorbis_static \
78 --disable-libvpx_static \
79 --disable-libx264_static \
80 --disable-libx265_static \
81 %{!?with_systemd:--disable-libsystemd_daemon}
86 rm -rf $RPM_BUILD_ROOT
87 install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name} \
88 $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \
89 %{?with_systemd:$RPM_BUILD_ROOT%{systemdunitdir}} \
90 $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig}
93 DESTDIR=$RPM_BUILD_ROOT \
96 %{?with_systemd:cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service}
97 cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
98 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
100 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
103 rm -rf $RPM_BUILD_ROOT
106 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -G usb -c "tvheadend User" tvheadend
109 /sbin/chkconfig --add tvheadend
110 %service tvheadend reload "tvheadend"
111 %{?with_systemd:%systemd_post %{name}.service}
114 if [ "$1" = "0" ]; then
115 %service tvheadend stop
116 /sbin/chkconfig --del tvheadend
118 %{?with_systemd:%systemd_preun %{name}.service}
121 if [ "$1" = "0" ]; then
122 %userremove tvheadend
124 %{?with_systemd:%systemd_reload}
127 %defattr(644,root,root,755)
129 %attr(755,root,root) %{_bindir}/%{name}
130 %attr(754,root,root) /etc/rc.d/init.d/tvheadend
131 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
132 %{_mandir}/man1/%{name}.1*
134 %{?with_systemd:%{systemdunitdir}/%{name}.service}
136 # home directory and config file
137 %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
138 %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
139 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
140 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}