diff options
author | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-08-17 21:06:58 +0000 |
---|---|---|
committer | Maurus Cuelenaere <mcuelenaere@gmail.com> | 2010-08-17 21:06:58 +0000 |
commit | cc5f0168350723809225ff59b93906809a2b55e9 (patch) | |
tree | 6acf0e4b075a7d08565e15306e8545a4ae1e15f4 /android | |
parent | eca68ee4b20a75e7b4cfed52711a49c98e911549 (diff) | |
download | rockbox-cc5f0168350723809225ff59b93906809a2b55e9.tar.gz rockbox-cc5f0168350723809225ff59b93906809a2b55e9.zip |
Android port: add build script
This allows building the Java part of the port with only requiring the Android SDK + javac installed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27839 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'android')
-rwxr-xr-x | android/build.sh | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/android/build.sh b/android/build.sh new file mode 100755 index 0000000000..e68718a39a --- /dev/null +++ b/android/build.sh @@ -0,0 +1,63 @@ +#!/bin/sh +############################################################################ +# __________ __ ___. +# Open \______ \ ____ ____ | | _\_ |__ _______ ___ +# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +# \/ \/ \/ \/ \/ +# $Id$ +# +# Copyright (C) 2010 by Maurus Cuelenaere +# +# All files in this archive are subject to the GNU General Public License. +# See the file COPYING in the source tree root for full license agreement. +# +# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY +# KIND, either express or implied. +# +############################################################################ + +# TODO: convert this into a Makefile + +ROCKBOX_DIR=`dirname $0` + +if [ -z "$ANDROID_SDK_PATH" ]; then + echo "Please set \$ANDROID_SDK_PATH!" + exit 0 +fi + +if [ -z "$ANDROID_PLATFORM_VERSION" ]; then + ANDROID_PLATFORM_VERSION=8 +fi + +ANDROID_PLATFORM="$ANDROID_SDK_PATH/platforms/android-$ANDROID_PLATFORM_VERSION" +AAPT="$ANDROID_PLATFORM/tools/aapt" +DX="$ANDROID_PLATFORM/tools/dx" +APKBUILDER="$ANDROID_SDK_PATH/tools/apkbuilder" + +if [ \! -d "$ANDROID_PLATFORM" ]; then + echo "Can't find Android platform v$ANDROID_PLATFORM_VERSION!" + exit 0 +fi + +if [ -d "$ROCKBOX_DIR/bin" ]; then + echo "[CLEAN] bin/" + rm -rf $ROCKBOX_DIR/bin +fi + +mkdir $ROCKBOX_DIR/bin + +echo "[AAPT] bin/resources.ap_" +$AAPT package -f -m -J $ROCKBOX_DIR/gen -M $ROCKBOX_DIR/AndroidManifest.xml -S $ROCKBOX_DIR/res -I $ANDROID_PLATFORM/android.jar -F $ROCKBOX_DIR/bin/resources.ap_ + +for file in `find $ROCKBOX_DIR \( -wholename '*src/*' -o -wholename '*gen/*' \) -a -name '*.java'`; do + echo "[JAVAC] `echo $file | sed 's/'$ROCKBOX_DIR'\///'`" + javac -d $ROCKBOX_DIR/bin -classpath $ANDROID_PLATFORM/android.jar:$ROCKBOX_DIR/bin -sourcepath $ROCKBOX_DIR/src:$ROCKBOX_DIR/gen $file +done + +echo "[DEX] bin/classes.dex" +$DX --dex --output=$ROCKBOX_DIR/bin/classes.dex $ROCKBOX_DIR/bin + +echo "[APKBUILDER] bin/Rockbox.apk" +$APKBUILDER $ROCKBOX_DIR/bin/Rockbox.apk -u -z $ROCKBOX_DIR/bin/resources.ap_ -f $ROCKBOX_DIR/bin/classes.dex |