Project

General

Profile

Packaging

To be able to install TVHeadend permanently on your system, or distribute to others, its highly recommend that you build a package.

But before you can do this make sure you have read the basic build instructions here

Different distributions will have different package formats, however TVHeadend comes with scripts to help build several common ones.

Ubuntu / Debian

To build a deb package for the latest version of Ubuntu (Precise, at the time of writing) you can do the following:

x86 32-bit

$ ./Autobuild.sh -t xenial-i386

x86 64-bit

$ ./Autobuild.sh -t xenial-amd64

Note: Although the scripts are named precise (for Ubuntu 12.04) they will work just fine with most recent versions of Debian/Ubuntu.

Note: the generated deb will be in the directory above that containing Autobuild.sh (i.e. outside of the tvheadend directory).

Note: the -dbg package contains debug symbols, generally you won't need these.

Configure Options

You can also pass specific configuration options to the configure script by setting the AUTOBUILD_CONFIGURE_EXTRA environment variable.

$ AUTOBUILD_CONFIGURE_EXTRA="--enable-bundle" ./Autobuild.sh -t xenial-amd64

Redhat / Centos / Fedora

Redhat/Centos/Fedora Build assumptions

Redhat/Centos/Fedora are a package managed OS and as such tvheadend should be installed from an rpm on a production system.  
This set of instructions details using tools git, mock and rpmbuild to package the source into an rpm and then install the rpm

Build Environment Configuration

install the software used for building tvheadened
$sudo yum install git mock
create a user to do the building as -- this is not a requirement, but does provide a modicum of compartmentaliztion when building
$sudo useradd -g mock mock
$sudo passwd mock
for more details view the Centos/Fedora Mock pages starting
http://fedoraproject.org/wiki/Projects/Mock

Getting the files to work with

tvheadend sources are retrieved as follow
$su mock
$mkdir git
$cd git
$ git clone https://github.com/tvheadend/tvheadend.git
create a workfiles holding directory
$mkdir ~/tvheadend
you'll also need a starter source rpm and specfile such as attached placed in the ~/tvheadend folder:
tvheadend-3.9.2618-git.e5dc86b.1.spec
tvheadend-3.9.2618-git.e5rc86b.1.el7.centos.src.rpm

Step by Step Building the RPM

enter the local git repository and reset local to most current remote
$cd ~/git/tvheadend
$git fetch origin
$git reset --hard origin/master
determine the commit id of the master branch - for ex. "e5dc86b3dd32f80c337da75cc0d2e00702c45fe1" 
$git show-ref --head
determine the version id of this build as well - for ex. "v3.9-2618-ge5dc86b"
$git describe --dirty --match "v*" 
create the spec file for the next version note new and old are the revision strings
in this example tvheadend-new-spec would be tvheadend-3.9.2618-git.e5dc86b.1.spec
$cp tvheadend-old.spec tvheadend-new.spec
open the new spec and edit as follows
update the global commit string to match the current master commit - for ex. "e5dc86b3dd32f80c337da75cc0d2e00702c45fe1"
change the version string to match the new being built - - for ex. version "3.9-2618" note the revision is automatic
except for the 1,2,3 or whatever patch might be applied
change the git archive comment line to be the correct values commit tag and filename
change the source0 filename also
also modify the changelog to reflect the new version
save the spec file for use later
$vi tvheadend-new.spec
switch to the git tvheadened master and export the archive file called for in the new spec to the ~/tvheadend folder
$cd ~/git/tvheadend
$git archive e5dc86b3dd32f80c337da75cc0d2e00702c45fe1 --format=tar --prefix=tvheadend/ | gzip > ../tvheadend-3.9.2618-git.e5dc86b.tar.gz
$mv ../tvheadend-3.9.2618-git.e5dc86b.tar.gz ~/tvheadend
mock setup {for Fedora you'll need to use the rpmfusion environment} {for centos you'll need to use nuxro's repos as an environment}
the /nux-7-x86_64.cfg attached works for me with nux.ro's repo and centos7
[nux-dextop]
name=Nux.Ro RPMs for general desktop use
baseurl=http://li.nux.ro/download/nux/dextop/el7/$basearch/ http://mirror.li.nux.ro/li.nux.ro/nux/dextop/el7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro
protect=0

[nux-dextop-testing]
name=Nux.Ro RPMs for general desktop use - testing
baseurl=http://li.nux.ro/download/nux/dextop-testing/el7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-nux.ro
protect=0
clean the mock build environment
$mock --init -r nux-7-x86_64
now build the previous version in the clean environment
$mock -r nux-7-x86_64 --rebuild tvheadend-3.9.2618-git.e5dc86b.1.el7.centos.src.rpm
copy in the new source tar and spec files
$mock -r nux-7-x86_64 --no-clean --copyin tvheadend-3.9.2618-git.e5dc86b.1.tar.gz builddir/build/SOURCES/
$mock -r nux-7-x86_64 --no-clean --copyin tvheadend-3.9.2618-git.e5dc86b.1.spec builddir/build/SPECS/tvheadend.spec
shell in and confirm new source and spec are present and then build new src.rpm
$mock -r nux-7-x86_64 --no-clean --shell
<mock>$ls -lah builddir/build/SOURCES
<mock>$ls -lah builddir/build/SPECS
<mock>$rpmbuild -bs builddir/build/SPECS/tvheadend.spec
<mock>$exit
copy out the new src.rpm
$mock -r nux-7-x86_64 --no-clean --copyout builddir/build/SRPMS/tvheadend-3.9.2618-git.e5dc86b.1.el7.centos.src.rpm ./
build the new version from the source rpm
$mock -r nux-7-x86_64 --rebuild tvheadend-3.9.2618-git.e5dc86b.1.el7.centos.src.rpm
move the results to your working folder
$cp /var/lib/mock/nux-7-x86_64/result/*.rpm ./

Install the RPM

$sudo yum install /home/mock/tvheadend/tvheadend-3.9.2618-git.e5dc86b.1.el7.centos.x86_64.rpm

Gentoo

tvheadend is now available in portage so you can just install it like you usually do with other applications:

$ emerge -av media-tv/tvheadend

ArchLinux

If you'd like to build the latest git master for Arch, then you can issue the following commands:

$ yaourt -S tvheadend-git
$ systemctl enable tvheadend
$ systemctl start tvheadend

To install XBMC-PVR + Tvheadend:

$ yaourt -S xbmc-pvr-addons-git xbmc-git tvheadend-git

Package Maintainers

If you wish to become a package maintainer for your favourite distribution, please contact a member of the development team.