Building streamlined boxee for Ubuntu Natty


I’ve been using boxee for some time for my home media. As I’ve recently upgraded my box to the pre-release version of Ubuntu (Natty Narval Alpha 2 at the time of writing) I found that the package provided by boxee is both outdated and references packages outdated in the new version of Ubuntu (libxmlrpc-c3 is replaced with libxmlrpc-c3-0) leaving you with broken packages on your box.

Even though it is possible to trick the box to run, there is a huge unresolved problem with the font display. I hoped to solve it by compiling Boxee on the box itself, but even after building it the fonts still were garbled. I still need to investigate what went wrong in it. Unfortunately xbmc shows the same symptoms, so it does not seem to be a boxee-only problem.


Installing the brute-force way

One solution to this is to force the package install with

wget http://dl.boxee.tv/boxee-0.9.22.13692.i486.modfied.deb
sudo dpkg -i --force-all boxee-0.9.22.13692.i486.modfied.deb

and then modifying your /var/lib/dpkg/status using your favorite text editor

sudo nano /var/lib/dpkg/status

and updating the boxee entry to reference the new libxmlrpc-c3-0 instead of libxmlrpc-c3 and libdirectfb-1.2.9 instead of libdirectfb-1.2. This is a dirty hack and one should be ashamed of himself for using it. 😉

Building the package on Maverick
The proper way is of course building a package that runs on your box and changing the required libs as necessary. I’m posting this for anyone who’s trying to roll one for himself. I managed to build the package on Maverick with a few minor tweaks but couldn’t make it work on Natty.

First you must download the boxee sources, configure your build environment and get the required development libs. Best if you try this as root.

sudo su -
cd /usr/src
wget http://dl.boxee.tv/boxee-sources-0.9.23.15885.tar.bz2
tar xjf boxee-sources-0.9.23.15885.tar.bz2
cd boxee-sources-0.9.23.15885/
apt-get install apt-build autoconf automake libtool gettext automake1.10
add-apt-repository ppa:team-xbmc/ppa
apt-get update
apt-get build-dep xbmc
apt-get install libdts-dev liba52-0.7.4-dev

Then configure your build using the build environment. As my install already has the required libraries and python (and even later versions then the ones available in the sources) I prefer to enable all externals instead of using the ones from the environment. As there might be problems with the macro definitions I suggest to set up the configuration with the parameters as suggested in this post.

./bootstrap
autoconf
CPPFLAGS="-DHAVE_LRINTF -I/usr/include/python2.6" 
CXXFLAGS="-D__STDC_CONSTANT_MACROS -I/usr/include/python2.6" 
 ./configure --enable-external-libraries --enable-pulse --enable-xrandr 
 --enable-faac --enable-external-python  --enable-optimizations 
 --enable-goom --disable-debug --prefix=/opt

Before running make however you’d better make some changes to the sources for clean builds. I found some pointers for the changes here. To make the changes you can run the following commands, as I’m not very skilled in using the patch command:

sed "35 i typedef unsigned char uchar;" xbmc/cores/paplayer/DllWAVPack.h 
 > xbmc/cores/paplayer/DllWAVPack.h.new
mv xbmc/cores/paplayer/DllWAVPack.h xbmc/cores/paplayer/DllWAVPack.h.old
mv xbmc/cores/paplayer/DllWAVPack.h.new xbmc/cores/paplayer/DllWAVPack.h

As there seem to be some changes in the ffmpeg lib since the publication of the source, a little tweaking is required in the source itself.

cd xbmc/cores/ffmpeg/
sed 's/av_read_frame_flush/ff_read_frame_flush/' DllAvFormat.h >DllAvFormat.h.new
mv DllAvFormat.h DllAvFormat.h.old
mv DllAvFormat.h.new DllAvFormat.h
cd ../dvdplayer/DVDDemuxers
sed 's/av_read_frame_flush/ff_read_frame_flush/' DVDDemuxFFmpeg.cpp > DVDVDDemuxFFmpeg.cpp.new
mv DVDDemuxFFmpeg.cpp DVDDemuxFFmpeg.cpp.old
mv DVDDemuxFFmpeg.cpp.new DVDDemuxFFmpeg.cpp
cd ../../../..

Remove some non-existing references.

sed "6d;7d;8d" xbmc/cores/paplayer/MACDll/Source/MACLib/APEHeader.cpp 
 >xbmc/cores/paplayer/MACDll/Source/MACLib/APEHeader.cpp.new
