Version 6 (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 soc.2012.android from the android repository 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 choose 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.
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.
There may be errors in the projects, because you first need to install the Android plugin.
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 root directory of that toolchain (not the sysroot 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
Disable Project → Build automatically. Then go to Project → Clean Projects... and clean all projects.
Select the im.pidgin.libpurple.build project and click on Project → Build Project. This will take a while.
Then select the testclient and click on Project → Build Project. This will also build the jni bindings.
You can now re-enable auto builds, they work in both im.pidgin.libpurple and im.pidgin.libpurple.testclient.
Explore the Workspace
There is an extra page on the project structure of the android projects.
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.
Headers/Files? generated by build scripts are not marked as derived.
This is not possible in eclipse. See Eclipse bug 150578 and 30440
Build failed with "bad substitution" / Build uses normal gcc instead of the android one.
Be sure to have ndk.root and ndk.host set.