Projects/Mobile/MADDE: Difference between revisions

From KDE TechBase
m (Text replace - "<code bash>" to "<syntaxhighlight lang="bash">")
Line 9: Line 9:
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:
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:


<code bash>
<syntaxhighlight lang="bash">
cd /opt/qt4-maemo5
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/lib .
Line 43: Line 43:
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 <tt>-DCMAKE_USE_RELATIVE_PATHS=ON</tt> 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:
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 <tt>-DCMAKE_USE_RELATIVE_PATHS=ON</tt> 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:


<code bash>
<syntaxhighlight lang="bash">
cd ~/.madde/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453
cd ~/.madde/0.6.14/sysroots/fremantle-arm-sysroot-2.2009-51-1-qt453
mkdir home
mkdir home
Line 56: Line 56:
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:
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:


<code bash>
<syntaxhighlight lang="bash">
cd /path/to/kdelibs/sources
cd /path/to/kdelibs/sources
mkdir build-x86
mkdir build-x86
Line 70: Line 70:
Now, we can do an ARM build:
Now, we can do an ARM build:


<code bash>
<syntaxhighlight lang="bash">
cd /path/to/kdelibs/sources
cd /path/to/kdelibs/sources
mkdir build-arm
mkdir build-arm

Revision as of 20:42, 29 June 2011

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:

<syntaxhighlight lang="bash"> 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)

  1. 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:

<syntaxhighlight lang="bash"> 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:

<syntaxhighlight lang="bash"> 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:

<syntaxhighlight lang="bash"> 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.