Next Previous Contents

5. Downloading and compiling.

Get MythTV from the mythtv.org web site. There are two installation methods you may choose from. The first is to download the latest release in tarball format and compile. The tarball release of MythTV should work on a wide variety of systems and should be the preferred method for new users. If you wish to use the CVS version of MythTV you may obtain it from CVS this way:

$ mkdir mythtv
$ cd mythtv
$ cvs -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs login
Logging in to :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs
CVS password: mythtv
$ cvs -z3 -d :pserver:mythtv@cvs.mythtv.org:/var/lib/mythcvs checkout mythtv

NOTE: You may get an error about cvs not finding a .cvspass file the very first time you run it. This is normal.
The other MythTV modules may be downloaded from CVS the same way; replace "mythtv" with "mythweather", "mythgallery", "mythmusic", etc.

If you wish to stay up-to-date with CVS, you may replace "checkout mythtv" with update mythtv after you've done your initial download.

NOTE: If you are going to use CVS to compile MythTV rather than using the distribution tarball, it is strongly recommended that you join the http://www.mythtv.org/mailman/listinfo/mythtv-commits/ and http://www.mythtv.org/mailman/listinfo/mythtv-dev/ mailing lists.

If you are in North America you will use the DataDirect grabber which is built-in to MythTV. You do not need to install XMLTV, but you need wget version 1.9.1 or higher.

Get XMLTV from http://xmltv.sourceforge.net. Download the latest version (0.5.34).


NOTE for Mandrake users:  If you have added a "PLF" mirror, you may skip the
next step and type:

# urpmi libmp3lame0 libmp3lame0-devel

NOTE for Red Hat users: If you are installing with apt or yum, you may skip
this step, it will be taken care of. Otherwise get lame and lame-devel from
<url url="http://ATrpms.net/name/lame/" name="http://ATrpms.net/name/lame/">.

After downloading, be sure to install both:
# rpm -Uvh lame*

Get lame from http://lame.sourceforge.net/. Download the source code to v3.93.1 by following the links from "About".

5.1 Notes on compiling on a system with non-Intel processors

If you've got a system with an AMD K6-2 or a VIA C3 processor, make the following change in the settings.pro file.

Look for

-march=pentiumpro
and replace it with
-march=i586
before you compile.

Recent AMD processors, like the Duron, Thunderbird and Athlon don't need this change.

If you have an AMD64, look for

-march=pentiumpro
and replace it with
-march=opteron
before you compile.

5.2 Building LAME

Open a shell and switch to the directory where you saved lame.

$ tar -xzf lame-3.93.1.tar.gz
$ cd lame-3.93.1
$ ./configure
$ make
$ make test
$ su
# make install
Check that it worked:
# ls -l /usr/local/lib
-rw-r--r--    1 root     root       381706 Nov  4 14:22 libmp3lame.a
-rwxr-xr-x    1 root     root          674 Nov  4 14:22 libmp3lame.la*
lrwxrwxrwx    1 root     root           19 Nov  4 14:22 libmp3lame.so ->
libmp3lame.so.0.0.0*
lrwxrwxrwx    1 root     root           19 Nov  4 14:22 libmp3lame.so.0 ->
libmp3lame.so.0.0.0*
-rwxr-xr-x    1 root     root       360197 Nov  4 14:22
libmp3lame.so.0.0.0*

# exit
$ 

5.3 XMLTV

Red Hat Linux and Fedora Core:

RPMs for XMLTV and all of its dependencies can be obtained from http://ATrpms.net/name/xmltv/. The web page has a list of all the dependent packages you must download and install.

# rpm -Uvh xmltv* perl*

If you install from this location you may skip to Manually building MythTV.

Mandrake

RPMs for XMLTV and all of its dependencies are located in Mandrake's "contrib". If you have added a contrib mirror, try installing XMLTV:

# urpmi xmltv xmltv-grabbers
If this does not work, it is possible that contrib for your Mandrake version does not have XMLTV, so you may install the XMLTV prerequisites by typing:
# urpmi perl-xml-twig perl-xml-writer perl-datemanip perl-libwww-perl

and skip straight to the XMLTV compilation step.

Manual installation

Untar the xmltv file:

$ tar -xjf xmltv-0.5.34.tar.bz2
Install the xmltv prerequisites. The following prerequisites are the minimum required; when you actually start running the xmltv setup program it may alert you to other modules that are required.:

$ su
# perl -MCPAN -e shell
cpan> install XML::Twig
cpan> install Date::Manip
Date::Manip is up to date.
cpan> install LWP
cpan> install XML::Writer
cpan> exit

Change to the XMLTV directory and compile it:

$ cd xmltv-0.5.34
$ perl Makefile.PL
You can answer "N" to the tv_check, tv_pick_cgi questions. Say "yes" to the grabber required for your location.

You may get errors about modules not being installed. You will need to resolve any missing dependencies at this point, or your grabber may not work correctly.

$ make
$ make test
$ su
# make install
# exit

