From 240923a801382c86545d10be167a15892a556fb6 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Mon, 2 Aug 2010 20:34:47 +0000 Subject: Rockbox as an application: Commit current Android port progress. General state is: Rockbox is usable (plays music, saves configuration, touchscreen works too). Problems: - Playing music in the background (i.e. when switching to another app) doesn't work reliably, but I'm working on that now. - no cabbiev2 (only some preliminary files for it), no other default theme. - screen flickers sometimes if the updates are too frequent - no multi screen apk/package - strange behavior when a phone call comes in The java files (and the eclipse project) resides in android/, which is also supposed to be the build folder. I've put a small README in there for instructions. There are some steps needed after the make part, which are described there, and which eclipse mostly handles. But there ought to be some script/makefile rules which do that instead in the future. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27668 a1c6a512-1295-4272-9138-f99709370657 --- tools/configure | 144 ++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 109 insertions(+), 35 deletions(-) (limited to 'tools/configure') diff --git a/tools/configure b/tools/configure index ce23c2a965..7504d562c9 100755 --- a/tools/configure +++ b/tools/configure @@ -14,6 +14,7 @@ CCOPTS="-W -Wall -Wundef -O -nostdlib -ffreestanding -Wstrict-prototypes -pipe" # global LD options for all platforms GLOBAL_LDOPTS="" +extradefines="" use_logf="#undef ROCKBOX_HAS_LOGF" use_bootchart="#undef DO_BOOTCHART" @@ -25,7 +26,10 @@ bindir= libdir= bindir_full= libdir_full= - + +app_platform= +app_lcd_width= +app_lcd_height= # # Begin Function Definitions # @@ -47,6 +51,59 @@ prefixtools () { OC=${prefix}objcopy } +app_get_platform() { + echo "Select your platform: (S)DL, (A)ndroid (default: Android)" + choice=`input` + case $choice in + s|S*) app_platform="sdl" ;; + *|a|A*) app_platform="android" ;; + esac + + echo "Selected $app_platform platform" + echo "Select the LCD resolution seperated with enter: XxY (default: 320x480)" + app_lcd_width=`input` + if [ -z "$app_lcd_width" ]; then app_lcd_width="320"; fi + app_lcd_height=`input` + if [ -z "$app_lcd_height" ]; then app_lcd_height="480"; fi + echo "Selected $app_lcd_width x $app_lcd_height resolution" + + app_lcd_width="#define LCD_WIDTH $app_lcd_width" + app_lcd_height="#define LCD_HEIGHT $app_lcd_height" + # setup files and paths depending on the platform + if [ "$app_platform" = "sdl" ]; then + if [ -z "$PREFIX" ]; then + rbdir="/usr/local/share/rockbox" + bindir="/usr/local/bin" + bindir_full=$bindir + libdir="/usr/local/lib" + libdir_full=$libdir + else + rbdir=`realpath $PREFIX/share/rockbox` + bindir="$PREFIX/bin" + libdir="$PREFIX/lib" + if [ -d bindir ]; then + bindir_full=`realpath $bindir` + fi + if [ -d libdir ]; then + libdir_full=`realpath $libdir` + fi + fi + output="rockbox" + bootoutput="rockbox" + elif [ "$app_platform" = "android" ]; then + if [ -n "$PREFIX" ]; then + echo "WARNING: PREFIX not supported on Android. You can however use --rbdir" + fi + rbdir="/data/data/org.rockbox/app_rockbox/rockbox" + bindir="/data/data/org.rockbox/lib" + bindir_full=$bindir + libdir="/data/data/org.rockbox/app_rockbox" + libdir_full=$libdir + output="librockbox.so" + bootoutput="librockbox.so" + fi +} + findarmgcc() { if [ "$ARG_ARM_EABI" != "0" ]; then prefixtools arm-elf-eabi- @@ -102,6 +159,15 @@ findsdl(){ done } +appcc () { + if [ "$1" = "sdl" ]; then + simcc "sdl-app" + elif [ "$1" = "android" ]; then + app_type=$1 + androidcc + fi +} + simcc () { # default tool setup for native building @@ -114,15 +180,17 @@ simcc () { GCCOPTIMIZE='' LDOPTS='-lm' # button-sdl.c uses sqrt() - # default output binary name - output="rockboxui" + # default output binary name, don't override app_get_platform() + if [ "$app_type" != "sdl-app" ]; then + output="rockboxui" + fi # default share option, override below if needed SHARED_FLAG="-shared" if [ "$win32crosscompile" = "yes" ]; then LDOPTS="$LDOPTS -mconsole" - output="rockboxui.exe" + output="$output.exe" winbuild="yes" else case $uname in @@ -130,7 +198,7 @@ simcc () { echo "Cygwin host detected" LDOPTS="$LDOPTS -mconsole" - output="rockboxui.exe" + output="$output.exe" winbuild="yes" ;; @@ -138,7 +206,7 @@ simcc () { echo "MinGW host detected" LDOPTS="$LDOPTS -mconsole" - output="rockboxui.exe" + output="$output.exe" winbuild="yes" ;; @@ -188,6 +256,7 @@ simcc () { LDOPTS="$LDOPTS `$sdl --libs`" fi fi + GCCOPTS="$GCCOPTS -I\$(SIMDIR)" @@ -379,6 +448,18 @@ mipselcc () { gccchoice="4.1.2" } +androidcc () { + gccchoice="4.4.0" + prefixtools $ANDROID_NDK_PATH/build/prebuilt/linux-x86/arm-eabi-$gccchoice/bin/arm-eabi- + GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef//` + GCCOPTS="$GCCOPTS -std=gnu99 -ffunction-sections -fno-short-enums -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer" + GLOBAL_LDOPTS="$GLOBAL_LDOPTS -nostdlib -lc -Wl,--no-undefined -Wl,--gc-sections -Wl,-z,noexecstack -L$ANDROID_NDK_PATH/build/platforms/android-4/arch-arm/usr/lib/ -Wl,-rpath-link=$ANDROID_NKD_PATH/build/platforms/android-4/arch-arm/usr/lib" + LDOPTS="$LDOPTS -shared -nostdlib -lm -ldl -llog" + extradefines="$extradefines -DANDROID" + endian="little" + SHARED_FLAG="-shared" +} + whichadvanced () { atype=`echo "$1" | cut -c 2-` ################################################################## @@ -975,7 +1056,7 @@ cat < autoconf.h \ -e "s<@have_backlight@<$have_backlight autoconf.h \ @config_rtc@ @have_rtc_alarm@ +/* lcd dimensions for application builds from configure */ +@lcd_width@ +@lcd_height@ + /* root of Rockbox */ #define ROCKBOX_DIR "@RBDIR@" #define ROCKBOX_BINARY_PATH "@binpath@" @@ -3089,6 +3159,10 @@ if test -n "$t_cpu"; then TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/sdl/" TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/hosted/" fi + if [ -n "$app_platform" -a "$app_platform" = "android" ]; then + # android's gcc doesn't add this :/ + TARGET_INC="$TARGET_INC -I$ANDROID_NDK_PATH/build/platforms/android-4/arch-arm/usr/include" + fi TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu/$t_manufacturer" TARGET_INC="$TARGET_INC -I\$(FIRMDIR)/target/$t_cpu" GCCOPTS="$GCCOPTS" -- cgit v1.2.3