I'm attempting to build a copy of sqlite with spatialite extensions. I've seen the one or two related posts online related to this issue, but no one seems to have gone all the way.
I've downloaded the spatialite amalgamation, GEOS and PROJ sources. I've created empty Android projects and moved the uncompressed files into the jni/ directory. The wall I'm running into now is creating the jni/Android.mk file. Does anyone have an example for the GEOS or PROJ dependencies? Has anyone been able to work through this process since the last stackexchange question linked to above?
I've set things up to compile spatialite as a shared library, and geos and proj as static libs (statically linked with spatialite). These also need libiconv (AFAIK) since the NDK libc doesn't provide iconv.h.
Fortunately, all of these are LGPL or compatible, so it's safe to include these in your app without fear of license issues.
NOTE: You need to run a './configure' first, inside both libiconv and libspatialite in order to generate headers. This requires 'autoconf' be installed.
Also note, this is on Linux (Ubuntu 10.10).
GEOS can't be built and linked in right now because C++ support for STL is completely missing in the NDK. If anyone can come up with a solution to building GEOS, let us know! I'm not sure how critical it is to have the advanced functions in GEOS, but it saves over 1MB of library size leaving it out according to the README.
Here's my main 'jni/Android.mk'. It could be split up into multiple files but I didn't bother cause I'm lazy :-)
With this you'll need to apply some small patches to the sources to get things pulling in the right headers. The Mac build was close but using -D_APPLE_ caused some other weirdness. I ended up just patching up the parts of libiconv and spatialite that I needed to:
And here's the output:
The resulting library: