Compile from source

This guide will help you to build OpenELEC.

First of all, you need to have a recent Linux distribution (Fedora 15/16, Ubuntu 11.04/11.10/12.04, ARCH Linux, SuSE Linux) and at least 12 GB of free space.

Tools you'll need
Start by updating your system (on Ubuntu or other Debian-based distribution):

Note: Debian does not need "sudo" however the commands are identical once sudo is removed

sudo apt-get update

sudo apt-get upgrade

Reconfigure to bash so we have best possible script compatibility

sudo dpkg-reconfigure dash and select no, to install bash as the default

Then, install build tools

Ubuntu 13.04 +
you will also need qt4 tools as gt5 is now the default sudo apt-get install qt4-dev-tools libqt4-dev libqt4-core

Ubuntu 12.04
sudo apt-get install build-essential automake gawk git texinfo gperf cvs xsltproc libncurses5-dev libxml-parser-perl unzip \ zip xfonts-utils wget or, optionally sudo apt-get install g++ nasm flex bison gawk autopoint gperf autoconf automake m4 cvs libtool byacc \ texinfo gettext zlib1g-dev libncurses5-dev git-core build-essential xsltproc libexpat1-dev unzip zip xfonts-utils wget \ libsdl-image1.2 liblzo2-2 swig If you use the long and winding command line above, install the perl module as described below.

Installing Java: Oracle JDK7 has been removed from the official Ubuntu repositories because that's not allowed by the new Oracle Java license. The package in the following PPA automatically downloads (and installs) Oracle Java JDK 7 from its official website:

sudo apt-get install python-software-properties sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java7-installer

Ubuntu 10.04
Ubuntu 10.04 is not supported

Debian 6
apt-get install build-essential automake gawk git texinfo gperf cvs xsltproc libncurses5-dev libxml-parser-perl unzip zip \ xfonts-utils wget

A current Debian specific quirk in the installer requires you to install sudo

apt-get install sudo

Installing sudo will allow the build process to run however you will either need to run as root or modify the sudoers file if you would prefer not to compile as the root user.

Perl XML::Parser
And to finish, configure Perl and install XML::Parser :

sudo perl -e shell -MCPAN Answer by yes at the question

and at the command prompt launch

install XML::Parser

and finally

exit

Download OpenELEC from Github
git clone https://github.com/OpenELEC/OpenELEC.tv.git A new folder called OpenELEC.tv will be created.

Start compiling
Be sure to have lot of free space - at least 12 GB. Better more than less.

In a terminal go to the folder that was just created cd OpenELEC.tv

Then, to build: PROJECT=ION ARCH=i386 make release to build OpenELEC for ION x86 32 bits.

or e.g. PROJECT=Fusion ARCH=x86_64 make release to build OpenELEC for Fusion x86 64 bits

Take a break!

When the build completes, you will find the fresh build in the target directory of your build directory (the OpenELEC.tv dir)

If you need to clean and start over do the following make clean

and then start the build process again.

Compile with Custom XBMC Branch
Start with pulling a fresh git where you can play around without breaking anything:

git clone git://github.com/OpenELEC/OpenELEC.tv.git sometest

Now you need to pull the branch you want to test into a tarball:

cd sometest/tools/mkpkg/

Create the frodo source tarballs

Append the following to the end of the mkpkg_xbmc script. This code will move the tar balls to the sources directory and generate the md5 & url files

echo "copying tar balls to sources..." if [ ! -d ../../sources/ ]; then mkdir ../../sources/ fi   if [ ! -d ../../sources/$PKG_NAME/ ]; then mkdir ../../sources/$PKG_NAME/ fi   if [ ! -d ../../sources/$PKG_NAME-theme-Confluence/ ]; then mkdir ../../sources/$PKG_NAME-theme-Confluence/ fi   mv $PKG_NAME-$PKG_VERSION.tar.xz ../../sources/$PKG_NAME/ mv $PKG_NAME-theme-Confluence-$PKG_VERSION.tar.xz ../../sources/$PKG_NAME-theme-Confluence/ echo "generate md5 and url files..." cd ../.. md5sum sources/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.xz > sources/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.xz.md5 md5sum sources/$PKG_NAME-theme-Confluence/$PKG_NAME-theme-Confluence-$PKG_VERSION.tar.xz > sources/$PKG_NAME-theme-Confluence/$PKG_NAME-theme-Confluence-$PKG_VERSION.tar.xz.md5 echo " http://sources.openelec.tv/devel/$PKG_NAME-$PKG_VERSION.tar.xz" > sources/$PKG_NAME/$PKG_NAME-$PKG_VERSION.tar.xz.url echo " http://sources.openelec.tv/devel/$PKG_NAME-theme-Confluence-$PKG_VERSION.tar.xz" > sources/$PKG_NAME-theme-Confluence/$PKG_NAME-theme-Confluence-$PKG_VERSION.tar.xz.url echo "Source tar balls generated for $PKG_NAME PKG_VERSION=$PKG_VERSION successfully."

Run the script:

./mkpkg_xbmc

This will create the source tar balls, move the tar balls to the sources directory and generate the md5 & url files.

Source tar balls generated for xbmc and xbmc-theme-Confluence PKG_VERSION=5481657 successfully.

Apply any patches required from the Patches Section below

None

Now you are ready to try to build. Go back to "sometest" and build with frodo:

PROJECT=Generic ARCH=i386 make release

Possible values for PROJECT are ATV, Fusion, Generic, Generic_OSS, Intel, ION, Ultra and Virtual. ARCH can be arm, i386 or x86_64. Default values are bolded.

And now?
Dont forget to install your new or update your previous OpenELEC system with the new build, otherwise you cant enjoy your changes!