From 392dec0b1d5a4224156b1cfcb30993910cad4461 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 13 Oct 2014 19:58:50 +0200 Subject: [PATCH] Add basic RPM build support --- .gitignore | 3 +++ rpm/Makefile | 32 ++++++++++++++++++++++++++ rpm/tvheadend.service | 14 ++++++++++++ rpm/tvheadend.spec.in | 50 +++++++++++++++++++++++++++++++++++++++++ rpm/tvheadend.sysconfig | 3 +++ 5 files changed, 102 insertions(+) create mode 100644 rpm/Makefile create mode 100644 rpm/tvheadend.service create mode 100644 rpm/tvheadend.spec.in create mode 100644 rpm/tvheadend.sysconfig diff --git a/.gitignore b/.gitignore index 191c2fee..160ff527 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ debian/tvheadend debian/tvheadend-dbg debian/tvheadend*substvars debian/tvheadend*.debhelper* + +rpm/tvheadend.spec +rpm/test.patch diff --git a/rpm/Makefile b/rpm/Makefile new file mode 100644 index 00000000..5a9d8892 --- /dev/null +++ b/rpm/Makefile @@ -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 . +# + +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 diff --git a/rpm/tvheadend.service b/rpm/tvheadend.service new file mode 100644 index 00000000..78d4b071 --- /dev/null +++ b/rpm/tvheadend.service @@ -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 diff --git a/rpm/tvheadend.spec.in b/rpm/tvheadend.spec.in new file mode 100644 index 00000000..c808f6da --- /dev/null +++ b/rpm/tvheadend.spec.in @@ -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}/* diff --git a/rpm/tvheadend.sysconfig b/rpm/tvheadend.sysconfig new file mode 100644 index 00000000..d62f7513 --- /dev/null +++ b/rpm/tvheadend.sysconfig @@ -0,0 +1,3 @@ +# Configuration file for the tvheadend service. + +OPTIONS="-u tvheadend -g tvheadend -6 --http_port=9981 --htsp_port=9982"