On Mon, 20 Feb 2012 18:46:59 -0800 (PST)
Doug Snead <semaphore_2...@yahoo.com> wrote:

> More android + picolisp fun, this time with the full picolisp.  Using
> the android SDK and NDK, I hacked a picolisp/src/makefile to work for
> android's arm processor like this: 
> 
> ----------- makefile -----------
> [snip]
> 
> CFLAGS := -c -O2  -pipe \
>         -falign-functions=64 -fomit-frame-pointer
> -fno-strict-aliasing \ -W -Wimplicit -Wreturn-type -Wunused -Wformat \
>         -Wuninitialized -Wstrict-prototypes \
>         -D_GNU_SOURCE  -D_FILE_OFFSET_BITS=64
> # ?? had: -m32
> 
> NDK_ROOT = ~/android/android-ndk-r7
> NDK_BIN =
> $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin
> SYS_ROOT = $(NDK_ROOT)/platforms/android-8/arch-arm/ CC =
> $(NDK_BIN)/arm-linux-androideabi-gcc --sysroot=$(SYS_ROOT) LD =
> $(NDK_BIN)/arm-linux-androideabi-ld AR =
> $(NDK_BIN)/arm-linux-androideabi-ar RANLIB =
> $(NDK_BIN)/arm-linux-androideabi-ranlib STRIP =
> $(NDK_BIN)/arm-linux-androideabi-strip
> 
>         OS = Arm
>         PICOLISP-FLAGS = -m32 -rdynamic
>         LIB-FLAGS = -lc -lm -ldl
>         DYNAMIC-LIB-FLAGS = -m32 -shared -export-dynamic
> 
> [snip]
> ---------------------
> 
> Then (to my surprise) picolisp and dynamic libraries were made,
> 
> # file ../bin/picolisp  ../lib/ext  ../lib/ht ../lib/z3d  
> ../bin/picolisp: ELF 32-bit LSB executable, ARM, version 1 (SYSV),
> dynamically linked (uses shared libs), stripped ../lib/ext:      ELF
> 32-bit LSB shared object, ARM, version 1 (SYSV), stripped ../lib/ht:
>      ELF 32-bit LSB shared object, ARM, version 1 (SYSV),
> stripped ../lib/z3d:      ELF 32-bit LSB shared object, ARM, version
> 1 (SYSV), stripped
> 
> So far so good...
> 
> Using this android approach generally,
> 
> http://gimite.net/en/index.php?Run%20native%20executable%20in%20Android%20App
> 
> I placed the picolisp executable in the assets dir and at run-time,
> copy it from assets to /data/data/ in the right place for that app.   
> 
> Since I'm using the emulator and I know where the executable was
> placed, I can run it using adb, for some command-line tests:
> 
> # adb shell /data/data/com.mytest/picolisp '-de foo ("X") (println
> "X")'  '-foo 123' -bye 123
> 
> # adb shell /data/data/com.mytest/picolisp '-de foo ("X") (println (*
> "X" 2))'  '-foo 123' -bye 246
> 
> # adb shell /data/data/com.mytest/picolisp '-de foo ("X") (println (*
> "X" 2))'  '-foo 12345' -bye 24690
> 
> A bit cumbersome having to unpack the executable and other files from
> the app's .apk (zip archive) to run it ... but it can be done.  And
> no fiddling with bits ... no changes to the (full picolisp) source at
> all.   
> 
> Next step is to try to similarly unpack all the libraries and see if
> a picolisp database server application can be run. Then more
> testing.  And use that with android's browser, all within an android
> app. 
> 
> But I'm very confident that the full picolisp will run on the android
> from what I see so far! 
> 
> There are ways to call java from C also, so that opens up
> possibilities of using android java libraries from android picolisp
> too. 
> 
> Cheers,
> 
> Doug
> 

Wow! that's awesome! I have always wanted to write a game for Android
but i dislike Java, I gotta give this a go when I have a bit more free
time.

Keep up the good work!
--José.
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to