Trac is being migrated to new services! Issues can be found in our new YouTrack instance and WIKI pages can be found on our website.

Structure of the Android Port

There is a workspace in android/workspace, that contains three eclipse projects:

im.pidgin.libpurple

Depends on im.pidgin.libpurple.build, so that the build scripts are always executed when you build this project.

This project contains all sources for the jni in a native direcotry. It also contains all sources for the java files. It is configured as both, java and C project, with the following build order:

  • Extract C constants
  • Generate JNI headers
  • Compile the C sources
  • Run android resource manager
  • Compile the Java files
  • Run Android compiler
  • Create distribution files

The process includes scripts that generate the headers automatically and extract Constants from C files to use them in Java, so you do not have to worry about this.

Native Methods

Native methods end in _native. They use a jlong to store pointers.

If you added a new native method to java, run a build to generate the corrosponding header (if your java file does not contain any native mehtods yet, it is most likely not listed in the native/build.xml, so add it there.)

im.pidgin.libpurple.build

This project contains teeded utilities to build libpurple and its requirements. The direcotry buildscripts contains all the files that build the required projects. They are included in the eclipse build process, so that all libraries get downloaded and compiled automatically once you have eclipse set up.

If you want to rebuild a library, just touch the buildfile for that library. If you touch common.ant, all libraries will be rebuild. To compile from scratch, remove the contant of the build directory and touch common.ant. The files won't get downloaded again because they are stored in the downlaods direcotry.

If you change something in the build directory, the rebuild process won't start automatically, because it is not possible to tell eclipse which files are generated and which are not from an ant script and because of that, eclipse would rebuild next time even if the change was done by a build script (which would mean on every build).

Build Process

All buildscripst are registered as eclipse ant builder in the right order. Each build script does the following steps:

  • Download the source tar.gz or tar.bz2 archive for the requested version.
  • Patch config.sub to contain an the android os.
  • Apply a patch on the source (optional)
  • Run configure with the right toolchain and target
  • Run make && make install

The file common.ant contains operations that are used by most build scripts.

Updating

To update a library, simply change the version number. You should remove the build files of dependent libraries and touch common.ant if you want to force a compleate rebuild of them.

Constant extraction

The builds project is also configured as a java project that provides an ant rule to extract Constants from a C file.

.so file renaming

The builds project also provides a class that renames .so.x (where x is a number) to .x.so files. This is needed because android exprects libraries to be of the form lib*.so.

Last modified 12 years ago Last modified on Jun 16, 2012, 7:39:28 AM
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!