mv xbmc/cores/paplayer/MACDll/Source/MACLib/APEHeader.cpp 
 xbmc/cores/paplayer/MACDll/Source/MACLib/APEHeader.cpp.old
mv xbmc/cores/paplayer/MACDll/Source/MACLib/APEHeader.cpp.new 
 xbmc/cores/paplayer/MACDll/Source/MACLib/APEHeader.cpp

Then modify the generated Makefire to include some libs that are missing from autoconf.
Add the line starting with

LIBS=-lpython2.6 ...

and after that add

LIBS+=-lmms -lavformat

Then after the line starting with

OBJSXBMC+= xbmc/app/app.a ...

add

OBJSXBMC+= xbmc/ThreadPolicy.o

If you want more optimization you can find the lines

CFLAGS= -O2
CXXFLAGS=-D__STDC_CONSTANT_MACROS -I/usr/include/python2.6 -O2

and change them to generate more optimized sources with -O3 or higher.

CFLAGS= -O3
CXXFLAGS=-D__STDC_CONSTANT_MACROS -I/usr/include/python2.6 -O3

Then you can compile the sources using several threads (jobs) depending how strong is your computer. As my laptop is ages old I don’t use this option. If you encounter build problems using multiple jobs, try building it without the -j switch, as I heard there may be problems when running it this way.

make

After a successful compilation you might want to install the files directly. You can do so issuing the following.

make install

As for me I want to create a deb package that has the correct dependencies. So I change to the debian directory and edit the control.i486 (or control.x86_64 for 64bit architectures) file as above to reference the correct xmlrpc and libdirectfb lib. Find the line starting with

Depends:

and replace the parts of the line

libxmlrpc-c3

with

libxmlrpc-c3 | libxmlrpc-c3-0

and

libdirectfb-1.2

to

libdirectfb-1.2 | libdirectfb-1.2-9

respectively.

Then just run from the source folder, as advised in the README.ubuntu.

rm skin/boxee/media/Textures.xbt
make -C skin/boxee/media

Before creating the actual package however, one must modify the REV property in the make_debian.sh, as your package won’t be from the (non-public) boxee SVN repo. I suggest you change the line 151 in the file from

REV=`svn info  | grep "Revision:" | sed 's/Revision: //'`

to something else, like

REV=banta

Then you can build the package as advised.

cd debian
./make_debian.sh

to end up with an installable package.

Well I hope it helped. My version of the package is available here.

Building on Natty

The procedure is similar that of the one described above, with some changes that are Natty only.

Before running apt-get update, you must change the repository to point at the maverick repo.

sed 's/natty/maverick/' /etc/apt/sources.list.d/team-xbmc-ppa-natty.list 
 >/etc/apt/sources.list.d/team-xbmc-ppa-natty.list.new; 
 mv /etc/apt/sources.list.d/team-xbmc-ppa-natty.list /etc/apt/sources.list.d/team-xbmc-ppa-natty.list.old; 
 mv /etc/apt/sources.list.d/team-xbmc-ppa-natty.list.new /etc/apt/sources.list.d/team-xbmc-ppa-natty.list

As I learned Natty uses python2.7 instead of 2.6, so if you want to build it on the box with Natty you must install python 2.6 development libs.

apt-get install python2.6-dev

When the libs are installed proceed as above until Makefile modification, where you should add

LIBS += -lssl -lcrypto -lXext  -lmms -lsmbclient

instead of the ones described at Maverick based builds.

You must also find the lines

else
LIBS += xbmc/lib/libsmb/libsmbclient-i486-linux.a

and comment them out.

Disclaimer
Since both machines I used for building the package are quite old and are not made of clean install, I might have some dangling libs you don’t. Should you encounter any problems in the build feel free to contact me with details!

2 thoughts on “Building streamlined boxee for Ubuntu Natty

  1. apt-get build-dep xbmc
    results:

    E: Could not open file /var/lib/apt/lists/ppa.launchpad.net_team-xbmc-svn_ppa_ubuntu_dists_natty_main_source_Sources – open (2: No such file or directory)

    1. Right, some things I might have missed. 🙂
      I built my package on maverick, not natty. If you want to build on natty, you must change the source to maverick, as there is no natty ppa available yet.

      nano /etc/apt/sources.list.d/team-xbmc-ppa-natty.list

      Then change the natty to maverick.
      Don’t forget to run apt-get update after you add a PPA!

      I’ve also updated the article with my experience on building directly on Natty.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.