Building and running enigma2

Downloading

You can download the stable and/or the development (FB beta) sources. If you're are developer we recommend you to download the development sources.
Getting the sources

Downloading custom header files

The modified enigma2 for the QBoxHD needs additional header files that you can download from here.
Install the file dvb.v5.tar.gz in the directory /opt/STM/STLinux-2.3/devkit/sh4/target/usr/include/linux:

$ cp dvb.v5.tar.gz /opt/STM/STLinux-2.3/devkit/sh4/target/usr/include/linux
$ cd /opt/STM/STLinux-2.3/devkit/sh4/target/usr/include/linux
$ mv dvb dvb.v3
$ mv dvb.v5 dvb

Environment Configuration

Set the following environment variables that will make our life easier:

$ export BUILD=i386-linux
$ export HOST=sh4-linux
$ export PREFIX=/opt/STM/STLinux-2.3/devkit/sh4/target

Building requirements

Enigma2 needs several packages that are not provided by STLinux23.

For building and installing these requirements, not enigma2 itself, you can follow the procedure detailed here

STLinux23 provides DirectFB, but not it's C++ API called DFB++. Download it from here. And install it in a similar way as the previous packages.

Several enigma2 plug-ins need Python 2.6, but STLinux23 provides only Python 2.5. Thus, after installing all the requirements above you need to upgrade to Python 2.6.

Upgrading to Python 2.6

Python 2.6.1 must be natively compiled in the target. This means you need a QBoxHD. Follow the standard procedure for installing Python, it builds cleanly.
Install it in /opt/STM/STLinux-2.3/devkit/sh4/target/usr/local Once it's compiled, the following Python packages must be built natively, too. For some of these packages you can follow the procedure detailed here

  • zope.interface-3.3.0
  • Twisted-8.2.0
  • Twistedweb2-8.1.0
  • hashlib-20081119
  • pyOpenSSL-0.8
  • setuptools-0.6c9
  • mechanize-0.1.11
  • Beautifulsoup-3.1.0.1

Installing SWIG 1.3.33

Enigma2 needs SWIG for generating the glue code between C++ and Python.
It's possible that you already have SWIG installed in your host. If this is the case, check which version you have (check /usr/share/swig/<version>) and if it's newer than the 1.3.33 make a copy of the executable that is in /usr/bin/swig (in Fedora hosts).

Download SWIG 1.3.33 source code and install.
Notice that you only need the swig executable inside /usr/bin/ and it's share directory in /usr/share/swig/1.3.33

Building enigma2

Change to the local copy of the enigma2 repository that you just downloaded:

$ cd enigma2

Generate the configure and Makefiles:

$ ./autogen.sh

Edit the configure file.
After the PYTHON_VERSION=$am_cv_python_version assignation set the var PYTHON_VERSION to the Python version in the target:

PYTHON_VERSION=2.6

Before the following comment, set the variable PYTHON_FLAGS and substitute the var name CPPFLAGS by PYTHON_FLAGS inside the for() block:

PYTHON_FLAGS="-I/opt/STM/STLinux-2.3/devkit/sh4/target/usr/local/include"

# should allow for checking of python version here...

Before the following comment, set the variable PYTHON_FLAGS and substitute the var name LDFLAGS by PYTHON_FLAGS inside the for() block:

PYTHON_FLAGS="-L/opt/STM/STLinux-2.3/devkit/sh4/target/usr/local/lib/python2.6 \
-L/opt/STM/STLinux-2.3/devkit/sh4/target/usr/local/lib/python2.6/site-packages"

# Check for Python library path

Search the string HAVE_XMLCCWRAP.
After the if() block where it appears for the first time set it to yes:

if test $ac_cv_lib_xmlccwrap_exit = yes; then
  HAVE_XMLCCWRAP="yes"
else
  HAVE_XMLCCWRAP="no"
fi

HAVE_XMLCCWRAP="yes"

Configure:

