Permalink
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 91 lines (74 sloc) 1.77 KB
#!/bin/bash
usage()
{
cat <<EOF
Usage:
--with-mfa-path=PATH Mono for Android directory (default: /Developer/MonoAndroid/usr)
--out output directory (default: bin/)
--with-android-path Android SDK path (default: /opt/android/sdk)
--api-levels Space-separated list of supported api levels (default: 8)
EOF
}
if [ -z $ANDROID_SDK_PATH ]; then
ANDROID_SDK_PATH=/opt/android/sdk
fi
echo "Configuring..."
cat >config.log <<EOF
$ $0 $@
EOF
CNF=env.config
SH=env.sh
cnf_append()
{
printf "%-30s := %s\n" "$1" "$2" >> $CNF
}
sh_append()
{
printf "%s=%s\n" "$1" "$2" >> $SH
}
MONO_ANDROID_PATH="/Developer/MonoAndroid/usr"
BUILDDIR="bin"
API_LEVELS=8
for arg; do
case "$arg" in
--help | -h)
usage
exit 1
;;
--out=*)
BUILDDIR=$(echo $arg|sed -e 's,.*=,,')
;;
--with-mfa-path=*)
MONO_ANDROID_PATH=$(echo $arg|sed -e 's,.*=,,')
;;
--with-android-path=*)
ANDROID_SDK_PATH=$(echo $arg|sed -e 's,.*=,,')
;;
--api-levels=*)
API_LEVELS=$(echo $arg|sed -e 's,.*=,,')
;;
esac
done
if [ ! -d $ANDROID_SDK_PATH ]; then
echo "----------------------------------------------";
echo "Cannot find android sdk path.";
echo "set the ANDROID_SDK_PATH env var";
echo "----------------------------------------------";
usage
exit 1
fi
rm -f $CNF
rm -f $SH
cnf_append "ANDROID_SDK_PATH" "$ANDROID_SDK_PATH"
sh_append "ANDROID_SDK_PATH" "$ANDROID_SDK_PATH"
cnf_append "MONO_ANDROID_PATH" "$MONO_ANDROID_PATH"
sh_append "MONO_ANDROID_PATH" "$MONO_ANDROID_PATH"
cnf_append "API_LEVELS" "$API_LEVELS"
sh_append "API_LEVELS" "$API_LEVELS"
cnf_append "TOP" "$(pwd)"
sh_append "TOP" "$(pwd)"
cnf_append "BUILDDIR" "$(pwd)/$BUILDDIR"
sh_append "BUILDDIR" "$(pwd)/$BUILDDIR"
cat <<EOF
Configuration done.
EOF