| 1 |
Compiling from Source |
| 2 |
--------------------- |
| 3 |
|
| 4 |
To compile the code the source or an installation of the Synthesis |
| 5 |
SyncML engine is needed. A compatible snapshot of it is included in |
| 6 |
SyncEvolution source packages and will be used automatically. |
| 7 |
The section _`Checking out the source` explains how to work |
| 8 |
with sources obtained via the git repositories. |
| 9 |
|
| 10 |
Also needed are the Evolution (can be disabled), Boost (>= 1.35) and |
| 11 |
pcre development files. For HTTP, either Curl or libsoup can be used. |
| 12 |
For compiling libsynthesis, sqlite, expat, libz are needed. |
| 13 |
|
| 14 |
On Debian based systems, the required packages can be installed with |
| 15 |
apt-get install evolution-data-server-dev \ |
| 16 |
libglib2.0-dev \ |
| 17 |
libecal1.2-dev libebook1.2-dev \ |
| 18 |
libsoup2.4-dev \ |
| 19 |
libpcre3-dev \ |
| 20 |
libexpat-dev \ |
| 21 |
libz-dev \ |
| 22 |
libboost-dev |
| 23 |
|
| 24 |
If gio (part of libglib) is not available in version 2.26 or higher, |
| 25 |
then libdbus can be used as fallback (not needed otherwise): |
| 26 |
apt-get install libdbus-glib-1-dev |
| 27 |
|
| 28 |
libboost-dev >= 1.34, available as libboost1.35-dev backport for Debian Etch. |
| 29 |
|
| 30 |
Necessary on some distros due to bad dependencies (not needed by SyncEvolution itself): |
| 31 |
apt-get install libdb3-dev |
| 32 |
|
| 33 |
Optional (enables reading proxy settings from GNOME preferences): |
| 34 |
apt-get install libsoup-gnome2.4-dev |
| 35 |
|
| 36 |
Optional (enables direct sync with phones): |
| 37 |
apt-get install libopenobex-dev libbluetooth-dev |
| 38 |
|
| 39 |
Optional (only used for SHA-256 when glib is not already a dependency): |
| 40 |
apt-get install libnss3-dev |
| 41 |
|
| 42 |
The test framework also requires CPPUnit: |
| 43 |
apt-get install libcppunit-dev |
| 44 |
|
| 45 |
For the GUI and its D-Bus based service backend: |
| 46 |
apt-get install xsltproc \ |
| 47 |
libglib2.0-dev \ |
| 48 |
libgtk2.0-dev libglade2-dev \ |
| 49 |
libgnome-keyring-dev \ |
| 50 |
libgconf2-dev libgnomevfs2-dev |
| 51 |
|
| 52 |
Optional packages for GUI: |
| 53 |
apt-get install libunique-dev |
| 54 |
|
| 55 |
libunique = ensure that GTK GUI only runs once per user |
| 56 |
|
| 57 |
Optional packages for GNOME Bluetooth Panel plugin: |
| 58 |
apt-get install libgnome-bluetooth-dev |
| 59 |
|
| 60 |
The plugin adds a button to invoke sync-UI after a device |
| 61 |
was paired which supports SyncML. |
| 62 |
|
| 63 |
The build system is the normal autotools system. See INSTALL for |
| 64 |
general instructions how to use that and "./configure --help" for |
| 65 |
SyncEvolution specific options. |
| 66 |
|
| 67 |
Note that compiling without the Evolution development files is |
| 68 |
possible. But because this is usually not what people want, |
| 69 |
the configure script needs explicit --disable-ecal --disable-ebook |
| 70 |
parameters, otherwise it will refuse to compile without Evolution |
| 71 |
support. |
| 72 |
|
| 73 |
When compiling from a git checkout, remember to run "./autogen.sh". |
| 74 |
It depends on: |
| 75 |
apt-get install libtool intltool automake |
| 76 |
|
| 77 |
|
| 78 |
Checking out the Source |
| 79 |
----------------------- |
| 80 |
|
| 81 |
SyncEvolution is hosted on moblin.org. Anonymous access is via |
| 82 |
git clone git://git.moblin.org/syncevolution.git |
| 83 |
|
| 84 |
Before using sources checked out from Subversion, invoke "sh |
| 85 |
autogen.sh" with appropriate autotools packages installed. |
| 86 |
|
| 87 |
When running the configure script, it can be told to compile a |
| 88 |
Synthesis library automatically via the --with-synthesis-src configure |
| 89 |
option. This has advantages when modifying the Synthesis source |
| 90 |
together with SyncEvolution (no need to install Synthesis and thus |
| 91 |
faster compilation) and will bundle the Synthesis sources in source |
| 92 |
.tar.gz archives. |
| 93 |
|
| 94 |
The upstream Synthesis source code is here: |
| 95 |
git://www.synthesis.ch/libsynthesis.git |
| 96 |
The staging area for patches developed as part of Moblin are |
| 97 |
in the following repository: |
| 98 |
git://git.moblin.org/libsynthesis.git |
| 99 |
|
| 100 |
The intention is to include all these patches upstream to |
| 101 |
prevent forking the code. If you want to get patches included |
| 102 |
in the Synthesis code base, then please work directly with |
| 103 |
the upstream branch. |
| 104 |
|
| 105 |
For doing development work the recommended configure line is: |
| 106 |
configure --with-synthesis-src=<path to libsynthesis source> \ |
| 107 |
--enable-warnings=fatal \ |
| 108 |
--enable-unit-tests \ |
| 109 |
--enable-libcurl \ |
| 110 |
--disable-shared \ |
| 111 |
--enable-developer-mode |
| 112 |
|
| 113 |
Enabling libcurl explicitly ensures that it gets built even when not |
| 114 |
the default. |
| 115 |
|
| 116 |
--disable-shared results in easier to debug executables (no shell |
| 117 |
wrapper scripts, all symbols available before the program runs). |
| 118 |
|
| 119 |
Backend libraries are dynamically scannned and loaded into syncevolution, the |
| 120 |
library path defaults to $prefix/syncevolution/backends. When developer-mode is |
| 121 |
enabled, it will scan libraries in current build directory instead. |
| 122 |
|
| 123 |
-Wno-unknown-pragmas is required to avoid warnings triggered by |
| 124 |
'#pragma }', a trick to preserve indention after 'extern "C" {' in |
| 125 |
/usr/include/evolution-data-server-1.12/libical/ |
| 126 |
|
| 127 |
Working with the Code |
| 128 |
--------------------- |
| 129 |
|
| 130 |
The code follows the code formatting of the Funambol |
| 131 |
C++ client library. Just emulate the existing |
| 132 |
code when possible. |
| 133 |
|
| 134 |
Exceptions derived from std::exception are used to report errors. The |
| 135 |
EvolutionSyncSource::handleException() function deals with logging the |
| 136 |
exception. |
| 137 |
|
| 138 |
SyncEvolution uses the a CPPUnit based testing framework. Configure |
| 139 |
with --enable-integration-tests and (optionally) --enable-unit-tests, |
| 140 |
then run "src/client-test" as described in src/client-test-app.cpp. |
| 141 |
|
| 142 |
It understands several environment variables, among them: |
| 143 |
- CLIENT_TEST_SERVER = chooses config |
| 144 |
- CLIENT_TEST_SOURCES = comma separated list of enabled sources, identified |
| 145 |
by their name |
| 146 |
For Evolution: eds_contact,eds_event,eds_task,eds_memo |
| 147 |
For file backend: file_contact,file_event,file_task,file_memo (uses same test |
| 148 |
data and vCard flavor as Evolution) |
| 149 |
- CLIENT_TEST_EVOLUTION_PREFIX=[name|file://<path>] overrides |
| 150 |
the evolutionsource setting in the configuration; if file:// is used |
| 151 |
then these database will be created automatically |
| 152 |
NOTE : The automatic database creation is not supported for EDS 2.32. We need |
| 153 |
to create manually the databases using Evolution. New database names must be |
| 154 |
named ${CLIENT_TEST_EVOLUTION_PREFIX}${CLIENT_TEST_SOURCES}_[12]. |
| 155 |
Example: if CLIENT_TEST_EVOLUTION_PREFIX=Test_ and Client::Sync::eds_contact |
| 156 |
is used, then addressbooks with the names 'Test_eds_contact_1' and |
| 157 |
'Test_eds_contact_2' must exist. |
| 158 |
- CLIENT_TEST_XML=1 use XML format as default instead of the normal WBXML |
| 159 |
|
| 160 |
For unattended testing: |
| 161 |
- CLIENT_TEST_FAILURES = comma separated list of tests which are allowed |
| 162 |
to fail without affecting the return code of the test runner; each list |
| 163 |
entry is a regex which must match a complete test name |
| 164 |
- CLIENT_TEST_SKIP = comma separated list of tests or test groups which |
| 165 |
are not to be executed at all; for this to work the test or test group |
| 166 |
has to be passed through test.h's version of ADD_TEST or FilterTest, |
| 167 |
which is the case for most tests but not all; as in CLIENT_TEST_FAILURES, |
| 168 |
each entry is a regex |
| 169 |
- CLIENT_TEST_LOG = name of server log file, will be copied and reset |
| 170 |
after each sync |
| 171 |
- CLIENT_TEST_ALARM = number of seconds a single test is allowed to run |
| 172 |
before aborting it |
| 173 |
|
| 174 |
Most Client::Sync tests use the default encoding, usually WBXML unless |
| 175 |
changed via CLIENT_TEST_XML=1. Client::Sync::*::testItemsXML always |
| 176 |
uses XML and Client::Sync::*::testItems always WBXML. |
| 177 |
|
| 178 |
Here are step-by-step instructions to get started with testing, |
| 179 |
using ScheduleWorld as example: |
| 180 |
- CLIENT_TEST_SERVER=scheduleworld \ |
| 181 |
CLIENT_TEST_EVOLUTION_PREFIX=file:///tmp/testing/ \ |
| 182 |
./client-test -h |
| 183 |
=> creates ~/.config/syncevolution/scheduleworld_[12]/ configs |
| 184 |
which use data bases under /tmp/testing, then |
| 185 |
prints all available tests |
| 186 |
- edit ~/.config/syncevolution/scheduleworld_[12]/spds/syncml/config.txt |
| 187 |
and enter account data for ScheduleWorld in both configurations; |
| 188 |
check that the syncURL is correct |
| 189 |
- CLIENT_TEST_SERVER=scheduleworld \ |
| 190 |
CLIENT_TEST_EVOLUTION_PREFIX=file:///tmp/testing/ \ |
| 191 |
./client-test Client::Source |
| 192 |
=> runs alls tests involving just local operations |
| 193 |
- CLIENT_TEST_SERVER=scheduleworld \ |
| 194 |
CLIENT_TEST_EVOLUTION_PREFIX=file:///tmp/testing/ \ |
| 195 |
./client-test Client::Sync::vcard30::testCopy |
| 196 |
=> runs one test that checks that one contact can |
| 197 |
be copied to and from the server using the two |
| 198 |
configurations |
| 199 |
- CLIENT_TEST_SERVER=scheduleworld \ |
| 200 |
CLIENT_TEST_EVOLUTION_PREFIX=file:///tmp/testing/ \ |
| 201 |
./client-test Client::Sync |
| 202 |
=> runs all tests which involve the SyncML server; |
| 203 |
tests involving just one source are run first, |
| 204 |
followed by the same tests with all enabled |
| 205 |
sources in two different orders |
| 206 |
|
| 207 |
"make valgrind" runs the same tests inside valgrind |
| 208 |
[http://www.valgrind.org]. A suppression file is |
| 209 |
used to hide errors inside system libraries which |
| 210 |
are not caused by SyncEvolution or Synthesis |
| 211 |
library code. Most likely the suppressions are system |
| 212 |
dependent and might have to be updated from time to time. |
| 213 |
|
| 214 |
|
| 215 |
Committing Changes |
| 216 |
------------------ |
| 217 |
|
| 218 |
Here are some guidelines for well-formed commits: |
| 219 |
- Avoid unnecessary white space changes in the source code. |
| 220 |
- Don't mix unrelated changes in one single commit. Every |
| 221 |
single commit should leave the code in a functional state |
| 222 |
(compiles, unit tests pass, ...). |
| 223 |
- Document new functions and structures with Doxygen comments. |
| 224 |
These comments should really add information, not just |
| 225 |
repeat the name of the entity. At least paraphrase the names. |
| 226 |
- Each commit message should follow the format |
| 227 |
<item>: <summary> [(BMC #1234)] |
| 228 |
<blank line> |
| 229 |
<body> |
| 230 |
- <item> here refers to the module, class or functionality modified |
| 231 |
in the commit, for example "autotools" for the build scripts, |
| 232 |
"EvolutionContactSource" for the EDS contact backend, etc. |
| 233 |
- <summary> should be consise enough to describe the patch on |
| 234 |
its own. |
| 235 |
- The optional bugs.meego.com (BMC) number in round brackets |
| 236 |
refers to the issue addressed by the commit. Most changes, |
| 237 |
in particular bug fixes, should have such an issue filed |
| 238 |
for tracking purposes. |
| 239 |
- The body (hard-wrapped, multiple paragraphs for long text) |
| 240 |
should include the following pieces of information, |
| 241 |
if applicable: |
| 242 |
- problem statement (*why* is the change relevant?) |
| 243 |
- summary of the solution (*how* is the problem solved?) |
| 244 |
- what other solutions were considered and rejected (*context* |
| 245 |
for the solution) |
| 246 |
- known gaps (in particularly useful during code review, |
| 247 |
which will start with the oldest, possibly incomplete patch first) |
| 248 |
|
| 249 |
When writing source code comments and commit messages, always remember |
| 250 |
that you are communicating with someone. This person might be even be |
| 251 |
you in some distant future, trying to remember why the heck something |
| 252 |
was done the way it was done... There might not be a chance to ask |
| 253 |
questions, so think about what such a person might want to know and |
| 254 |
answer it in advance. |
| 255 |
|
| 256 |
There is a certain redundancy between source code comments, commit |
| 257 |
messages and issue tracker comments. Whenever possible, the |
| 258 |
description of the solution should be in the source code itself, with |
| 259 |
only a brief summary and/or pointer in the commit message. It's fine |
| 260 |
to copy-and-paste to reduce the overall effort. |
| 261 |
|
| 262 |
|
| 263 |
Building a Release |
| 264 |
------------------ |
| 265 |
|
| 266 |
- increase version number in configure-pre.in/AM_INIT_AUTOMAKE |
| 267 |
For prereleases use "old version"+"new prerelease"-1 as |
| 268 |
package version. That ensures that package versions are |
| 269 |
higher than the old release, but lower than the final |
| 270 |
release. Avoid hyphens as part of the release names, i.e. |
| 271 |
use "0.7+0.8beta1" instead of "0.7+0.8-beta1". |
| 272 |
- ensure files were updated: |
| 273 |
./NEWS debian/changelog |
| 274 |
- update po/LINGUAS |
| 275 |
- check and if necessary, bump the Synthesis .so versions |
| 276 |
(libsynthesis/src/Makefile.am.in) |
| 277 |
- ensure that Synthesis source code is tagged: |
| 278 |
use <base version>+<syncevo version> if local changes exist |
| 279 |
- commit and tag SyncEvolution source code |
| 280 |
- make distcheck |
| 281 |
- compile binary .tar.gz packages for different Evolution versions; |
| 282 |
done automatically by runtests.py on estamos.de (= Debian 3.0), using different Garnome |
| 283 |
installations, and with special configure options to ensure maximum |
| 284 |
portability (LDFLAGS=-Wl,--as-needed --enable-static-cxx) |
| 285 |
- compile .deb for Maemo |
| 286 |
- update entries on the web about the release: |
| 287 |
http://maemo.org/downloads/product/OS2008/syncevolution/ |
| 288 |
http://www.estamos.de/blog/wp-admin |
| 289 |
http://www.estamos.de/projects/SyncEvolution/Roadmap.html |
| 290 |
http://freshmeat.net/projects/syncevolution/ |
| 291 |
|
| 292 |
|
| 293 |
Compiling for Maemo |
| 294 |
------------------- |
| 295 |
unpack source archive in Scratchbox (for maximum compatibility: use Chinook 4.0 |
| 296 |
rootstrap; for support of all backends: ensure that the EDS-DBus calendar dev packages |
| 297 |
are installed), |
| 298 |
DEB_BUILD_OPTIONS=maemo fakeroot dpkg-buildpackage |
| 299 |
NOTE: dpkg-buildpackage -rfakeroot does *not* work as it leads to strange problems executing a.out |
| 300 |
during the client-src configure. |
| 301 |
|
| 302 |
Maemo EDS-DBus calendar dev packages /etc/apt/source.list: |
| 303 |
deb http://maemo.o-hand.com/packages chinook/ |
| 304 |
|
| 305 |
|
| 306 |
Compiling for iPhone |
| 307 |
-------------------- |
| 308 |
Requires iPhone toolchain and a libcurl compiled for the iPhone. |
| 309 |
libcurl is ideally configured as small as possible |
| 310 |
and statically (to avoid packaging problems): |
| 311 |
./configure --prefix=/usr/local/iphone --host=arm-apple-darwin --disable-shared \ |
| 312 |
--disable-crypto-auth --without-gnutls --without-ssl --without-zlib \ |
| 313 |
--without-libssh2 --disable-ipv6 --disable-manual --disable-telnet \ |
| 314 |
--disable-tftp --disable-ldap --disable-file --disable-ftp |
| 315 |
manually set HAVE_POSIX_STRERROR_R in lib/config.h |
| 316 |
|
| 317 |
Potential problems with toolchain: |
| 318 |
std++ not found: ln -s libstdc++.6.dylib /usr/local/iphone-filesystem/usr/lib/libstdc++.dylib |
| 319 |
AddressBook framework must be added to iphone-dev/include/install-headers.sh.in |
| 320 |
|
| 321 |
Compile with curl-config in the PATH: |
| 322 |
PATH=/usr/local/iphone/bin/:$PATH ~/projects/SyncEvolution/trunk/configure --host=arm-apple-darwin --with-funambol-src=/home/patrick/projects/native CXXFLAGS=-O0 --disable-ecal --disable-ebook --enable-addressbook --prefix=/usr |
| 323 |
PATH=/usr/local/iphone/bin/:$PATH make all |
| 324 |
|
| 325 |
Build a package with: |
| 326 |
make distbin BINSUFFIX="iphone" |
| 327 |
|
| 328 |
Compiling for Mac OS X |
| 329 |
---------------------- |
| 330 |
|
| 331 |
Configuring for development: |
| 332 |
<path>/configure --with-funambol-src=<path> \ |
| 333 |
--enable-addressbook \ |
| 334 |
--disable-ecal --disable-ebook \ |
| 335 |
CXXFLAGS="-Wall -Werror -Wno-unknown-pragmas" \ |
| 336 |
LDFLAGS="-framework Addressbook -framework CoreServices" \ |
| 337 |
CXXFLAGS=-g \ |
| 338 |
CFLAGS=-g |
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
Compiling final release: |
| 343 |
./configure --enable-addressbook \ |
| 344 |
--disable-ecal --disable-ebook \ |
| 345 |
CXXFLAGS="-O -g -arch i386 -arch ppc" \ |
| 346 |
CFLAGS="-O -g -arch i386 -arch ppc" \ |
| 347 |
LDFLAGS="-arch i386 -arch ppc -framework Addressbook -framework CoreServices" \ |
| 348 |
--disable-dependency-tracking |
| 349 |
make BINSUFFIX=mac-os-x distbin |
| 350 |
|
| 351 |
Fine-grained memory checking: |
| 352 |
MallocStackLogging=1 MallocStackLoggingNoCompact=1 \ |
| 353 |
MallocScribble=1 MallocPreScribble=1 MallocGuardEdges=1 \ |
| 354 |
MallocCheckHeapStart=1 MallocCheckHeapEach=100 |
| 355 |
|
| 356 |
|
| 357 |
Debugging |
| 358 |
--------- |
| 359 |
|
| 360 |
The following packages contain debug information for |
| 361 |
relevant libraries on Ubuntu 7.10: |
| 362 |
evolution-data-server-dbg libglib2.0-0-dbg evolution-dbg |
| 363 |
|
| 364 |
Normally, syncevolution redirects stderr to its own log file. In |
| 365 |
crash scenarios the final error messages may get lost. To debug such |
| 366 |
cases, disable redirection by setting the environment variable |
| 367 |
SYNCEVOLUTION_DEBUG (value doesn't matter) and capture the output |
| 368 |
normally. |