building the Funambol extension for TB3 on Linux/x86-64

7 Jun

This posting describes the steps required to build the Funambol add-on for Mozilla Thunderbird 3 on Ubuntu 10.10 (Maverick Meerkat). It is mostly based on Bas’ Blog entry .

Part I: the prerequisites

  1. define the buildroot
    BASE=”${HOME}/buildenvs/mozbuild.maverick_amd64”
  2. install required packages
    sudo aptitude install mercurial autoconf2.13 colormake libcurl4-gnutls-dev libtool git-svn
  3. I had problems using a freshly debootstrapped ubuntu maverick (10.10) chroot that was missing the “staff“ group, so if it’s missing, add it via “vigr“…
  4. install build-dependencies
    sudo apt-get build-dep thunderbird

Part II-1: building the gecko

NOTE: in theory, this part could be skipped by installing the thunderbird-dev package from ubuntu instead (see the “Part II-2” section below), but the ubuntu-package is built without the “—enable-calendar“ flag, and thus it is missing the headers required by funambol…

  1. check out the comm-central component
    cd $BASE
    hg clone http://hg.mozilla.org/releases/comm-1.9.2/ comm-central
    cd comm-central
    python client.py checkout
  2. create the “.mozconfig“ build configuration file
    mk_add_options MOZ_MAKE_FLAGS=”-j16”
    ac_add_options —enable-application=mail
    ac_add_options —enable-extensions=default
    ac_add_options —enable-calendar
    ac_add_options —enable-static
    ac_add_options —disable-debug
    ac_add_options —disable-shared
    ac_add_options —disable-tests
    ac_add_options —disable-installer
  3. call autoconf & build it
    autoconf2.13
    colormake -f client.mk

Part II-2: installing thunderbird-dev and fixing it

ATTENTION: this part is NOT working since the ubuntu package is lacking the calendar-related headers that are required by funambol…

sudo aptitude install thunderbird-dev
cd /usr/lib/thunderbird-devel-3.1.4/include/
ls -l nspr nss
sudo ln -fsv /usr/include/nspr/ 
sudo ln -fsv /usr/include/nss/
ls -l nspr nss

Part III: building the Funambol API

  1. fetch the sources (username: “guest“, empty password)
    cd $BASE
    git svn clone https://mozilla-plugin.forge.funambol.org/svn/mozilla-plugin/trunk funambol-mozilla-plugin
  2. fetch the externals
    mkdir svn-externals
    cd svn-externals
    git svn clone https://client-sdk.forge.funambol.org/svn/client-sdk/trunk/cpp-sdk funambol-api
    git svn clone -r 36136:HEAD https://core.forge.funambol.org/svn/core/trunk/tools/cjson
    git svn clone -r 28009:HEAD https://core.forge.funambol.org/svn/core/trunk/tools/zlib
    
  3. create symlinks for externals
    cd $BASE/funambol-mozilla-plugin
    ln -s ../svn-externals/funambol-api
    mkdir -p funambol-api/tools
    cd funambol-api/tools
    ln -s ../../cjson
    ln -s ../../zlib
  4. download and unzip the funambol client SDK
    cd $BASE
    wget -c http://sourceforge.net/projects/funambol/files/client-sdk/v9/funambol-client-sdk-9.0.0.zip
    unzip funambol-client-sdk-9.0.0.zip
  5. create symlinks to the SDK and the gecko-build
    cd $BASE/funambol-mozilla-plugin
    ln -s ../Funambol/sdk/
    ln -s ../comm-central/mozilla/dist/
  6. call autogen, configure & make
    cd $BASE/funambol-mozilla-plugin/funambol-api/build/autotools
    ./autogen.sh
    ./configure —disable-shared \
      —prefix=$BASE/funambol-mozilla-plugin/sdk/ \
      —with-transport-agent=mozilla \
      —with-mozilla-sdk-path=$BASE/funambol-mozilla-plugin/dist/ \
      —with-pic
    colormake
    colormake install

