summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xandroid/build.sh63
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 @@
1#!/bin/sh
2############################################################################
3# __________ __ ___.
4# Open \______ \ ____ ____ | | _\_ |__ _______ ___
5# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8# \/ \/ \/ \/ \/
9# $Id$
10#
11# Copyright (C) 2010 by Maurus Cuelenaere
12#
13# All files in this archive are subject to the GNU General Public License.
14# See the file COPYING in the source tree root for full license agreement.
15#
16# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
17# KIND, either express or implied.
18#
19############################################################################
20
21# TODO: convert this into a Makefile
22
23ROCKBOX_DIR=`dirname $0`
24
25if [ -z "$ANDROID_SDK_PATH" ]; then
26 echo "Please set \$ANDROID_SDK_PATH!"
27 exit 0
28fi
29
30if [ -z "$ANDROID_PLATFORM_VERSION" ]; then
31 ANDROID_PLATFORM_VERSION=8
32fi
33
34ANDROID_PLATFORM="$ANDROID_SDK_PATH/platforms/android-$ANDROID_PLATFORM_VERSION"
35AAPT="$ANDROID_PLATFORM/tools/aapt"
36DX="$ANDROID_PLATFORM/tools/dx"
37APKBUILDER="$ANDROID_SDK_PATH/tools/apkbuilder"
38
39if [ \! -d "$ANDROID_PLATFORM" ]; then
40 echo "Can't find Android platform v$ANDROID_PLATFORM_VERSION!"
41 exit 0
42fi
43
44if [ -d "$ROCKBOX_DIR/bin" ]; then
45 echo "[CLEAN] bin/"
46 rm -rf $ROCKBOX_DIR/bin
47fi
48
49mkdir $ROCKBOX_DIR/bin
50
51echo "[AAPT] bin/resources.ap_"
52$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_
53
54for file in `find $ROCKBOX_DIR \( -wholename '*src/*' -o -wholename '*gen/*' \) -a -name '*.java'`; do
55 echo "[JAVAC] `echo $file | sed 's/'$ROCKBOX_DIR'\///'`"
56 javac -d $ROCKBOX_DIR/bin -classpath $ANDROID_PLATFORM/android.jar:$ROCKBOX_DIR/bin -sourcepath $ROCKBOX_DIR/src:$ROCKBOX_DIR/gen $file
57done
58
59echo "[DEX] bin/classes.dex"
60$DX --dex --output=$ROCKBOX_DIR/bin/classes.dex $ROCKBOX_DIR/bin
61
62echo "[APKBUILDER] bin/Rockbox.apk"
63$APKBUILDER $ROCKBOX_DIR/bin/Rockbox.apk -u -z $ROCKBOX_DIR/bin/resources.ap_ -f $ROCKBOX_DIR/bin/classes.dex