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