Part IV: build the XPCom thing

  1. patch the Makefile to include $(FUNAMBOL_API_PATH)/src/include/common in the funambol-includes, see below for diff
    cd $BASE/funambol-mozilla-plugin/funambol-mozilla-plugin/syncmlcomponent/build/posix/
    patch -p1 < Makefile.diff
  2. create the output-dir and call make
    mkdir $BASE/funambol-mozilla-plugin/funambol-mozilla-plugin/extension/components
    colormake


—- a/Makefile
+++ b/Makefile
-13,6 13,7 CXX = g+ ROOT_PATH = ../../../.. MOZILLA_SDK_PATH = $(ROOT_PATH)/dist FUNAMBOL_SDK_PATH = $(ROOT_PATH)/sdk
+FUNAMBOL_API_PATH = $(ROOT_PATH)/funambol-api CPPUNIT_SDK_PATH = /opt/local PLUGIN_SDK_PATH = ../../src UNIT_TEST_SRC_PATH = ../../test
-36,6 +37,7 MOZILLA_INCLUDES = -I $(MOZILLA_SDK_PATH)/include \

FUNAMBOL_INCLUDES = -DENABLE_FUNAMBOL_NAMESPACE \ -I $(FUNAMBOL_SDK_PATH)/include/funambol/common \ + -I $(FUNAMBOL_API_PATH)/src/include/common \ -I $(FUNAMBOL_SDK_PATH)/include/funambol/posix PLUGIN_INCLUDES = -I $(PLUGIN_SDK_PATH)/include

Part V: assemble the XPI

  1. adjust install-linux.rdf for x86_64 & build it
    cd $BASE/funambol-mozilla-plugin/funambol-mozilla-plugin/extension/
    sed -i ‘s,Linux_x86-gcc3,Linux_x86_64-gcc3,’ install-linux.rdf
    cd build
    ./buildLinux.sh

2 Replies to “building the Funambol extension for TB3 on Linux/x86-64

  1. Instead of using “thunderbird-dev“, the “lightning-extension“ source package could be used, you have to run “dpkg-buildpackage“ once to generate all the headers and a bunch of symlinks have to be set inside the “mozilla/dist/include“ directory:

    ../../ipc/chromium/src/base/
    ../../../calendar/base/public/calBaseCID.h
    ../../../calendar/base/public/_xpidlgen/calIAlarm.h
    ../../../calendar/base/public/_xpidlgen/calIAlarmService.h
    ../../../calendar/base/public/_xpidlgen/calIAttachment.h
    ../../../calendar/base/public/_xpidlgen/calIAttendee.h
    ../../../calendar/providers/caldav/public/_xpidlgen/calICalDavCalendar.h
    ../../../calendar/base/public/_xpidlgen/calICalendar.h
    ../../../calendar/base/public/_xpidlgen/calICalendarManager.h
    ../../../calendar/base/public/_xpidlgen/calICalendarProvider.h
    ../../../calendar/base/public/_xpidlgen/calICalendarSearchProvider.h
    ../../../calendar/base/public/_xpidlgen/calICalendarView.h
    ../../../calendar/base/public/_xpidlgen/calICalendarViewController.h
    ../../../calendar/base/public/_xpidlgen/calIChangeLog.h
    ../../../calendar/base/public/_xpidlgen/calIDateTime.h
    ../../../calendar/base/public/_xpidlgen/calIDateTimeFormatter.h
    ../../../calendar/base/public/_xpidlgen/calIDuration.h
    ../../../calendar/base/public/_xpidlgen/calIErrors.h
    ../../../calendar/base/public/_xpidlgen/calIEvent.h
    ../../../calendar/base/public/_xpidlgen/calIFreeBusyProvider.h
    ../../../calendar/providers/gdata/public/_xpidlgen/calIGoogleCalendar.h
    ../../../calendar/providers/gdata/public/_xpidlgen/calIGoogleRequest.h
    ../../../calendar/providers/gdata/public/_xpidlgen/calIGoogleSession.h
    ../../../calendar/base/public/_xpidlgen/calIICSService.h
    ../../../calendar/base/public/_xpidlgen/calIIcsParser.h
    ../../../calendar/base/public/_xpidlgen/calIIcsSerializer.h
    ../../../calendar/base/public/_xpidlgen/calIImportExport.h
    ../../../calendar/base/public/_xpidlgen/calIItemBase.h
    ../../../calendar/base/public/_xpidlgen/calIItipItem.h
    ../../../calendar/base/public/_xpidlgen/calIItipTransport.h
    ../../../calendar/base/public/_xpidlgen/calIOperation.h
    ../../../calendar/base/public/_xpidlgen/calIPeriod.h
    ../../../calendar/base/public/_xpidlgen/calIPrintFormatter.h
    ../../../calendar/base/public/_xpidlgen/calIRecurrenceDate.h
    ../../../calendar/base/public/_xpidlgen/calIRecurrenceDateSet.h
    ../../../calendar/base/public/_xpidlgen/calIRecurrenceInfo.h
    ../../../calendar/base/public/_xpidlgen/calIRecurrenceItem.h
    ../../../calendar/base/public/_xpidlgen/calIRecurrenceRule.h
    ../../../calendar/base/public/_xpidlgen/calIRelation.h
    ../../../calendar/base/public/_xpidlgen/calISchedulingSupport.h
    ../../../calendar/base/public/_xpidlgen/calIStatusObserver.h
    ../../../calendar/base/public/_xpidlgen/calITimezone.h
    ../../../calendar/base/public/_xpidlgen/calITimezoneProvider.h
    ../../../calendar/base/public/_xpidlgen/calITodo.h
    ../../../calendar/base/public/_xpidlgen/calITransactionManager.h
    ../../../calendar/providers/wcap/public/_xpidlgen/calIWcapCalendar.h
    ../../../calendar/providers/wcap/public/_xpidlgen/calIWcapErrors.h
    ../../../calendar/providers/wcap/public/_xpidlgen/calIWcapSession.h
    ../../../calendar/base/public/_xpidlgen/calIWeekInfoService.h
    ../../../calendar/base/src/_xpidlgen/calInternalInterfaces.h
    ../../../calendar/libical/src/libical/ical.h
    ../../memory/jemalloc/jemalloc.h
    ../../config/../mozilla-config.h
    ../../xpcom/glue/nsCOMPtr.h
    ../../xpcom/base/nsCycleCollector.h
    ../../xpcom/glue/nsDebug.h
    ../../xpcom/base/nsError.h
    ../../xpcom/glue/nsID.h
    ../../xpcom/base/nsISupportsBase.h
    ../../xpcom/glue/nsISupportsImpl.h
    ../../xpcom/glue/nsISupportsUtils.h
    ../../config/./nsStaticComponents.h
    ../../xpcom/glue/nsTraceRefcnt.h
    ../../xpcom/build/nsXPCOM.h
    ../../xpcom/build/nsXPCOMCID.h
    ../../xpcom/build/nsXPCOMCIDInternal.h
    ../../xpcom/glue/standalone/nsXPCOMGlue.h
    ../../xpcom/string/public/nsXPCOMStrings.h
    ../../xpcom/base/nscore.h
    ../../nsprpub/pr/include/obsolete/
    ../../nsprpub/pr/include/pratom.h
    ../../ipc/chromium/src/base/third_party/nspr/prcpucfg.h
    ../../nsprpub/pr/include/prinrval.h
    ../../nsprpub/pr/include/prlock.h
    ../../nsprpub/pr/include/prthread.h
    ../../nsprpub/pr/include/prtypes.h
    ../../xpcom/xpcom-config.h
    
  2. hmm, unfortunately this fails as well because it still misses a file that is not generated by the “dpkg-buildpackage“ process… the error message is:

    lMozillaTransportAgent.cpp:44: fatal error: nsIXMLHttpRequest.h: No such file or directory
    

Leave a Reply

Your email address will not be published. Required fields are marked *