Packaging » History » Revision 10
Revision 9 (Adam Sutton, 2013-12-30 17:44) → Revision 10/15 (Bob Lightfoot, 2015-03-18 22:38)
h1. 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 [[Building|here]]
Different distributions will have different package formats, however TVHeadend comes with scripts to help build several common ones.
h2. 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
<pre>
$ ./Autobuild.sh -t precise-i386
</pre>
> x86 64-bit
<pre>
$ ./Autobuild.sh -t precise-amd64
</pre>
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.
h3. Configure Options
You can also pass specific configuration options to the configure script by setting the _AUTOBUILD_CONFIGURE_EXTRA_ environment variable.
<pre>
$ AUTOBUILD_CONFIGURE_EXTRA=--enable-bundle ./Autobuild.sh -t precise-amd64
</pre>
h2. 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 TODO: add info 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
</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
<pre>
$sudo useradd 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 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 found through one of the following in the ~/tvheadend folder:
https://tvheadend.org/boards/4/topics/14666
https://tvheadend.org/attachments/download/2823/tvheadend-4.0.01012015-1.src.rpm
https://tvheadend.org/attachments/download/2738/tvheadend-4.0.01012015-1.spec
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 the master branch
<pre>
$git show-ref --head
</pre>
create the spec file for the next version note new and old are the date-revision strings
<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
change the version string to match the new being built
change the git archive comment line to be the correct values commit tag and filename
change the source0 filename also
save the spec file for use later
<pre>
$vi tvheadend-new
</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 96898a66e96927e4ace9a637ea923fd9f514dd1d --format=tar --prefix=tvheadend/ | gzip > ../tvheadend-4.0.03182015.tar.gz
$mv ../tvheadend-4.0.03182015.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 /etc/mock/nux-7-x86_64.cfg can be created by adding following to the epel7.cfg and renaming as saved
<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-4.0.01012015-1.src.rpm
</pre>
copy in the new source tar and spec files
<pre>
$mock -r nux-7-x86_64 --no-clean --copyin tvheadend-4.0.03182015.tar.gz builddir/build/SOURCES/
$mock -r nux-7-x86_64 --no-clean --copyin tvheadend-4.0.03182015-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-4.0.03182015-1.src.rpm ./
</pre>
build the new version from the source rpm
<pre>
$mock -r nux-7-x86_64 --rebuild tvheadend-4.0.03182015-1.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 /home/mock/tvheadend/tvheadend-4.0.03182015-1.x86_64.rpm
</pre>
h2. Gentoo
tvheadend is now available in portage so you can just install it like you usually do with other applications:
<pre>
$ emerge -av media-tv/tvheadend
</pre>
h2. ArchLinux
If you'd like to build the latest git master for Arch, then you can issue the following commands:
<pre>
$ yaourt -S tvheadend-git
$ systemctl enable tvheadend
$ systemctl start tvheadend
</pre>
To install XBMC-PVR + Tvheadend:
<pre>
$ yaourt -S xbmc-pvr-addons-git xbmc-git tvheadend-git
</pre>
h2. Package Maintainers
If you wish to become a package maintainer for your favourite distribution, please contact a member of the development [[Team|team]].
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 [[Building|here]]
Different distributions will have different package formats, however TVHeadend comes with scripts to help build several common ones.
h2. 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
<pre>
$ ./Autobuild.sh -t precise-i386
</pre>
> x86 64-bit
<pre>
$ ./Autobuild.sh -t precise-amd64
</pre>
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.
h3. Configure Options
You can also pass specific configuration options to the configure script by setting the _AUTOBUILD_CONFIGURE_EXTRA_ environment variable.
<pre>
$ AUTOBUILD_CONFIGURE_EXTRA=--enable-bundle ./Autobuild.sh -t precise-amd64
</pre>
h2. 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 TODO: add info 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
</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
<pre>
$sudo useradd 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 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 found through one of the following in the ~/tvheadend folder:
https://tvheadend.org/boards/4/topics/14666
https://tvheadend.org/attachments/download/2823/tvheadend-4.0.01012015-1.src.rpm
https://tvheadend.org/attachments/download/2738/tvheadend-4.0.01012015-1.spec
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 the master branch
<pre>
$git show-ref --head
</pre>
create the spec file for the next version note new and old are the date-revision strings
<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
change the version string to match the new being built
change the git archive comment line to be the correct values commit tag and filename
change the source0 filename also
save the spec file for use later
<pre>
$vi tvheadend-new
</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 96898a66e96927e4ace9a637ea923fd9f514dd1d --format=tar --prefix=tvheadend/ | gzip > ../tvheadend-4.0.03182015.tar.gz
$mv ../tvheadend-4.0.03182015.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 /etc/mock/nux-7-x86_64.cfg can be created by adding following to the epel7.cfg and renaming as saved
<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-4.0.01012015-1.src.rpm
</pre>
copy in the new source tar and spec files
<pre>
$mock -r nux-7-x86_64 --no-clean --copyin tvheadend-4.0.03182015.tar.gz builddir/build/SOURCES/
$mock -r nux-7-x86_64 --no-clean --copyin tvheadend-4.0.03182015-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-4.0.03182015-1.src.rpm ./
</pre>
build the new version from the source rpm
<pre>
$mock -r nux-7-x86_64 --rebuild tvheadend-4.0.03182015-1.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 /home/mock/tvheadend/tvheadend-4.0.03182015-1.x86_64.rpm
</pre>
h2. Gentoo
tvheadend is now available in portage so you can just install it like you usually do with other applications:
<pre>
$ emerge -av media-tv/tvheadend
</pre>
h2. ArchLinux
If you'd like to build the latest git master for Arch, then you can issue the following commands:
<pre>
$ yaourt -S tvheadend-git
$ systemctl enable tvheadend
$ systemctl start tvheadend
</pre>
To install XBMC-PVR + Tvheadend:
<pre>
$ yaourt -S xbmc-pvr-addons-git xbmc-git tvheadend-git
</pre>
h2. Package Maintainers
If you wish to become a package maintainer for your favourite distribution, please contact a member of the development [[Team|team]].