Cross-compiling swfdec over DirectFB

This guide tries to explain how to cross-compile the OSS Flash player Swfdec for DirectFB.
This procedure is somehow experimental since it uses Swfdec and Swfdec-directfb from their git repositories. These are not stable releases, they were git-cloned the 22/01/08.

It assumes you already have the following packages installed:

  • DirectFB-1.0.1
  • glib-2.14.4
  • atk-1.20.0
  • freetype-2.3.5
  • fontconfig-2.5.0
  • zlib-1.2.3
  • pixman from git repository 02/01/08
  • cairo from git repository 02/01/08
  • pango-1.19.2
  • libmad-0.15.1b
  • liboil-0.3.12
  • libsoup-2.1.13

For a guide on how to compile stables releases of the above packages you can check the GTK+ on DirectFB and Swfdec on DirectFB.

Notice that if your root NFS filesystem is /opt/STM/STLinux-2.2/devkit/sh4/target and you installed all the above packages including Swfdec in /opt/STM/STLinux-2.2/devkit/sh4/target/usr/local, you have to decompress and compile swfdec-directfb inside /opt/STM/STLinux-2.2/devkit/sh4/target/usr/local.

Let’s start with Swfdec

Set the following environment variables:

$ export PREFIX=/opt/STM/STLinux-2.2/devkit/sh4/target/usr/local
$ export LD_LIBRARY_PATH=$PREFIX/lib
$ export PKG_CONFIG_PATH=$LD_LIBRARY_PATH/pkgconfig
$ export COMPILER=sh4-linux-gcc
$ export STRIP=sh4-linux-strip
$ export HOST=sh4-linux
$ export BUILD=i386-linux

Configure:

$ PANGO_CFLAGS="-I$PREFIX/include/pango-1.0 
  -I$PREFIX/include/glib-2.0 
  -I$PREFIX/lib/glib-2.0/include" 
  PANGO_LIBS="-L$PREFIX/lib 
  -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0" 
  HTTP_CFLAGS="-I$PREFIX/include/libsoup-2.2 
  -I$PREFIX/include/libxml2 
  -I$PREFIX/include/glib-2.0 
  -I$PREFIX/lib/glib-2.0/include" 
  HTTP_LIBS="-L$PREFIX/lib 
  -lsoup-2.2 -lxml2 -lglib-2.0" 
  CC=$COMPILER 
  ./autogen.sh 
  --build=$BUILD 
  --host=$HOST 
  --prefix=$PREFIX 
  --disable-gstreamer 
  --disable-ffmpeg 
  --enable-mad 
  --with-audio=none 
  --disable-vivified 
  --disable-gtk

Edit all Makefiles:
Remove the flag -Werror from the variable GLOBAL_CFLAGS

Edit the Makefile:
Remove the directory test from the variable SUBDIRS

Edit tools/Makefile:

Set the LIBS variable to the following value:

LIBS = -lfontconfig -lpangoft2-1.0 -lpangocairo-1.0 -lpango-1.0 -lcairo -ldirectfb -ldirect -lfusion

Compile and install:

$ make
$ make install

Now, we configure and compile swfdec-directfb:

Configure:

$ SWFDEC_CFLAGS="-D_REENTRANT 
  -I$PREFIX/include/swfdec-0.5 
  -I$PREFIX/include/glib-2.0 
  -I$PREFIX/lib/glib-2.0/include 
  -I$PREFIX/include/liboil-0.3 
  -I$PREFIX/include/cairo 
  -I$PREFIX/include/pango-1.0 
  -I$PREFIX/include/freetype2 
  -I$PREFIX/include 
  -I$PREFIX/include/directfb 
  -I$PREFIX/include/libpng12 
  -I$PREFIX/include/pixman-1" 
  SWFDEC_LIBS="-L$PREFIX/lib 
  -lswfdec-0.5 -loil-0.3 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo 
  -lgobject-2.0 -lgmodule-2.0 -ldl -lglib-2.0" 
  CC=$COMPILER 
  ./configure 
  --build=$BUILD 
  --host=$HOST 
  --prefix=$PREFIX

Edit player/Makefile, swfdec-directfb/Makefile and test/Makefile:
Add to the LIBS variable the following value:

LIBS = -lfontconfig

Compile and install:

$ make
$ make install

For executing swfdec-directfb, connect to your board:

$ cd /usr/local/swfdec-directfb/player
$ ./swfdec-directfb-player sample.swf

That’s it.

Happy new year 2008

Let’s hope this new year we can have more time for our open source projects.

I want to try several things with DirectFB on my Neo1973!

Have a nice 2008!

OpenMoko Neo1973

I just updated my Neo1973 with a new rootfs image (from 2007-12-25) and now I’m able to receive and make calls! I have problems with the audio that it used to work with the previous image, I can’t hear any sound from the media player nor from the stylus when gets in contact with the touchscreen. I still have a lot to test since I haven’t had time to play enough with it. I want to try the bluetooth connection, but the OpenMoko projects don’t seem updated… DirectFB will be another nice thing to try.