Compiling XBMC with CEC and AirPlay support

I’m using XBMC for my HTPC. This package can be easily installed through apt and then works right out of the box. But because I hate doing the same like everybody else and wanted some special features, I decided to compile XBMC myself. After executing the following commands on Ubuntu 12.10, you’ll have a working XBMC with CEC and AirPlay support. So grab your TV-remote and start streaming some movies from your Mac!

Packages for XBMC

aptitude install -y git-core build-essential gawk pmount libtool nasm yasm automake cmake gperf zip unzip bison libsdl- dev libsdl-image1.2-dev libsdl-gfx1.2-dev libsdl-mixer1.2-dev libfribidi-dev liblzo2-dev libfreetype6-dev libsqlite3-  dev libogg-dev libasound2-dev python-sqlite libglew-dev libcurl3 libcurl4-gnutls-dev libxrandr-dev libxrender-dev   libmad0-dev libogg-dev libvorbisenc2 libsmbclient-dev libmysqlclient-dev libpcre3-dev libdbus-1-dev libhal-dev libhal-  storage-dev libjasper-dev libfontconfig-dev libbz2-dev libboost-dev libenca-dev libxt-dev libxmu-dev libpng-dev libjpeg -dev libpulse-dev mesa-utils libcdio-dev libsamplerate-dev libmpeg3-dev libflac-dev libiso9660-dev libass-dev libssl-  dev fp-compiler gdc libmpeg2-4-dev libmicrohttpd-dev libmodplug-dev libssh-dev gettext cvs python-dev libyajl-dev   libboost-thread-dev libplist-dev libusb-dev libudev-dev libtinyxml-dev libcap-dev curl swig default-jre

## Extra for >= 10.10:
aptitude install -y autopoint libltdl-dev

## Extra for >= 12.10
aptitude install -y libtag1-dev

## Extra for XBMC, couldn't compile without
aptitude install -y libtiff-dev

## Airplay dependencies
aptitude install -y avahi-daemon libshairport1 libshairport-dev

## LibCEC dependencies
aptitude install -y liblockdev1 liblockdev1-dev autoconf pkg-config

## Compiling LibCEC
git clone git://github.com/Pulse-Eight/libcec.git .libcec
cd .libcec/
./bootstrap
./configure --prefix=/usr/local
make -j2
make install
cd ../

## Downloading and compiling XBMC
git clone git://github.com/xbmc/xbmc.git .xbmc
cd .xbmc/
./bootstrap
./configure --enable-vaapi --enable-libcec=yes --prefix=/usr/local --enable-avahi --enable-airplay --enable-airtunes
make -j2
make install

XBMC init script

To make starting and stopping XBMC a bit easier, use the init-script beneath. Save it to /etc/init.d/xbmc, make it executable and run update-rc.d xbmc defaults to start XBMC on boot.

#! /bin/sh

### BEGIN INIT INFO
# Provides:          xbmc
# Required-Start:    $all
# Required-Stop:     $all
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: starts instance of XBMC
# Description:       starts instance of XBMC using start-stop-daemon and xinit
### END INIT INFO

############### EDIT ME ##################

# path to xinit exec
DAEMON=/usr/bin/xinit

# startup args
#DAEMON_OPTS=" /usr/bin/xbmc --standalone -- :0"
#DAEMON_OPTS=" /usr/bin/xbmc-standalone -- :0"
DAEMON_OPTS=" /usr/local/bin/xbmc-standalone"

# script name
NAME=xbmc

# app name
DESC=XBMC

# user
RUN_AS=xbmc ## Change to the user that runs xbmc

# Path of the PID file
PID_FILE=/var/run/xbmc.pid

############### END EDIT ME ##################

test -x $DAEMON || exit 0

set -e

case "$1" in
  start)
        echo "Starting $DESC"
        start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON --   $DAEMON_OPTS
        ;;
  stop)
        echo "Stopping $DESC"
        start-stop-daemon --stop --pidfile $PID_FILE
        ;;

  restart|force-reload)
        echo "Restarting $DESC"
        start-stop-daemon --stop --pidfile $PID_FILE
        sleep 5
        start-stop-daemon --start -c $RUN_AS --background --pidfile $PID_FILE  --make-pidfile --exec $DAEMON --   $DAEMON_OPTS
        ;;
  *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload}" >&2
        exit 1
        ;;
esac

exit 0
comments powered by Disqus