summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/android.make6
-rwxr-xr-xtools/configure106
2 files changed, 59 insertions, 53 deletions
diff --git a/android/android.make b/android/android.make
index b36943b673..9e50e6ce70 100644
--- a/android/android.make
+++ b/android/android.make
@@ -28,11 +28,13 @@ $(CPUFEAT_BUILD)/cpu-features.o: $(CPUFEAT)/cpu-features.c
28.PHONY: apk classes clean dex dirs libs jar 28.PHONY: apk classes clean dex dirs libs jar
29 29
30# API version 30# API version
31ANDROID_PLATFORM_VERSION=19 31#ANDROID_PLATFORM_VERSION=19 # Set by configure script
32ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION) 32ANDROID_PLATFORM=$(ANDROID_SDK_PATH)/platforms/android-$(ANDROID_PLATFORM_VERSION)
33 33
34# Use oldest version available..
35BUILD_TOOLS_VERSION=$(notdir $(firstword $(wildcard $(ANDROID_SDK_PATH)/build-tools/*)))
36
34# android tools 37# android tools
35BUILD_TOOLS_VERSION=$(notdir $(firstword $(wildcard $(ANDROID_SDK_PATH)/build-tools/$(ANDROID_PLATFORM_VERSION).*)))
36AAPT=$(ANDROID_SDK_PATH)/build-tools/$(BUILD_TOOLS_VERSION)/aapt 38AAPT=$(ANDROID_SDK_PATH)/build-tools/$(BUILD_TOOLS_VERSION)/aapt
37DX=$(ANDROID_SDK_PATH)/build-tools/$(BUILD_TOOLS_VERSION)/dx 39DX=$(ANDROID_SDK_PATH)/build-tools/$(BUILD_TOOLS_VERSION)/dx
38ifneq ("$(wildcard $(ANDROID_SDK_PATH)/tools/zipalign)","") 40ifneq ("$(wildcard $(ANDROID_SDK_PATH)/tools/zipalign)","")
diff --git a/tools/configure b/tools/configure
index 4b2b1ce829..099e25d080 100755
--- a/tools/configure
+++ b/tools/configure
@@ -757,11 +757,14 @@ androidcc () {
757 exit 757 exit
758 fi 758 fi
759 if [ -z "$ANDROID_NDK_PATH" ]; then 759 if [ -z "$ANDROID_NDK_PATH" ]; then
760 echo "ERROR: You need the Android NDK installed (r16 or higher) and have the ANDROID_NDK_PATH" 760 echo "ERROR: You need the Android NDK installed (r10e or higher) and have the ANDROID_NDK_PATH"
761 echo "environment variable point to the root directory of the Android NDK." 761 echo "environment variable point to the root directory of the Android NDK."
762 exit 762 exit
763 fi 763 fi
764 buildhost=$(uname | tr "[:upper:]" "[:lower:]") 764 make_toolchain="${ANDROID_NDK_PATH}/build/tools/make-standalone-toolchain.sh"
765
766 # the prebuilt android NDK only supports x86_64 architecture anyway, so we can take shortcuts
767 buildhost=$(uname | tr "[:upper:]" "[:lower:]")-x86_64
765 GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef//` 768 GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef//`
766 LDOPTS="$LDOPTS -ldl -llog" 769 LDOPTS="$LDOPTS -ldl -llog"
767 if [ "$modelname" != "ibassodx50" ] && [ "$modelname" != "ibassodx90" ]; then 770 if [ "$modelname" != "ibassodx50" ] && [ "$modelname" != "ibassodx90" ]; then
@@ -770,59 +773,61 @@ androidcc () {
770 SHARED_LDFLAG="-shared" 773 SHARED_LDFLAG="-shared"
771 SHARED_CFLAGS='' 774 SHARED_CFLAGS=''
772 GLOBAL_LDOPTS="-Wl,-z,defs -Wl,-z,noexecstack" 775 GLOBAL_LDOPTS="-Wl,-z,defs -Wl,-z,noexecstack"
773 ANDROID_ARCH=$1 # for android.make too 776 thread_support="HAVE_SIGALTSTACK_THREADS"
774 gccchoice="4.6" 777 ANDROID_ARCH=$2 # for android.make too
778 ANDROID_PLATFORM_VERSION=$1
779 gccchoice="4.9"
775 # arch dependant stuff 780 # arch dependant stuff
776 case $ANDROID_ARCH in 781 case $ANDROID_ARCH in
777 armeabi) 782 armeabi)
778 endian="little" 783 endian="little"
779 gcctarget="arm-linux-androideabi-" 784 gcctarget="arm-linux-androideabi-"
780 # sigaltstack is not available in pre-android-9, however asm 785 echo "${make_toolchain} --toolchain=arm-linux-androideabi-${gccchoice} --platform=android-$ANDROID_PLATFORM_VERSION --install-dir=${pwd}/android-toolchain"
781 # threads work fine so far 786 ${make_toolchain} --toolchain=arm-linux-androideabi-${gccchoice} --platform=android-$ANDROID_PLATFORM_VERSION --install-dir=${pwd}/android-toolchain
782 thread_support="ASSEMBLER_THREADS" 787 if [ ${?} != 0 ]; then
783 GCCOPTS="$GCCOPTS -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer \ 788 exit
784 --sysroot=$ANDROID_NDK_PATH/platforms/android-16/arch-arm" 789 fi
785 LDOPTS="$LDOPTS --sysroot=$ANDROID_NDK_PATH/platforms/android-16/arch-arm" 790 GCCOPTS="$GCCOPTS -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer -fuse-ld=bfd"
786 ;; 791 ;;
787 mips) 792 mips)
788 endian="little" 793 endian="little"
789 gcctarget="mipsel-linux-android-" 794 gcctarget="mipsel-linux-android-"
790 thread_support="HAVE_SIGALTSTACK_THREADS" 795 echo "${make_toolchain} --toolchain=mipsel-linux-android-${gccchoice} --platform=android-$ANDROID_PLATFORM_VERSION --install-dir=${pwd}/android-toolchain"
791 GCCOPTS="$GCCOPTS -march=mips32 -mtune=r4600 -mno-mips16 -mno-long-calls -fomit-frame-pointer \ 796 ${make_toolchain} --toolchain=mipsel-linux-android-${gccchoice} --platform=android-$ANDROID_PLATFORM_VERSION --install-dir=${pwd}/android-toolchain
792 --sysroot=$ANDROID_NDK_PATH/platforms/android-14/arch-mips -fPIC" 797 if [ ${?} != 0 ]; then
793 LDOPTS="$LDOPTS --sysroot=$ANDROID_NDK_PATH/platforms/android-14/arch-mips" 798 exit
799 fi
800 GCCOPTS="$GCCOPTS -march=mips32 -mtune=r4600 -mno-mips16 -mno-long-calls -fomit-frame-pointer -fPIC"
794 ;; 801 ;;
795 x86) 802 x86)
796 endian="little" 803 endian="little"
797 gcctarget="i686-linux-android-" 804 gcctarget="i686-linux-android-"
798 gccdir=x86-$gccchoice 805 echo "${make_toolchain} --toolchain=x86-${gccchoice} --platform=android-android-$ANDROID_PLATFORM_VERSION --install-dir=${pwd}/android-toolchain"
799 thread_support="HAVE_SIGALTSTACK_THREADS" 806 ${make_toolchain} --toolchain=x86-${gccchoice} --platform=android-android-$ANDROID_PLATFORM_VERSION --install-dir=${pwd}/android-toolchain
800 GCCOPTS="$GCCOPTS -Wa,--noexecstack -ffunction-sections -fomit-frame-pointer\ 807 if [ ${?} != 0 ]; then
801 --sysroot=$ANDROID_NDK_PATH/platforms/android-9/arch-x86" 808 exit
802 LDOPTS="$LDOPTS --sysroot=$ANDROID_NDK_PATH/platforms/android-9/arch-x86" 809 fi
810 GCCOPTS="$GCCOPTS -Wa,--noexecstack -ffunction-sections -fomit-frame-pointer"
803 ;; 811 ;;
804 *) 812 *)
805 echo "ERROR: androidcc(): Unknown target architecture" 813 echo "ERROR: androidcc(): Unknown target architecture"
806 exit 814 exit
807 ;; 815 ;;
808 esac 816 esac
809 echo "Application environment deemed $endian endian" 817
810 if [ -z "$gccdir" ]; then 818 LDOPTS="$LDOPTS -fuse-ld=bfd --sysroot=${pwd}/android-toolchain/sysroot"
811 gccdir=$gcctarget$gccchoice 819 GCCOPTS="$GCCOPTS --sysroot=${pwd}/android-toolchain/sysroot"
812 fi 820 echo "Using endian ${endian}"
813 if [ -d $ANDROID_NDK_PATH/toolchains/$gccdir/prebuilt/$buildhost-x86 ]; then 821 echo "Using gccchoice ${gccchoice}"
814 gccprefix=$ANDROID_NDK_PATH/toolchains/$gccdir/prebuilt/$buildhost-x86 822 echo "Using gcctarget ${gcctarget}"
815 else 823 PATH=$PATH:${pwd}/android-toolchain/bin
816 gccprefix=$ANDROID_NDK_PATH/toolchains/$gccdir/prebuilt/$buildhost-x86_64
817 fi
818 PATH=$PATH:$gccprefix/bin
819 prefixtools $gcctarget 824 prefixtools $gcctarget
820} 825}
821 826
822androidndkcc() 827androidndkcc()
823{ 828{
824 if ! [ -d "$ANDROID_NDK_PATH" ]; then 829 if ! [ -d "$ANDROID_NDK_PATH" ]; then
825 echo "ERROR: You need the Android NDK installed (r16 or higher) and have the ANDROID_NDK_PATH" 830 echo "ERROR: You need the Android NDK installed (r10e or higher) and have the ANDROID_NDK_PATH"
826 echo "environment variable point to the root directory of the Android NDK." 831 echo "environment variable point to the root directory of the Android NDK."
827 exit 832 exit
828 fi 833 fi
@@ -834,16 +839,8 @@ androidndkcc()
834 exit 839 exit
835 fi 840 fi
836 841
837 buildhost=$(uname -s | tr "[:upper:]" "[:lower:]") 842 # the prebuilt android NDK only supports x86_64 architecture anyway, so we can take shortcuts
838 # the prebuild android NDK only supports intel architecture anyway, so we can take shortcuts 843 buildhost=$(uname -s | tr "[:upper:]" "[:lower:]")-x86_64
839 case $(getconf LONG_BIT) in
840 32)
841 buildhost="${buildhost}-x86"
842 ;;
843 64)
844 buildhost="${buildhost}-x86_64"
845 ;;
846 esac
847 844
848 GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef//` 845 GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib// -e s/-Wundef//`
849 LDOPTS="$LDOPTS -ldl -llog" 846 LDOPTS="$LDOPTS -ldl -llog"
@@ -851,19 +848,20 @@ androidndkcc()
851 SHARED_CFLAGS='' 848 SHARED_CFLAGS=''
852 GLOBAL_LDOPTS="-Wl,-z,defs -Wl,-z,noexecstack" 849 GLOBAL_LDOPTS="-Wl,-z,defs -Wl,-z,noexecstack"
853 850
851 ANDROID_PLATFORM_VERSION=$1
852
854 # arch dependant stuff 853 # arch dependant stuff
855 case $1 in 854 case $2 in
856 armeabi) 855 armeabi)
857 endian="little" 856 endian="little"
858 gccchoice="4.6" 857 gccchoice="4.9"
859 gcctarget="arm-linux-androideabi-" 858 gcctarget="arm-linux-androideabi-"
860 echo "${make_toolchain} --system=${buildhost} --toolchain=arm-linux-androideabi-4.6 --platform=android-16 --install-dir=${pwd}/android-toolchain" 859 echo "${make_toolchain} --toolchain=arm-linux-androideabi-4.9 --platform=android-$ANDROID_PLATFORM_VERSION --install-dir=${pwd}/android-toolchain"
861 ${make_toolchain} --system=${buildhost} --toolchain=arm-linux-androideabi-4.6 --platform=android-16 --install-dir=${pwd}/android-toolchain 860 ${make_toolchain} --toolchain=arm-linux-androideabi-4.9 --platform=android-$ANDROID_PLATFORM_VERSION --install-dir=${pwd}/android-toolchain
862 if [ ${?} != 0 ]; then 861 if [ ${?} != 0 ]; then
863 exit 862 exit
864 fi 863 fi
865 GCCOPTS="$GCCOPTS -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer --sysroot=${pwd}/android-toolchain/sysroot" 864 GCCOPTS="$GCCOPTS -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer"
866 LDOPTS="$LDOPTS --sysroot=${pwd}/android-toolchain/sysroot"
867 ;; 865 ;;
868 *) 866 *)
869 echo "ERROR: androidndkcc(): Unknown target architecture" 867 echo "ERROR: androidndkcc(): Unknown target architecture"
@@ -871,6 +869,11 @@ androidndkcc()
871 ;; 869 ;;
872 esac 870 esac
873 871
872 # -fuse-ld=bfd is needed because toolchain defaults to 'gold'
873 # which often crashes when linking.
874 LDOPTS="$LDOPTS -fuse-ld=bfd --sysroot=${pwd}/android-toolchain/sysroot"
875 GCCOPTS="$GCCOPTS -fuse-ld=bfd --sysroot=${pwd}/android-toolchain/sysroot"
876
874 echo "Using endian ${endian}" 877 echo "Using endian ${endian}"
875 echo "Using gccchoice ${gccchoice}" 878 echo "Using gccchoice ${gccchoice}"
876 echo "Using gcctarget ${gcctarget}" 879 echo "Using gcctarget ${gcctarget}"
@@ -3589,7 +3592,7 @@ fi
3589 libdir="/data/data/org.rockbox/app_rockbox" 3592 libdir="/data/data/org.rockbox/app_rockbox"
3590 memory=8 3593 memory=8
3591 uname=`uname` 3594 uname=`uname`
3592 androidcc armeabi 3595 androidcc 19 armeabi
3593 tool="cp " 3596 tool="cp "
3594 boottool="cp " 3597 boottool="cp "
3595 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 3598 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
@@ -3721,7 +3724,7 @@ fi
3721 libdir="/data/data/org.rockbox/app_rockbox" 3724 libdir="/data/data/org.rockbox/app_rockbox"
3722 memory=8 3725 memory=8
3723 uname=`uname` 3726 uname=`uname`
3724 androidcc mips 3727 androidcc 19 mips
3725 tool="cp " 3728 tool="cp "
3726 boottool="cp " 3729 boottool="cp "
3727 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 3730 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
@@ -3749,7 +3752,7 @@ fi
3749 libdir="/data/data/org.rockbox/app_rockbox" 3752 libdir="/data/data/org.rockbox/app_rockbox"
3750 memory=8 3753 memory=8
3751 uname=`uname` 3754 uname=`uname`
3752 androidcc x86 3755 androidcc 19 x86
3753 tool="cp " 3756 tool="cp "
3754 boottool="cp " 3757 boottool="cp "
3755 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 3758 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
@@ -4184,7 +4187,7 @@ fi
4184 # Actually 408260kB 4187 # Actually 408260kB
4185 memory=256 4188 memory=256
4186 uname=`uname` 4189 uname=`uname`
4187 androidndkcc armeabi 4190 androidndkcc 16 armeabi
4188 tool="cp " 4191 tool="cp "
4189 boottool="cp " 4192 boottool="cp "
4190 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 4193 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
@@ -4209,7 +4212,7 @@ fi
4209 lcd_orientation="landscape" 4212 lcd_orientation="landscape"
4210 memory=256 4213 memory=256
4211 uname=`uname` 4214 uname=`uname`
4212 androidndkcc armeabi 4215 androidndkcc 16 armeabi
4213 tool="cp " 4216 tool="cp "
4214 boottool="cp " 4217 boottool="cp "
4215 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0" 4218 bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
@@ -5049,6 +5052,7 @@ export LCDORIENTATION=${lcd_orientation}
5049export ANDROID_ARCH=${ANDROID_ARCH} 5052export ANDROID_ARCH=${ANDROID_ARCH}
5050export ANDROID_NDK_PATH=${ANDROID_NDK_PATH} 5053export ANDROID_NDK_PATH=${ANDROID_NDK_PATH}
5051export ANDROID_SDK_PATH=${ANDROID_SDK_PATH} 5054export ANDROID_SDK_PATH=${ANDROID_SDK_PATH}
5055export ANDROID_PLATFORM_VERSION=${ANDROID_PLATFORM_VERSION}
5052 5056
5053CONFIGURE_OPTIONS=${cmdline} 5057CONFIGURE_OPTIONS=${cmdline}
5054 5058