#!/bin/bash
# compile_mythtv.sh
# rev 0.5 - 16June2009
#
# This script will compile and install MythTV
#
pkgver=20975

PKG_MAINTAINER=nharris@eoimaging.com
echo PKG_MAINTAINER is set to $PKG_MAINTAINER

PKG_VER="0.22-svn$pkgver"
echo PKG_VER is set to $PKG_VER

cd mythtv-trunk

#
# compile mythtv
#
echo Compiling mythtv
cd mythtv
make distclean
export QTDIR=/usr/share/qt4
./configure --enable-dvb --disable-xvmc --enable-opengl-vsync --disable-xvmc-pro --enable-proc-opt --enable-vdpau --enable-libfaad --with-bindings=perl,python  --compile-type=release --enable-audio-alsa --disable-audio-jack --disable-audio-arts --prefix=/usr || return 1
qmake mythtv.pro
make || exit 0

#
# install mythtv
#
echo "MythTV 0.22 SVN build" > description-pak
checkinstall -D --default --pkgname mythtv --pkgversion $PKG_VER --maintainer $PKG_MAINTAINER
mv myth*.deb ../..

# install bindings
cd bindings
make || exit 0
make install || exit 0
cd ../..

#
# compile mythplugins
#
echo Compiling mythplugings
cd mythplugins
make distclean
./configure --enable-dvb --disable-xvmc --enable-opengl-vsync --disable-xvmc-pro --enable-proc-opt --enable-vdpau --enable-transcode --enable-vcd --prefix=/usr
qmake mythplugins.pro
make || exit 0

#
# install mythplugins
#
echo "MythTV 0.22 SVN build" > description-pak
checkinstall -D --default --pkgname mythplugins --pkgversion $PKG_VER --maintainer $PKG_MAINTAINER
mv myth*.deb ../..
cd ..

#
# compile myththemes
#
echo Compiling myththemes
cd myththemes
make distclean
./configure --prefix=/usr
qmake myththemes.pro
make || exit 0

#
# install myththemes
#
echo "MythTV 0.22 SVN build" > description-pak
checkinstall -D --default --pkgname myththemes --pkgversion $PKG_VER --maintainer $PKG_MAINTAINER
mv myth*.deb ../..
cd ..

#
# compile additional themes
#
echo Compiling additional themes
cd themes
make distclean
./configure --prefix=/usr
qmake themes.pro
make || exit 0

#
# install additional themes
#
echo "MythTV 0.22 SVN build" > description-pak
checkinstall -D --default --pkgname mythtv-themes --pkgversion $PKG_VER --maintainer $PKG_MAINTAINER
mv myth*.deb ../..
cd ..

#
# update mythweb
#
cd mythplugins/mythweb
cp -R * /var/www/mythweb
cd ../..

echo "DONE!"

