From MythTV Official Wiki
Revision as of 15:38, 8 January 2010 by GBee (talk | contribs)

Jump to: navigation, search

This spec is for building MythTV RPM packages from a subversion checkout. It should be used along with the shell script included at the bottom of this page.

Both of these ( the mentioned shell script, and the .spec file) are now primarily located in the subversion repository, and thus the latest version is available for download from this link: The version/s shown below may be "older", and should not be considered the "definitive source". edits made below may be lost.

This will presumably work with any version of fedora from version 5 onward, and expects that you are pulling your packages from livna/rpmfusion. If you use ATrpms, you will probably need to rename a couple of the dependencies to compensate for their different naming scheme.

Please read the documentation at the top of the file before using it.


# Script for building MythTV packages from an SVN checkout.
# by:   Chris Petersen <>
# The latest version of this file can be found at:
# This file is intended to be sourced into bash with the "." command,
# not just run directly on the command line.  If you just run this as
# ./ you will not load the installmyth function into your
# environment, and will be unable to install packages should you choose
# to put off doing so immediately after compiling.
# Please make sure that the rpm build parameters are to your liking (a
# number of plugins are disabled by default/example in this script to
# show you that the spec is capable of compiling only those plugins that
# you wish to install).  The same goes for the installmyth function,
# which only installs those packages which I personally use.
# I will eventually clean up this script to add parameters and make it
# a little easier to configure/use.

# A function to build mythtv
    function buildmyth {
    # Remove the existing libmyth-devel so it doesn't confuse qmake
    # (we can't override the order of the include file path)
        echo "Removing existing libmyth-devel package to avoid conflicts"
        sudo rpm -e libmyth-devel
    # Check out or update the svn checkout
        if [ -d "$DIR" ]; then
            if [ -z "$REV" -o 0"$REV" -lt 1 ]; then
                echo "Updating svn checkout"
                REL=`svn up "$DIR"`
                echo "Updating svn checkout to r$REV"
                REL=`svn up -r "$REV" "$DIR"`
            if [ -z "$REV" -o 0"$REV" -lt 1 ]; then
                echo "Checking out mythtv-svn to $DIR"
                REL=`svn co "$DIR"`
                echo "Checking out mythtv-svn r$REV to $DIR"
                REL=`svn co -r "$REV" "$DIR"`
        if [ $? != 0 ]; then
            echo "Problem with svn checkout"
            return $?
        REL=`echo "$REL" | grep -i revision | sed -e 's/[^0-9]\\+//g'`
        echo "SVN Revision $REL"
    # Update SPEC
        echo "Update specfile _svnver to r$REL"
        sed -i \
            -e "s,define _svnrev .\+,define _svnrev r$REL," \
            -e "s,define branch .\+,define branch trunk,"   \
            -e "s,Version:.\+,Version: $VERSION,"           \
    # Create the appropriate tarballs
        echo "Creating tarballs"
        cd "$DIR"
        for file in mythtv mythplugins; do
            mv "$file" "$file-$VERSION"
            tar jcf /usr/src/redhat/SOURCES/mythtv/$file-$VERSION.tar.bz2 --exclude .svn "$file-$VERSION"
            mv "$file-$VERSION" "$file"
        cd -
    # Build
#            --with debug            \
        rpmbuild -bb /usr/src/redhat/SPECS/mythtv-svn.spec \
            --without mytharchive   \
            --without mythflix      \
            --without mythgallery   \
            --without mythcontrols  \
            --without mythgame      \
            --without mythphone     \
            --without mythbrowser   \
            --without mythmovies    \
            --without mythnews      \
            --without mythzoneminder
    # Error?
        if [ "$?" -ne 0 ]; then
            echo "Build error."
    # Install
        echo -n "Install r$REL? [n] "
        read INST
        if [ "$INST" = "y" -o "$INST" = "Y" -o "$INST" = "yes" ]; then
            installmyth "$VERSION" "$REL"
            echo "If you wish to install later, just run: installmyth \"$VERSION\" \"$REL\""

# A separate function to install mythtv packages, so it can be called separately
    function installmyth {
        sudo rpm -Uvh --force                                                            \
            /usr/src/redhat/RPMS/x86_64/mythtv-docs-$VERSION-0.1.svn.r$REL.*.rpm         \
            /usr/src/redhat/RPMS/x86_64/libmyth-$VERSION-0.1.svn.r$REL.*.rpm             \
            /usr/src/redhat/RPMS/x86_64/libmyth-devel-$VERSION-0.1.svn.r$REL.*.rpm       \
            /usr/src/redhat/RPMS/x86_64/mythtv-base-themes-$VERSION-0.1.svn.r$REL.*.rpm  \
            /usr/src/redhat/RPMS/x86_64/mythtv-frontend-$VERSION-0.1.svn.r$REL.*.rpm     \
            /usr/src/redhat/RPMS/x86_64/mythtv-backend-$VERSION-0.1.svn.r$REL.*.rpm      \
            /usr/src/redhat/RPMS/x86_64/mythtv-setup-$VERSION-0.1.svn.r$REL.*.rpm        \
            /usr/src/redhat/RPMS/x86_64/mythtv-common-$VERSION-0.1.svn.r$REL.*.rpm       \
            /usr/src/redhat/RPMS/x86_64/perl-MythTV-$VERSION-0.1.svn.r$REL.*.rpm         \
            /usr/src/redhat/RPMS/x86_64/python-MythTV-$VERSION-0.1.svn.r$REL.*.rpm       \
            /usr/src/redhat/RPMS/x86_64/mythmusic-$VERSION-0.1.svn.r$REL.*.rpm           \
            /usr/src/redhat/RPMS/x86_64/mythvideo-$VERSION-0.1.svn.r$REL.*.rpm           \
            /usr/src/redhat/RPMS/x86_64/mythweather-$VERSION-0.1.svn.r$REL.*.rpm         \

# Actually build the packages.