5.4 Configuring the Zap2It.com DataDirect service

Introduction

Zap2It DataDirect is a service provided by Zap2It, a subsidiary of Tribune Media Services. TMS is one of the primary providers for program listing data in the United States and Canada. There are a number of advantages to using DataDirect rather than the standard XMLTV tv_grab_na grabber.

If you wish to use Zap2It DataDirect, you'll need to establish a user account. Go to http://labs.zap2it.com and click on the "New User? Sign Up" link. Read the license terms, and if you agree with them click "Accept". The next screen is the subscription registration. In the "Certificate Code" field, enter ZIYN-DQZO-SBUT.

Fill in the survey, then proceed to the lineup choices and configure your account for your particular location and the channels that you have. This configuration will be imported into MythTV when you first run the setup program.

See the section called Migrating from XMLTV to DataDirect for instructions on moving to to DataDirect if you are currently using XMLTV. If you are starting from a fresh installation, the simplest thing is to immediately start using DataDirect.

5.5 Manually building MythTV

Unpack MythTV

$ tar -xjf mythtv-0.16.tar.bz2
$ cd mythtv-0.16
$ ./configure

On a single cpu machine, you would type the following to compile MythTV:

$ qmake mythtv.pro
$ make

If you want to build MythTV on a multi-CPU machine (or with distcc), you may run into issues with the standard build in MythTV. The easiest solution is to build the libraries first. In the following example, we will have two concurrent jobs executing. Do not set the number of jobs too high, or your compile will actually take longer to complete than it would if you did a "normal" build.

$ qmake mythtv.pro
$ make qmake
$ make -C libs/libavcodec -j2
$ make -C libs/libavformat -j2
$ make -C libs/libmyth -j2 
$ make -C libs/libmythtv -j2
$ make -C libs -j2
$ make -j2

If you are using distcc, and you had two other host machines (red, blue) participating, you would do something like:

$ export DISTCC_HOSTS='localhost red blue'
$ qmake mythtv.pro
$ make qmake
$ make -C libs/libavcodec -j6 CC=distcc
$ make -C libs/libavformat -j6 CC=distcc
$ make -C libs/libmyth -j6 CXX=distcc
$ make -C libs/libmythtv -j6 CXX=distcc
$ make -C libs -j6 CXX=distcc
$ make -j6 CXX=distcc

Explicitly specifying the directories ensures that make has all dependencies satisfied before proceeding. For example, libmyth may fail to compile if libavformat hasn't finished yet.

The actual speed-up, if any, is dependant on a number of factors, such as number of CPUs / hosts, etc. The distcc documentation recommends using a -j value of twice the number of CPUs available to keep all of them busy.

Some timing information. The following should only be used for illustration; your actual results may vary. The test involves a complete make distclean to the final binary.

In the above example, we see that with a single CPU, a multi-stage make does not decrease compile time.

Once the compile is done, switch to superuser:

$ su
# make install
# exit

NOTE: subsequent configuration steps assume that you are within the MythTV directory that you cd'd to above.

Enabling real-time scheduling of the display thread.

MythTV supports real-time scheduling of the video output thread if it is installed SUID root.

This is an optional, but recommended step, if you understand the potential negative impact. As a positive, It can make the video display more smoothly, especially if you are decoding HDTV.

NOTE: Please note that this opens a security hole in your system.

If the tradeoff is acceptable:

$ su 
# chmod a+s /usr/local/bin/mythfrontend
# exit
$

NOTE: Making this change will affect your ability to run mythfrontend within gdb for debugging purposes. If you need to debug, you will need to run as root.

Frontend-only configuration

Since MythTV uses a client/server architecture, multiple frontend computers can simultaneously access content on a Myth system. Live TV, watching and scheduling recordings, etc. are all possible from multiple frontends.

To get a better picture of what is needed to run a frontend, note the following:

  • You do NOT need the MySQL server installed on your remote frontend
  • You do NOT need XMLTV installed on your remote frontend
  • You do NOT need to run the MythTV setup program on your frontend machine
  • Other than the exclusion of the MySQL server and XMLTV, the MythTV compilation procedure is the same as when you're setting up both a backend and a frontend. However, you will need to install the database access libraries.

    Once MythTV is compiled and installed, you must change your /usr/local/share/mythtv/mysql.txt or ~/.mythtv/mysql.txt file's "DBHostName" field to point to your Master backend's IP address.

    Run the MythTV setup program on your Master backend. Under the "General" menu, change the IP address of the current machine (by default, "127.0.0.1") to the real external IP address - 127.0.0.1 is the loopback address and no external machine can access it. Change the Master Server IP setting to the same IP address as well.

    5.6 Gentoo

    Installation of MythTV on Gentoo consists of simply emerging the desired ebuild because all of the packages are now part of the official Portage tree.

    $ su -
    # emerge --sync # make sure portage is up to date.
    # vi /etc/make.conf
    
    Add mysql to your USE variable. i.e. USE="mysql ...."
    # emerge mythtv
    


    Next Previous Contents