As I had some problems to find build howtos to build Funambol last week,
I gathered the information people gave me on the Sync4J mailing list in to
an article. Follow these instructions to build the Funambol 3.0 bundle for
Unix or Linux.


Gathering the dependencies


In order to build the Funambol bundle, you will need several other
softwares or components. There are listed below with a link to their
download page and some comments if necessary.



  • Netbeans
    platform
    : no problem with netbeans, the latest version will do the
    trick


  • JavaCC
    : I tested using the 3.2 version, but newer version might work
    too

  • HSQLDB:
    no problem too, the latest version will be good

  • Java J2SE:
    download both JDK for build and JRE for inclusion in the bundle

  • JUnit:
    last version is ok

  • J2EE:
    there is a problem in the funambol ant scripts starting from J2EE 1.4, a
    fix is proposed in this tutorial. Using this fix, latest version can be
    used.

  • Tomcat: for
    inclusion in the bundle. Works fine using 5.0.30, but earlier version might
    work

  • Ant: the latest
    version works fine


Now that you downloaded all the dependencies, you will install them. To
simplify this tutorial, I assume that everything will happen in the same
<ROOT_DIR> directory and that neither Java, ant nor J2EE are
installed. You may adapt the next steps to your existing installation if you
want.



  • Extract Netbeans platform in <ROOT_DIR>

  • Extract JavaCC in <ROOT_DIR>

  • Extract JUnit in <ROOT_DIR>

  • Extract Ant in <ROOT_DIR>

  • Run JDK installation in <ROOT_DIR> using a command
    like



sh jre-1_5_0_07-linux-i586.bin


  • Run J2EE installation with the following steps and install it in
    <ROOT_DIR>/SUNWappserver



chmod u+x java_ee_sdk-5-linux.bin

./java_ee_sdk-5-linux.bin

The other archives should be left as is because they will only be
included in the Bundle by the Funambol build scripts.


Getting the sources


Now that you have the dependencies, you will have to checkout the latest
Funambol 3.0 sources from the CVS and configure them to find the
dependencies.


Checkout the sources from CVS


In order to get the sources, go into the <ROOT_DIR>
directory using the cd command and then execute the following commands:



cvs -d:pserver:[email protected]:/cvsroot/sync4j login

cvs -z3 -d:pserver:[email protected]:/cvsroot/sync4j co 3x

When a password is asked during the login command, simply press
enter. Now you should have a new 3x directory in your
<ROOT_DIR> containing the Funambol 3.0 sources.


Configure


Now, you will have to change some values in Funambol properties files.
First of all, edit the <ROOT_DIR>/3x/forge/build.properties
file and change the following values:



  • javacc.home=<ROOT_DIR>/javacc-3.2

  • sunj2eesdk-rootdir=<ROOT_DIR>/SUNWappserver

  • tomcat.pkg=<ROOT_DIR>/jakarta-tomcat-5.0.30.zip

  • jre.pkg=<ROOT_DIR>/jre-1_5_0_07-linux-i586.bin

  • hsqldb.pkg=<ROOT_DIR>/hsqldb_1_8_0_4.zip


As you might have remarked in the preceeding value, I used the latest
versions of the JRE and HSQLDB. You will have to adapt these values to the
names of the files you have downloaded. You should also change some other
values:



  • jre.name=jre1.5.0_07

  • tomcat.name=jakarta-tomcat-5.0.30

  • hsqldb.name=hsqldb


To obtain these values, just temporarily extract Tomcat, the JRE and
HSQLDB the generated directories names will be your values.


To complete this configuration, set the following value in
<ROOT_DIR>/3x/admin-suite/build.properties:




  • nbplatform.default.netbeans.dest.dir=<ROOT_DIR>/netbeans


Build


Last but not least, you will have to run to scripts to build the Funambol
3.0 bundle. For this, follow the next steps:



export CLASSPATH=<ROOT_DIR>/junit4.1/junit-4.1.jar

export PATH=<ROOT_DIR>/apache-ant-1.6.5/bin:<ROOT_DIR>/jdk1.5.0_07/bin:$PATH

export JAVA_HOME=<ROOT_DIR>/jdk1.5.0_07

Then go to the <ROOT_DIR>/3x/forge directory and run the
following command to build the unix bundle. To get the list of all the
targets available for the build, simply run ant without any target.



ant forge-bundle-unix

Now you can get the generated bundle in the
<ROOT_DIR>/3x/output directory.


Bug for J2EE 1.4 and 1.5


In these versions of the J2EE, the jar used to build the pimweb module
(j2ee.jar) is empty. Its content is now in javaee.jar. Thus
you will have to edit the
<ROOT_DIR>/3x/modules/pimweb/build/build.xml file and change
the line



<property name="j2ee.jar" value="${sunj2eesdk-rootdir}/lib/j2ee.jar" />

into



<property name="j2ee.jar" value="${sunj2eesdk-rootdir}/lib/javaee.jar" />

For a better
issue description
and
patch
, please refer to the sync4j objectweb forge project.


(Post originally written by Cedric Bosdonnat on the old Nuxeo blogs.)