Version 2 (modified by 12 years ago) (diff) | ,
---|
Compiling libpurple on Android
There are build scripts in Monotone that build the libraries on which libpurple depends automatically. But you need to set up your host Programms, mainly Eclipse and the Android SDK/NDK.
Follow these steps to set up a new Development platform. I recommend that even if you already have Eclipse or the SDK/NDK installed, you should download everything and start from scratch.
I gess you will need about one hour to set up your IDE, and afterwards another hour for the automated build.
Install required developer tools
Make sure you have the following things installed (the list may or may not be complete ;-)): a current JDK, patch, autoconf, pkg-config, gtk-doc-tools, GNU make and xzip
get the source
Check out the Android branch im.pidgin.soc.2012.android into a new working directory.
Eclipse
You need Eclipse IDE with C and Java Support. For this, I recommend you download Eclipse Classic or Eclipse IDE for Java developers. Files can be found at http://www.eclipse.org/downloads/. Eclipse does not need an installation, just extract the archive somewhere.
Start it:
The executeable is in the Eclipse directory you just downloaded.
It will prompt you for a workspace. You can android/workspace subdirectory in the Android branch, or any other directory you like. The worksapce appears to be empty because eclipse does not know that there are already projects in it.
There may be errors in the projects, because you first need to install the Android plugin.
Install C:
Go to Help → Install new Software. Select the update site for your Eclipse version. Then install "Programming languages" → "C/C++ Development tools"
Install Ant contrib
Download ant-contrib, extract the archive somewhere.
Go to Window → preferences → Ant → Runtime. In the Classpath tab, select Global Entries from the list and click on "Add external JARs". Select the ant-contrib-*.jar you just downloaded.
Now go to the properties tab. Add a property named "ndk.root" which has the value "${ndk.root}", and one named "ndk.host" with the value "${ndk.host}"
Add the projects:
To tell eclipse that the projects exist, add them to eclipse: File → Import... → Existing projects into Workspace. Selest the android/workspace directory and all projects eclipse automatically finds.
Android Tools
Download
Download Android SDK + extract (recommended: r18) http://developer.android.com/sdk/index.html
Download Android NDK + extract (recommended: r8) http://developer.android.com/sdk/ndk/index.html
Install Eclipse plugin
If you encounter problems here, this page covers the issue with more details: http://developer.android.com/sdk/eclipse-adt.html#installing
In Eclipse, Go to Help → Install new Software.
Select the Android update site: https://dl-ssl.google.com/android/eclipse/
Select everything
Click on "next", "next", "accept", "finish"
Restart Eclipse when the plugin is installed.
Configure Android SDK
Click on Window → Preferences, Select Android from the left panel. Enter the directory where you downloaded the SDK. Apply.
Open the SDK Manager (if Eclipse has not prompted you to do it: Window → Android SDK Manager). Select "Tools" and "Android 2.3.3 (API 10)" and install. Android should have created an AVD for you.
Configure Android NDK
Create a custom toolchain: Execute the following command in the ndk directory. Remember the install directory.
build/tools/make-standalone-toolchain.sh --platform=android-9 --install-dir=<some-new-dir>
Enter the install directory in eclipse in Preferences → String Substitution as ndk.root and add a new substitution "ndk.host" with the value arm-linux-androideabi
Currently, only arm is supported.
Build it
Go to Project → Clean Projects... and clean all projects. Then let Eclipse rebuild if it did not do it automatically. This may take some time.
Explore the Workspace
There are several projects:
- im.pidgin.libpurple.build
- Needed 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. If you want to rebuild a library, just touch the buildfile for that library. If you touch common.ant, all libraries will be rebuild.
Problems
glib-compile-resources not found
Update glib on your host.
Problems with undefined pthread types, e.g. pthread_rwlock_t
Use the android-9 toolchain or newer.