]>
Commit | Line | Data |
---|---|---|
c168192b JP |
1 | # |
2 | # Conditional build: | |
3 | %bcond_without systemd # without systemd support | |
4 | ||
46048b41 JP |
5 | %define gitref 5aa50b12fc4bab29855edba8557f0ad8fe26e2d1 |
6 | %define snap 20230306 | |
57597a2f | 7 | %define rel 1 |
41673576 | 8 | |
e08e4dbf AF |
9 | Summary: TV streaming server |
10 | Name: tvheadend | |
1eefc6e8 | 11 | # https://tvheadend.org/projects/tvheadend/wiki/Releases |
41673576 | 12 | Version: 4.3.0 |
9b2bc5b0 | 13 | Release: 0.%{snap}.%{rel} |
e08e4dbf | 14 | License: GPL v3 |
7d3739f8 | 15 | Group: Applications/Multimedia |
41673576 | 16 | Source0: https://github.com/tvheadend/tvheadend/archive/%{gitref}/%{name}-%{snap}.tar.gz |
46048b41 | 17 | # Source0-md5: fcd2c9946c48ee9b112f9451b1c2ccdb |
c168192b JP |
18 | Source1: %{name}.service |
19 | Source2: %{name}.sysconfig | |
20 | Source3: %{name}.init | |
41673576 | 21 | Patch0: x32.patch |
f2240875 | 22 | URL: https://tvheadend.org/projects/tvheadend |
7d3739f8 | 23 | BuildRequires: avahi-devel |
c168192b JP |
24 | BuildRequires: dbus-devel |
25 | BuildRequires: ffmpeg-devel >= 3.0 | |
26 | BuildRequires: gettext-tools | |
27 | BuildRequires: libdvbcsa-devel | |
57597a2f JP |
28 | BuildRequires: libx264-devel |
29 | BuildRequires: libx265-devel | |
c168192b | 30 | BuildRequires: openssl-devel |
41673576 | 31 | BuildRequires: pcre2-8-devel |
c168192b JP |
32 | BuildRequires: pkgconfig |
33 | BuildRequires: python3-modules | |
e08e4dbf | 34 | BuildRequires: rpmbuild(macros) >= 1.647 |
c168192b | 35 | %{?with_systemd:BuildRequires: systemd-devel} |
d32c34f2 | 36 | BuildRequires: uriparser-devel |
7d3739f8 | 37 | BuildRequires: zlib-devel |
e08e4dbf | 38 | Requires(post): sed >= 4.0 |
7d3739f8 | 39 | Requires(post,preun): /sbin/chkconfig |
c168192b | 40 | %{?with_systemd:Requires(post,preun,postun): systemd-units >= 38} |
f2240875 ER |
41 | Requires(postun): /usr/sbin/userdel |
42 | Requires(pre): /bin/id | |
43 | Requires(pre): /usr/sbin/useradd | |
f4363db6 | 44 | Requires: setup |
c168192b | 45 | %{?with_systemd:Requires: systemd-units >= 0.38} |
f2240875 ER |
46 | Provides: user(tvheadend) |
47 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
e08e4dbf AF |
48 | |
49 | %description | |
50 | Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2, | |
51 | DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources. | |
52 | ||
53 | %prep | |
41673576 | 54 | %setup -q -n %{name}-%{gitref} |
c168192b | 55 | %ifarch x32 |
41673576 | 56 | %patch0 -p1 |
3552479b | 57 | %endif |
e08e4dbf | 58 | |
57597a2f | 59 | %{__sed} -i -e '1s,/usr/bin/env python3$,%{__python3},' lib/py/tvh/tv_meta_{tm,tv}db.py support/tvhmeta |
41673576 | 60 | |
e08e4dbf | 61 | %build |
e08e4dbf | 62 | export CFLAGS="%{rpmcflags}" |
c168192b | 63 | export LDFLAGS="%{rpmldflags}" |
7d3739f8 AM |
64 | |
65 | # tvheadend uses a custom script, so %%configure cannot be used | |
e08e4dbf | 66 | # as not all options are supported |
5ab46ce7 | 67 | ./configure \ |
c168192b | 68 | --cc="%{__cc}" \ |
5ab46ce7 | 69 | --release \ |
f2240875 | 70 | --prefix=%{_prefix} \ |
5ab46ce7 | 71 | --libdir=%{_libdir} \ |
1eefc6e8 | 72 | --mandir=%{_mandir} \ |
c168192b JP |
73 | --python=%{__python3} \ |
74 | --disable-dvbscan \ | |
75 | --disable-ffmpeg_static \ | |
76 | --disable-hdhomerun_static \ | |
c168192b | 77 | %{!?with_systemd:--disable-libsystemd_daemon} |
5ab46ce7 | 78 | |
e08e4dbf AF |
79 | %{__make} V=1 |
80 | ||
81 | %install | |
82 | rm -rf $RPM_BUILD_ROOT | |
c168192b | 83 | install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name} \ |
e08e4dbf | 84 | $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \ |
c168192b | 85 | %{?with_systemd:$RPM_BUILD_ROOT%{systemdunitdir}} \ |
7d3739f8 | 86 | $RPM_BUILD_ROOT/etc/{rc.d/init.d,sysconfig} |
e08e4dbf AF |
87 | |
88 | %{__make} install \ | |
c168192b JP |
89 | DESTDIR=$RPM_BUILD_ROOT \ |
90 | V=1 | |
e08e4dbf | 91 | |
c168192b JP |
92 | %{?with_systemd:cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service} |
93 | cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/%{name} | |
94 | install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} | |
e08e4dbf AF |
95 | |
96 | chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name} | |
97 | ||
f2240875 ER |
98 | %clean |
99 | rm -rf $RPM_BUILD_ROOT | |
100 | ||
e08e4dbf | 101 | %pre |
f2240875 | 102 | %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -G usb -c "tvheadend User" tvheadend |
e08e4dbf AF |
103 | |
104 | %post | |
7d3739f8 AM |
105 | /sbin/chkconfig --add tvheadend |
106 | %service tvheadend reload "tvheadend" | |
c168192b | 107 | %{?with_systemd:%systemd_post %{name}.service} |
e08e4dbf AF |
108 | |
109 | %preun | |
7d3739f8 AM |
110 | if [ "$1" = "0" ]; then |
111 | %service tvheadend stop | |
112 | /sbin/chkconfig --del tvheadend | |
113 | fi | |
c168192b | 114 | %{?with_systemd:%systemd_preun %{name}.service} |
e08e4dbf AF |
115 | |
116 | %postun | |
117 | if [ "$1" = "0" ]; then | |
f2240875 | 118 | %userremove tvheadend |
e08e4dbf | 119 | fi |
c168192b | 120 | %{?with_systemd:%systemd_reload} |
e08e4dbf | 121 | |
e08e4dbf AF |
122 | %files |
123 | %defattr(644,root,root,755) | |
124 | %doc docs | |
125 | %attr(755,root,root) %{_bindir}/%{name} | |
7d3739f8 | 126 | %attr(754,root,root) /etc/rc.d/init.d/tvheadend |
e08e4dbf AF |
127 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} |
128 | %{_mandir}/man1/%{name}.1* | |
129 | %{_datadir}/%{name} | |
c168192b | 130 | %{?with_systemd:%{systemdunitdir}/%{name}.service} |
e08e4dbf | 131 | |
f2240875 | 132 | # home directory and config file |
e08e4dbf AF |
133 | %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name} |
134 | %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos | |
135 | %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts | |
136 | %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name} |