Preliminary
First you need to retrieve owb sources. Then create a build directory in the sources root directory.
Then you have 2 choices to run cmake configuration utility, either ccmake which is a curses interface or cmake which is pure command line. The second solution involves that you know the project and its possible option or that default options fit your requirements.
As an example, to run cmake and force embedded fonts subsytem instead of freetype default one's, do:
cmake -D WEBKIT_USE_FONTS="EMBEDDED" ..
About ccmake, that's a very intuitive curses interface. The only thing to know is that to change a boolean option, simply type Enter and to modify other options, type Enter then you can manually edit text field and re-type Enter to validate.
After cmake step, simply do make to compile the project.
Available options
With Robespierre2 post merge version, cmake option system has changed. From now, some boolean options are deprecated because this may lead to link problems when settings some similar options. I mean for instance, when you were trying to enable 2 fonts rendering subsystem.
Below a list of options and their meaning:
- BUILD_SHARED_LIBS:
This option is enabled (ON) by default. This will build owb and its webkit dependencies as shared libraries. So you will have the following libraries in your build directory:
libbal.so libjscore.so libwebcore-owb.so owb
When disabling this option (OFF), you will get a huge statically linked owb executable.
- N800_BUILD:
This option is by default disabled (OFF). If you do not target to compile owb for a Nokia N800, this option is useless for you, else set this option to ON.
Note: may also work for N770 and N810 but not tested.
- OWBAL_PLATFORM_MACPORT:
This option is disabled by default (OFF). If you intend to run owb on a MAC platform, set this option to ON.
- OWBAL_USE_CONSOLE_INPUT:
This option is disabled by default (OFF). If you target to run owb on a board through a network connection, you may want to enable this option. This will allow you to send to owb keyboard input through your network connection.
- VERBOSE:
Compile owb either in a verbose mode or in a quiet mode. Below an example of verbose mode compilation:
[ 86%] Building CXX object CMakeFiles/webcore-owb.dir/WebCore/bindings/js/kjs_window.o /usr/bin/c++ -Dwebcore_owb_EXPORTS -fno-rtti -fPIC -I/home/developer/owb-src/Robespierre2.0 -I/home/developer/owb-src/Robespierre2.0/BAL/Configuration -I/home/developer/owb-src/Robespierre2.0/BAL/Implementations/Widgets -I/home/developer/owb-src/Robespierre2.0/BAL/Implementations/Widgets/Generic -I/home/developer/owb-src/Robespierre2.0/BAL/Interfaces -I/home/developer/owb-src/Robespierre2.0/BAL/Interfaces/network -I/home/developer/owb-src/Robespierre2.0/BAL/Interfaces/font -I/home/developer/owb-src/Robespierre2.0/BAL/Interfaces/graphics -I/home/developer/owb-src/Robespierre2.0/BAL/Implementations/ImageDecoders/Common -I/home/developer/owb-src/Robespierre2.0/BAL/Implementations/Events/Common -I/home/developer/owb-src/Robespierre2.0/JavaScriptCore/pcre -I/home/developer/owb-src/Robespierre2.0/JavaScriptCore/bindings -I/home/developer/owb-src/Robespierre2.0/JavaScriptCore/bindings/c -I/home/developer/owb-src/Robespierre2.0/JavaScriptCore/bindings/bal -I/home/developer/owb-src/Robespierre2.0/JavaScriptCore/kjs -I/home/developer/owb-src/Robespierre2.0/JavaScriptCore -I/home/developer/owb-src/Robespierre2.0/JavaScriptCore/ForwardingHeaders -I/home/developer/owb-src/Robespierre2.0/JavaScriptCore/wtf -I/home/developer/owb-src/Robespierre2.0/WebCore -I/home/developer/owb-src/Robespierre2.0/WebCore/page -I/home/developer/owb-src/Robespierre2.0/WebCore/editing -I/home/developer/owb-src/Robespierre2.0/WebCore/dom -I/home/developer/owb-src/Robespierre2.0/WebCore/rendering -I/home/developer/owb-src/Robespierre2.0/WebCore/loader -I/home/developer/owb-src/Robespierre2.0/WebCore/css -I/home/developer/owb-src/Robespierre2.0/WebCore/history -I/home/developer/owb-src/Robespierre2.0/WebCore/html -I/home/developer/owb-src/Robespierre2.0/WebCore/bridge -I/home/developer/owb-src/Robespierre2.0/WebCore/loader/icon -I/home/developer/owb-src/Robespierre2.0/WebCore/bindings/js -I/home/developer/owb-src/Robespierre2.0/WebKit/OrigynWebBrowser/WebCoreSupport -I/home/developer/owb-src/Robespierre2.0/WebCore/xml -I/home/developer/owb-src/Robespierre2.0/BALGlue -I/home/developer/owb-src/Robespierre2.0/build -I/home/developer/owb-src/Robespierre2.0/build/generated_sources -I/home/developer/owb-src/Robespierre2.0/build/generated_sources/kjs -I/home/developer/owb-src/Robespierre2.0/build/generated_sources/WebCore -I/home/developer/owb-src/Robespierre2.0/build/generated_sources/WebCore/html -I/home/developer/owb-src/Robespierre2.0/build/generated_sources/WebCore/xml -I/usr/include/SDL -I/usr/include/freetype2 -I/usr/include/libxml2 -I/home/developer/owb-src/Robespierre2.0/BAL/Tests -I/home/developer/owb-src/Robespierre2.0/BAL/Implementations/Widgets/Common -D__OWB_WEB_UI__ -D__OWB_XML_SUPPORT__ -DENABLE_DATABASE=0 -DENABLE_XPATH=1 -DENABLE_XSLT=1 -fPIC -DPIC -fno-exceptions -DENABLE_FTPDIR=1 -W -Wall -DDEBUG_LAYOUTTEST -g -DBAL_LOG -Wno-unused-parameter -Wno-unused-variable -funit-at-a-time -D__OWB_JS__ -DWTF_USE_JAVASCRIPTCORE_BINDINGS -DAPPLE_CHANGES=1 -DHAVE_FUNC_ISNAN -D_THREAD_SAFE -D__OWB__ -DUSE_CONSERVATIVE_GC=0 -DD_MULTISCAN_FILES_SUPPORTED -DLINUX -pthread -o CMakeFiles/webcore-owb.dir/WebCore/bindings/js/kjs_window.o -c /home/developer/owb-src/Robespierre2.0/WebCore/bindings/js/kjs_window.cpp
In fact this option is quite useless as you can leave it disable and enable it on demand with command line by typing:
make VERBOSE=1
- WEBKIT_DEBUG:
This option is used to set specific CFLAGS and CXXFLAGS for compilation. Possible values are:
- DEBUG: set -g flag.
- DEBUG_GCC3.X: set -g -funit-at-a-time flags. This option has to be set to compile owb in debug mode with a gcc-3.x else you will get an error with DragClientBal.cpp compilation.
- RELEASE: set -O2 -DNDEBUG flags.
- WEBKIT_USE_EVENTS:
Choose which event loop to choose. Possible values are:
- SDL: use SDL event loop. This is the default and advised setting. Of course this implies to have SDL library on your system.
- GENERIC: use a generic event loop. With this option you will not be able to interact with owb.
- WEBKIT_USE_FONTS:
Which font renderer to use:
- FREETYPE: use freetype library as font renderer. This option implies to freetype and fontconfig libraries installed on your system.
- EMBEDDED: use a 7x13 embedded font which can render as normal, bold or italic. This option implies no additionnal libraries for font rendering.
- WEBKIT_USE_GRAPHICS:
Set the graphic library to use for graphical rendering. The only possible value for the moment is SDL. Of course this means that you will have to install SDL library on your system but also SDL_GFX library.
- WEBKIT_USE_I18N:
Which internationalization mechanism to use:
- ICU: use icu library for internationalization stuff.
- GENERIC: use a generic implementation which does not involve additional library. Nonetheless, this implementation is a preliminary one so it may be buggy and is incomplete.
- WEBKIT_USE_IMAGEDECODER:
What kind of image decoder to use:
- GENERIC: this is the default option. It embeds inside owb source code png/jpeg and gif decoder.
- LIBRARY: use png/jpeg and gif libraries from your system.
- WEBKIT_USE_JS:
This option is used to enable/disable javascript support in owb. By default this is set to ON. Be aware that disabling this will lead to an ugly rendering on all pages!
Note: rendering is a bit less worse when you disable this option, if you have previously set WEBKIT_USE_FONTS option to EMBEDDED
- WEBKIT_USE_UCLIBC:
This option is disabled by default (OFF). You have to enable this option if you use uClibc 0.9.28 (not tested with older version) which has not pthread support. If you have a 0.9.29 uClibc toolchain compiled with pthread support, you may leave this option to (OFF).
- WEBKIT_USE_WEB_UI:
This option is enabled by default (ON). This lets you the possibility to use a HTML user interface inside owb.
Cross compilation
The first thing is to have a build directory where you have compiled dftables for your host.
mkdir build && cd build cmake /path/to/sources make dftables
Then create a cross-build directory where you will do your cross-compilation.
mkdir cross-build && cd cross-build ccmake /path/to/sources
With CMake 2.4
Switch CMAKE_CROSSCOMPILING option to ON.
Ensure that dftables_executable option is correctly set.
Check that the compiler uses is your cross-compiler. For that, type 't' to toggle hidden options, and have a look at CMAKE_CXX_COMPILER and CMAKE_C_COMPILER. You can also add some flags like -I/path/to/toolchain/usr/include for CMAKE_CXX_FLAGS option.
Another check to do is about option like ICU_CONFIG_EXECUTABLE or PKG_CONFIG_EXECUTABLE.
With CMake 2.5
Create toolchain file similar to this one:
# this one is important SET(CMAKE_SYSTEM_NAME Linux) #this one not so much SET(CMAKE_SYSTEM_VERSION 1) # specify the cross compiler SET(CMAKE_C_COMPILER /opt/eldk-2007-01-19/usr/bin/ppc_74xx-gcc) SET(CMAKE_CXX_COMPILER /opt/eldk-2007-01-19/usr/bin/ppc_74xx-g++) # where is the target environment SET(CMAKE_FIND_ROOT_PATH /opt/eldk-2007-01-19/ppc_74xx /home/alex/eldk-ppc74xx-inst) # search for programs in the build host directories SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) # for libraries and headers in the target directories SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Then simply run:
ccmake -DCMAKE_TOOLCHAIN_FILE=~/Toolchain-eldk-ppc74xx.cmake /path/to/sources
Check that dftables_executable option is correct and it should be OK.
Note: in toolchain.cmake, you can also set flags like CMAKE_CXX_FLAGS
For more info about this: http://www.cmake.org/Wiki/CMake_Cross_Compiling
TIPS
How to speed up compilation with ccache
First method
Link /usr/local/bin/g++ and /usr/local/bin/gcc to /usr/bin/ccache (you can alternatively use ccache-config when available).
Then edit CMakeLists.txt:
SET (CMAKE_CXX_COMPILER /usr/local/bin/g++) SET (CMAKE_C_COMPILER /usr/local/bin/gcc)
You're done.
Second method
Simply do:
cmake -D CMAKE_CXX_COMPILER="/usr/bin/ccache" -D CMAKE_CXX_COMPILER_ARG1="/usr/bin/g++" -D CMAKE_C_COMPILER="/usr/bin/ccache" -D CMAKE_C_COMPILER_ARG1="/usr/bin/gcc" ..
