Summary
=======
WARNING: the building process for required libraries has changed since I originally wrote this doc.
         Now you only have to install the needed packages with "# opkg-target install lib.ipk".


This is the process I used to compile Xournal v0.4.5 for the DR800.
The result is an experimental, bare but working port of the application.
In case anyone is interested in Xournal you should read the DR1000 port thread by Mackx, which also includes customization for the DR1000 and new features such as fast screen refresh.


Iñigo Serna

Revisions:
    3. Included a warning note about changes on the procedures.
       Sat Apr 27 23:18:56 2010
    2. Added info about libart and libgnomecanvas include files.
       Sat Mar 27 14:26:02 2010
    1. Initial release.
       Fri Mar 26 18:51:04 2010



Introduction:
=============
Instead of the canonical Adam B.'s development VMware Image [1], I use my own devel environment instead, a Ubuntu 8.04 i386 VM running inside VirtualBox.
I just kept the instructions in "iOn Development Environment" document [2] and got a perfect DR800S devel env.

[1] http://www.mobileread.com/forums/showthread.php?t=37883
[2] "iOn Development Environment", 27/01/2010, Version Number: 1.9


Requirements:
=============
In order to compile xournal you'll need:
- libart v2.3.20 [1]
- libgnomecanvas v2.26.0 [2]
- poppler v0.10.6 [3]. Important, v0.12.x didn't work for me
- xournal v0.4.5 [4]

Newest version except for poppler.

[1] ftp://ftp.gnome.org/pub/gnome/sources/libart_lgpl/2.3/libart_lgpl-2.3.20.tar.bz2
[2] ftp://ftp.gnome.org/pub/gnome/sources/libgnomecanvas/2.26/libgnomecanvas-2.26.0.tar.bz2
[3] http://cgit.freedesktop.org/poppler/poppler/snapshot/poppler-0.10.6.tar.bz2
[4] http://downloads.sourceforge.net/xournal/xournal-0.4.5.tar.gz


General process:
================
For each needed library I do a compilation and installation into the poky env.
The typical sequence is:
  $ cd ~/tmp
  $ tar xvf path_to/libXXX-y.z.tar.bz2
  $ cd libXXX-y.z
  $ source /usr/local/poky/eabi-glibc/arm/environment-setup
  $ autoreconf --install
  $ ./configure --host=arm-poky-linux-gnueabi --prefix=/usr/local/poky/eaby-glibc/arm/arm-poky-linux-gnueabi/usr
  $ make -j2
  $ sudo bash
  # source /usr/local/poky/eabi-glibc/arm/environment-setup
  # make install-strip
  # exit
  $


libart
------
The libart building process compiles a helper command called "gen_art_config", which is executed during the process.
If we do a cross-compilation like the mentioned above, "gen_art_config" will be an ARM executable, so it won't run on our dev env.
The trick is to compile twice, first a native compilation for the i386 architecture: "./configure" (no --host or --prefix specified).
Once finished (no need to install) copy the generated "gen_art_config" to a safe place, your Desktop for example, and type "make distclean" and then the complete standard "./configure --host..." command. It will fail, of course:

  ./gen_art_config > art_config.h
  /bin/bash: ./gen_art_config: cannot execute binary file
  make: *** [art_config.h] Error 126

Execute that command by hand, but using your safe i386 "gen_art_config":

  $ ~/Desktop/gen_art_config  > art_config.h

It should work now. Then continue with the make and installation.


libgnomecanvas
--------------
If libart include files (*.h) are not found, copy /usr/local/poky/eaby-glibc/arm/arm-poky-linux-gnueabi/usr/include/libart-2.0/libart-lgpl one directory up, to /usr/local/poky/eaby-glibc/arm/arm-poky-linux-gnueabi/usr/include.


poppler
-------
As the DR800 (and eventually next software version of DR1000) doesn't use poppler to show pdf files, it's not installed by default on the new devel env.
We only need poppler-glib, but I we need to compile the whole package.

Configure with:

  $ ./configure --host=arm-poky-linux-gnueabi --prefix=/usr/local/poky/eaby-glibc/arm/arm-poky-linux-gnueabi/usr --disable-utils


xournal
-------
If can't find libgnomecanvas include files (*.h), copy /usr/local/poky/eaby-glibc/arm/arm-poky-linux-gnueabi/usr/include/libgnome-canvas-2.0/libgnomecanvas one directory up, to /usr/local/poky/eaby-glibc/arm/arm-poky-linux-gnueabi/usr/include.

The prefix in configure step is to our target path, not the poky env:

  $ ./configure --host=arm-poky-linux-gnueabi --prefix=/media/mmcblk0p1/Programs/_xournal

Also, you don't need to "sudo bash" to perform the "make install-strip" as this is not a system directory


Installation
============
Copy _xournal in your devel VM /media/mmcblk0p1/Programs directory to /media/mmcblk0p1/Programs/ folder on the DR800 emulator.
And create a file called "launch_xournal.sh" in _xournal/bin with next contents:

  APP_PATH=/media/mmcblk0p1/Programs/_xournal
  export LD_LIBRARY_PATH=$APP_PATH/lib
  exec $APP_PATH/bin/xournal #> $APP_PATH/log.txt 2>&1

and then run it. It will fail with a message regarding some libs missing.
Copy each one from your VM /usr/local/poky/eaby-glibc/arm/arm-poky-linux-gnueabi/usr/lib to /media/mmcblk0p1/Programs/_xournal/lib on your DR800 qemu until it works ;-)
The libs I needed were: libart_lgpl_2.so.2, libgnomecanvas-2.so.0, libpoppler-glib.so.4 and libpoppler.so.4


NOTE: in fact I didn't do last step really. For each lib I do a double compilation & install, first with "./configure --host... --prefix==/usr/local/poky/eaby-glibc/arm/arm-poky-linux-gnueabi/usr" as stated above, and then a second one with "./configure --host... --prefix==/media/mmcblk0p1/Programs/_xournal".
This way I don't need to try & error for each missing library, but the drawback is that I need to clean all the trash installed on the final package (libs include files, documentation, etc).

Random comments:
- for each lib, you have different files with links between them, you only need one (f.e. libgnomecanvas-2.so.0, but not the others)
- as the SD is formatted with FAT32, links won't work, if you copy them it will substitute the link with a full copy


Conclusion
==========
It's not as hard as it looks ;-)
