Have been working on getting all the haskell libraries git-annex uses built with the android cross compiler. Difficulties so far are libraries that need tweaks to work with the new version of ghc, and some that use cabal in ways that break cross compilation. Haskell's network library was the last and most challenging of those.
At this point, I'm able to start trying to build git-annex for android. Here's the first try!
joey@gnu:~/src/git-annex>cabal install -w $HOME/.ghc-android-14-arm-linux-androideabi-4.7/bin/arm-unknown-linux-androideabi-ghc --with-ghc-pkg=$HOME/.ghc-android-14-arm-linux-androideabi-4.7/bin/arm-unknown-linux-androideabi-ghc-pkg --with-ld=$HOME/.ghc-android-14-arm-linux-androideabi-4.7/bin/arm-linux-androideabi-ld --flags="-Webapp -WebDAV -XMPP -S3 -Dbus" Resolving dependencies... Configuring git-annex-3.20130207... Building git-annex-3.20130207... Preprocessing executable 'git-annex' for git-annex-3.20130207... on the commandline: Warning: -package-conf is deprecated: Use -package-db instead Utility/libdiskfree.c:28:26: fatal error: sys/statvfs.h: No such file or directory compilation terminated.
Should not be far from a first android build now..
While I already have Android "hello world" executables to try, I have not yet been able to run them. Can't seem to find a directory I can write to on the Asus Transformer, with a filesystem that supports the +x bit. Do you really have to root Android just to run simple binaries? I'm crying inside.
It seems that the blessed Android NDK way would involve making a Java app, that pulls in a shared library that contains the native code. For haskell, the library will need to contain a C shim that, probably, calls an entry point to the Haskell runtime system. Once running, it can use the FFI to communicate back to the Java side, probably. The good news is that CJ van den Berg, who already saved my bacon once by developing ghc-android, tells me he's hard at work on that very thing.
In the meantime, downloaded the Android SDK. Have gotten it to build a
.apk
package from just javascript code, and managed to do it without
using eclipse (thank god). Will need this later, but for now want to wash
my brain out with soap after using it.
See http://kevinboone.net/android_nonroot.html for info on where in the android filesystem you have write, exec ability.
Basically you have these abilities in
/data/local
fromadb shell
(and in debuggable app's folders using run-as withadb shell
), and in/data/data/<app_id>/
for each app (for example the terminal emulator's data dir when using the terminal emulator).It might be possible to just have temporary root using an old exploit and writing up a bit of code to just setuid on the process and exec sh (source for nachoroot exploit https://github.com/CunningLogic/NachoRoot).
It is possible to install a distro without root using a chroot faker.
I am working here https://sites.google.com/site/taldewandroid/ on a way to install the OpenWrt distro on Android. This is working on my phone already for quite a while! So far only sketchy notes are up, but more to come, G-d willing.