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