/[zanavi_public1]/navit/contrib/android_build.sh
ZANavi

Contents of /navit/contrib/android_build.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (show annotations) (download) (as text)
Fri Oct 28 21:19:04 2011 UTC (12 years, 5 months ago) by zoff99
File MIME type: application/x-sh
File size: 2977 byte(s)
import files
1 #!/bin/sh
2
3 show_api_lvl () {
4 case $1 in
5 1) ver='Android 1.0' ;;
6 2) ver='Android 1.1' ;;
7 3) ver='Android 1.5 "Cupcake"' ;;
8 4) ver='Android 1.6 "Donut"' ;;
9 5) ver='Android 2.0 "Eclair"' ;;
10 6) ver='Android 2.0.1 "Eclair"' ;;
11 7) ver='Android 2.1 "Eclair"' ;;
12 8) ver='Android 2.2 "Froyo"' ;;
13 9) ver='Android 2.3 "Gingerbread"' ;;
14 10) ver='Android 2.3.3+ "Gingerbread"' ;;
15 11) ver='Android 3.0 "Honeycomb"' ;;
16 12) ver='Android 3.1 "Ice Cream Sandwich"' ;;
17 esac
18 echo "$1 $ver"
19 }
20
21 if [ -z $ANDROID_NDK ]; then
22 echo "The environment variable ANDROID_NDK must be set!"
23 exit
24 fi
25
26 platforms=$ANDROID_NDK/platforms
27 if [ ! -d $platforms ]; then
28 platforms=$ANDROID_NDK/build/platforms
29 fi
30
31 if [ ! -d $platforms ]; then
32 echo "The environment variable ANDROID_NDK must be pointing to the android NDK!"
33 exit
34 fi
35
36 if [ ! -d navit -o ! -f autogen.sh ]; then
37 echo "This script must be called from the navit main directory (where autogen.sh is in)"
38 exit
39 fi
40
41 api_lvl=${1-$ANDROID_API_LVL}
42
43 while [ -z $api_lvl ]; do
44 echo "The environment variable ANDROID_API_LVL is not set and the API level was also not given on the commandline."
45 echo "Possible API levels for your NDK are:"
46 cd $platforms
47 for p in android-*; do
48 [ -d $p/arch-arm ] || continue
49 show_api_lvl ${p#android-}
50 done
51 cd - > /dev/null
52 echo "Enter the desired API level (4 is recommended)"
53 read api_lvl
54 if [ ! -d $platforms/android-$api_lvl/arch-arm ]; then
55 echo "Bad choice, retrying..."; echo ""
56 unset api_lvl
57 fi
58 done
59
60 ANDROID_API_LVL=$api_lvl
61 export ANDROID_API_LVL
62 ANDROID_PLATFORM=$platforms/android-$ANDROID_API_LVL/arch-arm
63 export ANDROID_PLATFORM
64 PATH=`echo $ANDROID_NDK/toolchains/arm-eabi-*/prebuilt/linux-x86/bin`:$PATH
65 export PATH
66
67 if [ ! -f Makefile.in ]; then
68 echo ""; echo "*** Running autogen.sh ***"; echo ""
69 ./autogen.sh
70 fi
71
72 if [ ! -f Makefile ]; then
73 echo ""; echo "*** Running configure ***"; echo ""
74 ./configure \
75 PKG_CONFIG=arm-eabi-pkgconfig \
76 RANLIB=arm-eabi-ranlib \
77 AR=arm-eabi-ar \
78 CC="arm-eabi-gcc -L$ANDROID_PLATFORM/usr/lib -L. -I$ANDROID_PLATFORM/usr/include" \
79 CXX=arm-eabi-g++ \
80 --host=arm-eabi-linux_android \
81 --enable-avoid-float \
82 --enable-avoid-unaligned \
83 --enable-cache-size=20971520 \
84 --enable-svg2png-scaling=8,16,32,48,64,96 \
85 --enable-svg2png-scaling-nav=59 \
86 --enable-svg2png-scaling-flag=32 \
87 --with-xslts=android,plugin_menu,pedestrian_button,pedestrian \
88 --with-saxon=saxonb-xslt \
89 --enable-transformation-roll \
90 --enable-plugin-pedestrian \
91 --with-android-permissions=CAMERA \
92 --with-android-project=android-$ANDROID_API_LVL
93 fi
94
95 set -e
96
97 echo ""; echo "*** Running make ***"; echo ""
98 make
99
100 echo ""; echo "*** Running make apkg ***"; echo ""
101 cd navit
102 make apkg
103 cd - > /dev/null
104
105 apk=`pwd`/navit/android/bin/Navit-debug.apk
106 if [ -f $apk ]; then
107 echo "Great - looks like it worked! The result is"; echo ""
108 ls -l $apk
109 echo ""
110 else
111 echo "This shouldn't happen! Something went terribly wrong..."
112 fi

   
Visit the ZANavi Wiki