Add basic RPM build support

This commit is contained in:
Jaroslav Kysela 2014-10-13 19:58:50 +02:00
parent 3bcfe3fa3c
commit 392dec0b1d
5 changed files with 102 additions and 0 deletions

3
.gitignore vendored
View file

@ -22,3 +22,6 @@ debian/tvheadend
debian/tvheadend-dbg
debian/tvheadend*substvars
debian/tvheadend*.debhelper*
rpm/tvheadend.spec
rpm/test.patch

32
rpm/Makefile Normal file
View file

@ -0,0 +1,32 @@
#
# RPM build
# Copyright (C) 2014 Jaroslav Kysela
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
include $(dir $(lastword $(MAKEFILE_LIST)))../.config.mk
COMMIT ?= $(shell git rev-parse HEAD)
COMMIT1 = $(shell git rev-parse $(COMMIT))
VERSION = $(shell cd .. && git describe --match "v*" $(COMMIT1) | sed 's/-/./g' )
tvheadend.spec: tvheadend.spec.in
@sed -e 's/@VERSION@/$(VERSION)/g' \
-e 's/@COMMIT@/$(COMMIT1)/g' \
$< > $@
build: tvheadend.spec
spectool --get-files --sourcedir tvheadend.spec
rpmbuild -ba tvheadend.spec

14
rpm/tvheadend.service Normal file
View file

@ -0,0 +1,14 @@
[Unit]
Description=Tvheadend - a TV streaming server and DVR
After=syslog.target network.target auditd.service
[Service]
EnvironmentFile=/etc/sysconfig/tvheadend
ExecStart=/usr/bin/tvheadend -f -p /var/run/tvheadend.pid -u $OPTIONS
PIDFile=/var/run/tvheadend.pid
Type=forking
Restart=on-failure
RestartSec=54s
[Install]
WantedBy=multi-user.target

50
rpm/tvheadend.spec.in Normal file
View file

@ -0,0 +1,50 @@
%global commit @COMMIT@
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Summary: Tvheadend - a TV streaming server and DVR
Name: tvheadend
Version: @VERSION@
Release: 1
License: GPLv3
Group: Applications/Multimedia
URL: http://tvheadend.org
Source: https://github.com/tvheadend/tvheadend/archive/%{commit}/tvheadend-%{commit}.tar.gz
#Patch999: test.patch
BuildRequires: systemd-units >= 1
BuildRequires: dbus-devel
BuildRequires: avahi-libs
BuildRequires: openssl-devel
BuildRequires: git wget
Requires: systemd-units >= 1
%description
Tvheadend is a TV streaming server with DVR for Linux supporting
DVB, ATSC, IPTV, SAT>IP as input sources. Can be used as a backend
to Showtime, XBMC and various other clients.
%prep
%setup -q -n tvheadend-%{commit}
#%patch999 -p1 -b .test
%build
%configure --disable-lockowner --enable-bundle --enable-libffmpeg_static
%{__make}
%install
# binary
mkdir -p -m755 %{buildroot}%{_bindir}
install -p -m 755 build.linux/tvheadend %{buildroot}%{_bindir}
# systemd
mkdir -p -m755 %{buildroot}%{_sysconfdir}/sysconfig
install -p -m 644 rpm/tvheadend.sysconfig %{buildroot}%{_sysconfdir}/sysconfig
mkdir -p -m755 %{buildroot}%{_unitdir}
install -p -m 644 rpm/tvheadend.service %{buildroot}%{_unitdir}
%files
%{_bindir}/*
%{_sysconfdir}/sysconfig/*
%{_unitdir}/*

3
rpm/tvheadend.sysconfig Normal file
View file

@ -0,0 +1,3 @@
# Configuration file for the tvheadend service.
OPTIONS="-u tvheadend -g tvheadend -6 --http_port=9981 --htsp_port=9982"