#!/bin/sh
#
# Rebuild the tcl for ASE distribution zip files.
#

# Build the tclkit if required
if [ ! -f tclkit-android-arm ]; then
    rm -f kit-cli
    make CC=agcc-ndk
fi

# Construct the zip files.
[ -d tclsh ] || mkdir tclsh
[ -d tclsh/lib ] || mkdir tclsh/lib
cp tclkit-android-arm tclsh/tclsh
cp -pR ext/* tclsh/lib
cp /opt/src/ase/tcl/ase/android.tcl tclsh/lib/android-1.1.tm
cp /opt/src/tcllib/modules/json/json.tcl tclsh/lib/json-1.1.tm
cp -pR build/lib/thread2.6.5 tclsh/lib
zip -r tclsh_r1.zip tclsh
(cd extras; zip -r ../tclsh_extras_r1.zip .)
zip -jr tclsh_scripts_r1.zip scripts

# Push onto the phone.
for file in tclsh_r1.zip tclsh_scripts_r1.zip tclsh_extras_r1.zip
do
    :
    adb push $file /sdcard/
done

