Project

General

Profile

Building » History » Revision 25

Revision 24 (Bob Lightfoot, 2015-03-22 20:02) → Revision 25/32 (Jaroslav Kysela, 2015-06-02 10:43)

h1. Building

h2. Prerequisites

Before you can build Tvheadend you will need several packages installed on your development machine.

The specific details will vary between distributions so we only cover the major ones here.

h3. Debian/Ubuntu

<pre>
$ sudo aptitude install build-essential git pkg-config libssl-dev bzip2 wget
</pre>

> Optional:
<pre>
$ sudo aptitude install libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev
</pre>

h3. Redhat / Centos / Fedora

h4. Redhat/Centos/Fedora Build assumptions

<pre>
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

But you may run </pre>

h4. Build Environment Configuration

install the software used for building tvheadened
<pre>
$sudo yum install git mock
</pre>

create a user to do the building as -- this is not a requirement, but does provide a modicum of compartmentaliztion when building
<pre>
$sudo useradd -g mock mock
$sudo passwd mock
</pre>

for more details view the Centos/Fedora Mock pages starting
http://fedoraproject.org/wiki/Projects/Mock

h4. Getting the files to work with

tvheadend from sources are retrieved as follow
<pre>
$su mock
$mkdir git
$cd git
$ git clone https://github.com/tvheadend/tvheadend.git
</pre>

create a workfiles holding directory
<pre>
$mkdir ~/tvheadend
</pre>

you'll also need a starter source rpm and specfile such as attached placed in
the build tree, ~/tvheadend folder:
tvheadend-3.9.2618-git.e5dc86b.1.spec
tvheadend-3.9.2618-git.e5rc86b.1.el7.centos.src.rpm

h4. Step by Step Building the RPM

enter the local git repository and reset local to most current remote
<pre>
$cd ~/git/tvheadend
$git fetch origin
$git reset --hard origin/master
</pre>

determine the commit id
of course. the master branch - for ex. "e5dc86b3dd32f80c337da75cc0d2e00702c45fe1"
<pre>
$git show-ref --head
</pre>

determine the version id of this build as well - for ex. "v3.9-2618-ge5dc86b"


<pre>
sudo yum groups install "C Development Tools $git describe --dirty --match "v*"
</pre>

create the spec file for the next version note new
and Libraries" old are the revision strings
in this example tvheadend-new-spec would be tvheadend-3.9.2618-git.e5dc86b.1.spec

sudo <pre>
$cp tvheadend-old.spec tvheadend-new.spec
</pre>

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
<pre>
$vi tvheadend-new.spec
</pre>

switch to the git tvheadened master and export the archive file called for in the new spec to the ~/tvheadend folder
<pre>
$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
</pre>

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

<pre>
[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
</pre>

clean the mock build environment
<pre>
$mock --init -r nux-7-x86_64
</pre>

now build the previous version in the clean environment
<pre>
$mock -r nux-7-x86_64 --rebuild tvheadend-3.9.2618-git.e5dc86b.1.el7.centos.src.rpm
</pre>

copy in the new source tar and spec files
<pre>
$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
</pre>

shell in and confirm new source and spec are present and then build new src.rpm
<pre>
$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
</pre>

copy out the new src.rpm
<pre>
$mock -r nux-7-x86_64 --no-clean --copyout builddir/build/SRPMS/tvheadend-3.9.2618-git.e5dc86b.1.el7.centos.src.rpm ./
</pre>

build the new version from the source rpm
<pre>
$mock -r nux-7-x86_64 --rebuild tvheadend-3.9.2618-git.e5dc86b.1.el7.centos.src.rpm
</pre>

move the results to your working folder
<pre>
$cp /var/lib/mock/nux-7-x86_64/result/*.rpm ./
</pre>

h4. Install the RPM

<pre>
$sudo
yum install zlib-devel avahi-devel dbus-devel openssl-devel python /home/mock/tvheadend/tvheadend-3.9.2618-git.e5dc86b.1.el7.centos.x86_64.rpm
</pre>



h3. Gentoo

TODO: this needs adding

h2. Get Source

Next you must obtain the source code, this is hosted on "github":https://github.com/tvheadend/tvheadend.

To clone the repository simple run the command:

<pre>
$ git clone https://github.com/tvheadend/tvheadend.git
</pre>

h2. Configuring

TVHeadend comes with a configuration script that allows you to enable/disable optional components and set install paths, etc.

Most people will be fine with the defaults and can run:

<pre>
$ ./configure
</pre>

However for more advanced options, please run the following:

<pre>
$ ./configure --help
</pre>

And then re-run configure with the required options, i.e.:

<pre>
$ ./configure --disable-dvbscan
</pre>

h2. Compiling

To compile Tvheadend run:

<pre>
$ make
</pre>

h2. Installing

It is possible to install Tvheadend using make, based on the ./configure options, by running:

<pre>
$ sudo make install
</pre>

However it's recommend that you run from the build directory for development/testing (see [[Development]]):

<pre>
$ ./build.linux/tvheadend
</pre>

NOTE: its VERY important you run test builds from git root, so command should look similar to above.

And that you build a [[Packaging|package]] if you wish to install Tvheadend permanently and hook into the system start scripts etc.

Use of make install is not very traceable and so removal can sometimes be painful, and it might overwrite an existing installation.

h2. Packaging

For more information about packaging Tvheadend please see [[Packaging|here]]

h2. Reporting Problems

If you have problems with a custom compiled version of Tvheadend its important that any issue reports include details of the specific version of source you used. For more details please see [[bugreporting|here]].