Projects/Mobile/MADDE

From KDE TechBase
Revision as of 10:20, 30 June 2011 by Neverendingo (talk | contribs) (Text replace - "<syntaxhighlight lang="make">" to "<syntaxhighlight lang="cmake">")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Building KDE for the N900 with the MADDE toolchain

Warning
This is pretty much work in progress


Get MADDE: http://wiki.maemo.org/MADDE

If you MADDE doesn't have Qt 4.6 support, get it from http://chaos.troll.no/~harald/MADDE

Note that you also need to symlink Qt from your sysroot to your /opt host directory. This is ugly, and will vanish once MADDE gets full Qt 4.6 support:

cd /opt/qt4-maemo5
sudo ln -s $HOME/.madde/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/opt/qt4-maemo5/lib .
sudo ln -s $HOME/.madde/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453/opt/qt4-maemo5/include .

CMake

CMake got cross-compiling support in version 2.6. Note that CMake currently can't build ARM and x86 binaries at the same time, so anything that needs a bootstrapped tool needs to be compiled twice, once for x86 and once for ARM.

To ease cross-compiling setup, CMake features toolchain files. Here's an example CMake toolchain file that invokes MADDE's gcc directly:

include (CMakeForceCompiler)

set(CMAKE_SYSTEM_NAME Linux)

# set this to wherever MADDE is
set(MADDE_HOME $ENV{HOME}/.madde/0.6.14/targets/fremantle-qt-0951)

CMAKE_FORCE_C_COMPILER(${MADDE_HOME}/bin/gcc GNU)
CMAKE_FORCE_CXX_COMPILER(${MADDE_HOME}/bin/g++ GNU)

set(CMAKE_FIND_ROOT_PATH ${MADDE_HOME})

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

Save this file somewhere, e.g. to toolchain-madde.cmake and pass -DCMAKE_TOOLCHAIN_FILE=$HOME/toolchain-madde.cmake parameter.

Unfortunately, current CMake 2.6 likes to use absolute paths. This won't work well with MADDE, which evaluates absolute paths relative to its sysroot directory. The -DCMAKE_USE_RELATIVE_PATHS=ON CMake flag could help, but seems to have some issues. In the meantime, we use a small hack, by symlinking our home directory into MADDEs sysroot, so all pathes within the MADDE environment will match the ones on our home system:

cd ~/.madde/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453
mkdir home
cd home
ln -s $HOME .

It is assumed that you checked out the kde sources in your $HOME directory, otherwise, adjust the symlink accordingly.

kdelibs

KDElibs has several bootstrapped tools, which need to be compiled for x86. Unfortunately, current CMake doesn't support building them in one go, so we have to do the following:

cd /path/to/kdelibs/sources
mkdir build-x86
cd build-x86
cmake ..
make -C kdecore/kconfig_compiler
make -C kjs icemaker
make -C kdoctools meinproc4

This builds the host tools for x86.

Now, we can do an ARM build:

cd /path/to/kdelibs/sources
mkdir build-arm
cd build-arm
cmake .. -DCMAKE_TOOLCHAIN_FILE=$HOME/toolchain-madde.cmake -DKDE_HOST_TOOLS_PATH=/path/to/kdelibs/sources/bld-x86 ..

adapt the pathes above accordingly.