After messing around for two days trying to get Python running on Android, I decided to give Lua a try. It didn't take much to get the interpreter running (especially compared to Python which still isn't running for me). Here's a very small patch for Lua 5.1.4.
diff -r lua-5.1.4/src/llex.c lua-5.1.4-android/src/llex.cYou'll also need get the Android source and build it. Then grab agcc (a small Perl script) linked to from some brief instructions about compiling native code for Android. Here are some even briefer instructions for getting Lua on your G1 :)
< struct lconv *cv = localeconv();
> //struct lconv *cv = localeconv();
< ls->decpoint = (cv ? cv->decimal_point : '.');
> ls->decpoint = '.';//(cv ? cv->decimal_point : '.');
diff -r lua-5.1.4/src/lvm.c lua-5.1.4-android/src/lvm.c
< int temp = strcoll(l, r);
> int temp = strcmp(l, r);//strcoll(l, r);
agccto your path.
mydroid/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/binto your path (the Android toolchain).
mydroid/out/host/linux-x86/binto your path (the Android development tools).
- Build and install Lua.
$ make CC=agcc AR="arm-eabi-ar rcu" RANLIB=arm-eabi-ranlib posix
$ make INSTALL_TOP=$(pwd)/lua-android install
- Copy Lua to your phone/emulator using
$ cd lua-androidYou can now either run Lua from
$ rm -rf man
$ adb shell
# cd data
# mkdir bin include lib share
$ adb push . data
adb shellor by installing the terminal emulator app and running it directly on your phone.
I fixed some bugs in the instructions. :)