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