Monday, July 25, 2011

How to Build Funambol

 
Your trail:

HOWTOBuildCapri

THIS PAGE IS OBSOLETE

Don't use it

Please refer to https://core.forge.funambol.org/wiki/BuildingFunambolV7


Introduction

Funambol is migrating all its components (at least when possible) to the Maven building system. You need to be familiar with Maven and its basic concepts in order to fully understand the below steps. You can find more information about Maven in the resource section.Thanks to maven, you do not usually have to worry about CVS and CVS tags (or SVN) in order to work with Funambol. You just need to know which components you need and which version. You do not even have to know how to download the components you need, once you have configured Maven, it will do all the magic for you. All components binaries are published on a public maven repository athttp://m2.funambol.com/repositories, which is where maven will download everything it requires.
As a result of this new build structure, you will be able to package a Funambol distribution without the need of a single line of code. This allows us to decouple the development-compile-test process from the building of a distributable package. It is much easier, for example, set up a continuous integration server that builds nightly all components and make them available on a repository. Then you can easily have a separate packaging process that builds a distributable package containing a subset of the released components.
One of the biggest advantages of this approach is that if you are a developer of a specific component, for example the foundation module, you do not need to know how to build the entire CVS tree to work. You just checkout the component work on it, publish your artifact and you are done.
This document describe how to package a Funambol distribution first, and then how to build the source code.
Note that at the time of writing Ant is still required for some components or as a glue multi-platform scripting language.

Prerequisites

Before moving on, make sure the following pre-requirements are installed in your environment.
  • J2SE 1.5. See its documentation for details about installation.
  • Ant 1.6.5
  • Maven 2.0.9
  • Netbeans 5.5 platform: download the zip file and unpackage it where you want (we will refer to this directory with<NETBEAN_PLATFORM>)
  • Apache Tomcat 6.0.16: download apache-tomcat-6.0.16.zip and save it in <TOOLS>
  • Hypersonic DB 1.8.0: download hsqldb_1_8_0_7.zip (or newer) and save it in <TOOLS>
  • NSIS 2.2x: download the exe file and install it where you want (we will refer to this directory with <NSIS>). You should also install theInetc plug-in copying inetc.dll in <NSIS>\plugin.

Setting up the environment

Your building environment needs some customization.

Setting up Ant

Copy the following jars $ANT_HOME/lib (those files enable ant for scripting and for maven tasks):

Configuring maven

Maven must be configured with the Funambol maven repository. Add the following section to the active maven profile (in $HOME/.m2/settings.xmlor C:\Documents and Settings\<username>\.m2):
<repositories>
  <repository>
    <id>artifacts</id>
    <url>http://m2.funambol.org/repositories/artifacts</url>
  </repository>
  <repository>
    <id>snapshots</id>
    <url>http://m2.funambol.org/repositories/snapshots</url>
  </repository>
</repositories>
<pluginRepositories>
  <pluginRepository>
    <id>artifacts</id>
    <url>http://m2.funambol.org/repositories/artifacts</url>
  </pluginRepository>
  <pluginRepository>
    <id>snapshots</id>
    <url>http://m2.funambol.org/repositories/snapshots</url>
  </pluginRepository>
</pluginRepositories>
See settings.xml for an example.

Preparing JRE zip file for Windows system

Note that this JRE will be included in the bundle and in the Administration Tool for Windows system so if you are not interested on those you can skip this step.
  • Download JRE 1.5.0_xx from SUN website and install it in <JRE>.
  • Zip <JRE> in a file with name jre1.5.0_xx.zip.

This zip file should contain:
jre1.5.0_xx
      bin
      ...
      lib
      ...
Copy the file jre1.5.0_xx.zip in <TOOLS>.

Getting JRE for Linux system

Note that this JRE will be included in the bundle for Linux system so if you are not interested on that you can skip this step.Download jre-1_5_0_xx-linux-i586.bin from SUN website and save it in <TOOLS>.

Getting Funambol sources

In order to get the sources, execute the following commands:cvs -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j login
cvs -z3 -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j co capri

when a password is asked during login command, press Enter. This will checkout the source code in <capri> directory.
In order to checkout a specific release, you should checkout the code using the wanted tag:
cvs -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j login
cvs -z3 -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j co -r tag capri


Configuring the environment

Edit <capri>/forge/build.properties changing the following properties:
  • nbplatform.default.netbeans.dest.dir=<NETBEAN_PLATFORM>
  • tomcat.pkg=<TOOLS>/apache-tomcat-6.0.16.zip
  • tomcat.name=apache-tomcat-6.0.16
  • hsqldb.pkg=<TOOLS>/hsqldb_1_8_0_7.zip
  • hsqldb.name=hsqldb
On Windows system:

  • jre.pkg=<TOOLS>/jre1.5.0_xx.zip
  • nsis.home=<NSIS>
On Linux system:

  • jre.pkg=<TOOLS>/jre-1_5_0_xx-linux-i586.bin
  • jre.name=jre1.5.0_10
Edit <capri>/admin-suite/build.properties changing the following property:

  • nbplatform.default.netbeans.dest.dir=<NETBEAN_PLATFORM>
On Windows system:
  • nsis.home=<NSIS>

Build the bundle

Move under <capri>/forge and run one between the following commands depending on what you want to forge/build:
  • ant forge-bundle-win: forge the bundle for Windows system
  • ant forge-bundle-unix: forge the bundle for Unix/Linux system

Build the Administration tool

If you want to build only the Administration tool, you should download just its code executing the following commands:cvs -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j login
cvs -z3 -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j co 3x/admin-suite

(remember to specify a tag if you want to build a specific version).
Edit admin-suite/build.properties changing the following property:

  • nbplatform.default.netbeans.dest.dir=<NETBEAN_PLATFORM>
On Windows system:
  • nsis.home=<NSIS>
  • jre.pkg=<TOOLS>/jre1.5.0_xx.zip (this property is missing in the build.properties file and must be added)
Then simply move in 3x/admin-suite and run:
  • ant forge-admin-unix: forge the tgz version
  • ant forge-admin-win: forge the exe version for windows
In the target directory you should find the packages.

Build the iPod plugin

If you want to build only the iPod plugin, you should download just its code executing the following commands:cvs -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j login
cvs -z3 -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j co funambol/clients/ipod

(remember to specify a tag if you want to build a specific version).
then simply move in funambol/clients/ipod directory and run:
  • mvn package: forge the tgz version
  • mvn package exec:exec: forge the exe version for windows
In the target directory you should find the packages.

Build the SDK

If you want to build only the SDK, you should download just its code executing the following commands:cvs -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j login
cvs -z3 -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j co funambol/sdk

(remember to specify a tag if you want to build a specific version).
then simply move in funambol/sdk directory and run:
  • mvn package
In the target directory you should find the packages.

Build ALL

For convenience, a script to build all components respecting the dependencies order is available. Check out all the required source code executing the following commands:cvs -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j login
cvs -z3 -d:pserver:anonymous@cvs.forge.objectweb.org:/cvsroot/sync4j co capri-server

(remember to specify a tag if you want to build a specific version).
Configure capri-server/forge/build.properties and capri-server/admin-suite/build.properties as previously specified
Move in capri-server/forge and run:
  • ant forge-all

Resources

Maven resources

No comments:

Post a Comment