]> git.pld-linux.org Git - packages/tvheadend.git/blob - tvheadend.spec
Initial, based on spec from Mageia
[packages/tvheadend.git] / tvheadend.spec
1 # TODO:
2 # - verify BR
3 #
4 %define         maj_version 3.4
5 %define         tar_subversion patch1
6 %define         min_version 27
7 ######          Unknown group!
8 Summary:        TV streaming server
9 Name:           tvheadend
10 Version:        %{maj_version}.%{min_version}
11 Release:        0.2
12 License:        GPL v3
13 Group:          Video/Television
14 URL:            https://tvheadend.org/projects/tvheadend
15 Source0:        https://github.com/tvheadend/tvheadend/archive/%{maj_version}%{tar_subversion}.tar.gz
16 # Source0-md5:  86d1be0ad6e02bd2aecd3d529a026797
17 Source1:        %{name}.conf
18 Source2:        %{name}.service
19 Source3:        %{name}.sysconfig
20 #BuildRequires: avahi-client-devel
21 #BuildRequires: kdelibs4-devel
22 #BuildRequires: libgcrypt-devel
23 #BuildRequires: qt4-build
24 BuildRequires:  rpmbuild(macros) >= 1.647
25 Requires(post,preun,postun):    systemd-units >= 38
26 Requires:       systemd-units >= 0.38
27 Requires(post): pwgen
28 Requires(post): sed >= 4.0
29 Requires:       group(video)
30 Provides:       user(%{name})
31
32 %description
33 Tvheadend is a TV streaming server for Linux supporting DVB-S, DVB-S2,
34 DVB-C, DVB-T, ATSC, IPTV, and Analog video (V4L) as input sources.
35
36 %prep
37 %setup -q -n %{name}-%{maj_version}%{tar_subversion}
38
39 %build
40 #temporary workaround until upstream fixes compilation with gcc-4.6
41 #export CFLAGS="%{rpmcflags} -Wno-error=unused-but-set-variable"
42 export CFLAGS="%{rpmcflags}"
43 export CC="%{__cc}"
44 #tvheadend uses a custom configure script, so %%configure cannot be used
45 # as not all options are supported
46 ./configure --prefix=%{_prefix} --release --libdir=%{_libdir} --mandir=%{_mandir}/man1 --disable-dvbscan
47 %{__make} V=1
48
49 %install
50 rm -rf $RPM_BUILD_ROOT
51 install -d $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol \
52         $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/Videos \
53         $RPM_BUILD_ROOT%{systemdunitdir} \
54         $RPM_BUILD_ROOT/etc/sysconfig
55
56 %{__make} install \
57         DESTDIR=$RPM_BUILD_ROOT
58
59 cp %{SOURCE1} $RPM_BUILD_ROOT%{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
60 cp %{SOURCE2} $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
61 cp %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
62
63 chmod +x $RPM_BUILD_ROOT%{_bindir}/%{name}
64
65 %pre
66 %useradd -u 20 -d %{_localstatedir}/lib/%{name} -g video -c "tvheadend User" %{name}
67
68 %post
69 %systemd_post %{name}.service
70
71 # check if the access control file still has the initial dummy password, and
72 # replace the dummy password by a random, 12-character pwgen-generated password
73 if  grep -q '"password": "dummypassword"' %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1; then
74   sed -i "s,\"password\": \"dummypassword\",\"password\": \"$(pwgen -s 12 1)\"," %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
75 fi
76
77 %preun
78 %systemd_preun %{name}.service
79
80 %postun
81 if [ "$1" = "0" ]; then
82         %userremove %{name}
83 fi
84 %systemd_reload
85
86 %clean
87 rm -rf $RPM_BUILD_ROOT
88
89 %files
90 %defattr(644,root,root,755)
91 %doc docs
92 %attr(755,root,root) %{_bindir}/%{name}
93 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
94 %{_mandir}/man1/%{name}.1*
95 %{_datadir}/%{name}
96 %{systemdunitdir}/%{name}.service
97
98 #home directory and config file
99 %dir %attr(755,tvheadend,root) %{_localstatedir}/lib/%{name}
100 %dir %attr(755,tvheadend,video) %{_localstatedir}/lib/%{name}/Videos
101 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts
102 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}
103 %dir %attr(750,tvheadend,video) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol
104 %attr(600,tvheadend,video) %config(noreplace) %verify(not md5 mtime size) %{_localstatedir}/lib/%{name}/.hts/%{name}/accesscontrol/1
105
This page took 0.073683 seconds and 4 git commands to generate.