| 1 | = Structure of the Android Port = |
| 2 | There is a workspace in android/workspace, that contains three eclipse projects: |
| 3 | |
| 4 | == im.pidgin.libpurple == |
| 5 | Depends on im.pidgin.libpurple.build, so that the build scripts are always executed when you build this project. |
| 6 | |
| 7 | 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: |
| 8 | * Extract C constants |
| 9 | * Generate JNI headers |
| 10 | * Run android resource manager |
| 11 | * Compile the C sources |
| 12 | * Compile the Java files |
| 13 | * Run Android compiler |
| 14 | * Create distribution files |
| 15 | '''(TODO: Check if this lis is optimal and in sync with project)''' |
| 16 | |
| 17 | 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. |
| 18 | |
| 19 | === Native Methods === |
| 20 | Native methods end in _native. They use a jlong to store pointers. |
| 21 | |
| 22 | 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.) |
| 23 | |
| 24 | == im.pidgin.libpurple.build == |
| 25 | This project contains teeded utilities to build libpurple and its requirements. |
| 26 | The direcotry buildscripts contains all the files that build the required projects. |
| 27 | They are included in the eclipse build process, so that all libraries get downloaded and compiled automatically once you have eclipse set up. |
| 28 | |
| 29 | If you want to rebuild a library, just touch the buildfile for that library. If you touch common.ant, all libraries will be rebuild. |
| 30 | 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. |
| 31 | |
| 32 | 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). |
| 33 | |
| 34 | === Build Process === |
| 35 | All buildscripst are registered as eclipse ant builder in the right order. Each build script does the following steps: |
| 36 | * Download the source tar.gz or tar.bz2 archive for the requested version. |
| 37 | * Patch config.sub to contain an the android os. |
| 38 | * Apply a patch on the source (optional) |
| 39 | * Run configure with the right toolchain and target |
| 40 | * Run make && make install |
| 41 | |
| 42 | The file common.ant contains operations that are used by most build scripts. |
| 43 | |
| 44 | === Updating === |
| 45 | 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. |
| 46 | |
| 47 | === Constant extraction === |
| 48 | |
| 49 | The builds project is also configured as a java project that provides an ant rule to extract Constants from a C file. |
| 50 | |
| 51 | === .so file renaming === |
| 52 | 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. |