$ PYTHON=/usr/bin/python \
  FREETYPE_CFLAGS=-I$PREFIX/usr/include/freetype2 \
  FREETYPE_LIBS="-L$PREFIX/usr/lib -lfreetype" \
  MAD_CFLAGS=-I$PREFIX/usr/include \
  MAD_LIBS="-L$PREFIX/usr/lib -lmad" \
  PNG_CFLAGS=-I$PREFIX/usr/include \
  PNG_LIBS="-L$PREFIX/usr/lib -lpng12" \
  XML2_CFLAGS=-I$PREFIX/usr/include/libxml2 \
  XML2_LIBS="-L$PREFIX/usr/lib -lxml2" \
  FRIBIDI_CFLAGS=-I$PREFIX/usr/local/include \
  FRIBIDI_LIBS="-L$PREFIX/usr/local/lib -lfribidi" \
  ID3TAG_CFLAGS=-I$PREFIX/usr/local/include \
  ID3TAG_LIBS="-L$PREFIX/usr/local/lib -lid3" \
  SIGC_CFLAGS="-I$PREFIX/usr/local/include/sigc++-1.2 -I$PREFIX/usr/local/lib/sigc++-1.2/include" \
  SIGC_LIBS="-L$PREFIX/usr/local/lib -lsigc-1.2" \
  DVBSI_CFLAGS=-I$PREFIX/usr/local/include \
  DVBSI_LIBS="-L$PREFIX/usr/local/lib -ldvbsi++" \
  XMLCCWRAP_LIBS="-L$PREFIX/usr/local/lib -lxmlccwrap" \
  DFBCXX_CFLAGS="-I$PREFIX/usr/include/dfb++" \
  DFBCXX_LIBS="-L$PREFIX/usr/lib -ldfb++" \
  DFB_CFLAGS="-I$PREFIX/usr/include/directfb" \
  DFB_LIBS="-L$PREFIX/usr/lib" \
  ./configure \
  --build=$BUILD \
  --host=$HOST \
  --prefix=$PREFIX/usr/local \
  --exec_prefix=$PREFIX/usr/local  \
  --bindir=$PREFIX/usr/local/bin  \
  --sbindir=$PREFIX/usr/local/sbin \
  --libexecdir=$PREFIX/usr/local/libexec  \
  --datadir=$PREFIX/usr/local/share  \
  --sysconfdir=$PREFIX/local/etc \
  --sharedstatedir=$PREFIX/usr/local/com  \
  --localstatedir=$PREFIX/local/var  \
  --libdir=$PREFIX/usr/local/lib \
  --includedir=$PREFIX/usr/local/include  \
  --oldincludedir=$PREFIX/usr/local/include \
  --infodir=$PREFIX/usr/local/share/info  \
  --mandir=$PREFIX/usr/local/share/man \
  --with-target=native \
  --with-libsdl=no

Edit the file tools/Makefile (needed if you're not as root).
Development version: This step is NOT needed.
Comment at the end of the file the line:

$(INSTALL) libopen.so.0.0 $(DESTDIR)/usr/lib

Edit the file lib/dvb/Makefile.
Development version: This step is NOT needed.
Add the following value to the CPPFLAGS variable:

-I/opt/STM/STLinux-2.3/devkit/sources/kernel/linux-sh4/include

If you want to copy automatically the resulting executable to the rootfs you can add the following line to the file main/Makefile:
This is only needed if you have the QBoxHD rootfs mounted via NFS.

all: all-am
    cp enigma2 /opt/STM/STLinux-2.3/devkit/sh4/target/usr/local/bin/enigma2

Compile and install:

$ make
$ make install

At this point you should end up with the following enigma2 files/directories:

  • The executable in /opt/STM/STLinux-2.3/devkit/sh4/target/usr/local/bin
  • The libraries in /opt/STM/STLinux-2.3/devkit/sh4/target/usr/local/lib/enigma2
  • The data in /opt/STM/STLinux-2.3/devkit/sh4/target/usr/local/share/enigma2

You can copy the executable via FTP to the QBoxHD in the directory /usr/local/bin.

If you modified Python scripts you will need to copy them to the QBoxHD in the directory /usr/local/lib/enigma2/python.

If you modified XML files or images you will need to copy them to the QBoxHD in the directory /usr/local/share/enigma2.