/[zanavi_public1]/navit/ci/do_android.sh
ZANavi

Contents of /navit/ci/do_android.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 51 - (show annotations) (download) (as text)
Mon Jul 25 19:29:08 2016 UTC (4 years, 7 months ago) by zoff99
File MIME type: application/x-sh
File size: 8102 byte(s)
v2.0.52
1 #!/bin/bash
2
3 export START_PATH=~/
4 export SOURCE_PATH="$START_PATH""/"${CIRCLE_PROJECT_REPONAME}"/"
5
6 export ANDROID_NDK="/usr/local/android-ndk/"
7 export _NDK_="$ANDROID_NDK"
8
9 export ANDROID_SDK="/usr/local/android-sdk-linux/"
10 export _SDK_="$ANDROID_SDK"
11
12 export BUILD_PATH="$START_PATH""/android-build"
13 mkdir -p $BUILD_PATH
14
15 echo "================================="
16 pwd
17 echo "================================="
18 ls -al
19 echo "================================="
20 echo $ANDROID_HOME
21 echo "================================="
22 echo $START_PATH
23 echo "================================="
24 echo $SOURCE_PATH
25 echo "================================="
26 echo "$BUILD_PATH"
27 echo "================================="
28 ls -al "$BUILD_PATH"/
29 echo "================================="
30 echo ${CIRCLE_PROJECT_REPONAME}
31 echo "================================="
32 # type -a ccache
33 # echo "================================="
34
35 # patch for circleCI -------------
36 pwd
37 ls -al navit/android/src/com/zoffcc/applications/zanavi/Navit.java
38 sed -i -e 's#static final int CIDEBUG =.*#static final int CIDEBUG = 1;#' navit/android/src/com/zoffcc/applications/zanavi/Navit.java
39 cat navit/android/src/com/zoffcc/applications/zanavi/Navit.java | grep 'static final int CIDEBUG'
40 ls -al navit/android/src/com/zoffcc/applications/zanavi/Navit.java
41 # ============
42 ls -al navit/debug.h
43 sed -i -e 'sc// #define _CIDEBUG_BUILD_ 1c#define _CIDEBUG_BUILD_ 1c' navit/debug.h
44 cat navit/debug.h | grep 'CIDEBUG_BUILD'
45 ls -al navit/debug.h
46 # patch for circleCI -------------
47
48
49 rm navit/maptool/poly2tri-c/001/seidel-1.0/triangulate
50 rm pngout-static
51 echo '#! /bin/bash' > pngout-static && \
52 echo 'echo $*' >> pngout-static && \
53 chmod u+rx pngout-static
54
55 if [ `uname -m` == 'x86_64' ] ; then SUFFIX2='_64' ; else SUFFIX2='' ; fi && \
56 export PATH=$PATH:$_SDK_/tools:$_SDK_/platform-tools:$_NDK_/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86$SUFFIX2/bin
57
58 cd $BUILD_PATH
59
60 # echo "cleaning ccache cache ..."
61 # ccache -c
62 # ccache -C
63 # echo "... done"
64 CCACHE=""
65
66 conf_addon=''
67
68 if [ "$COVERITY_BUILD_""x" == "1x" ]; then
69 sed -i -e 's#LIBS="$LIBS -rdynamic"#ABCDD="aaaabbb"#g' ../zanavi/configure
70 cat ../zanavi/configure | grep 'rdynamic'
71 cat ../zanavi/configure | grep 'aaaabbb'
72 conf_addon=' --disable-shared '
73 fi
74
75 DEBUG_="-fpic -ffunction-sections -fstack-protector -fomit-frame-pointer -fno-strict-aliasing -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -Wno-psabi -march=armv5te -msoft-float -mthumb -finline-limit=64 -DHAVE_API_ANDROID -DANDROID -Wa,--noexecstack -O3 -I$_NDK_/platforms/android-14/arch-arm/usr/include -nostdlib -Wl,-rpath-link=$_NDK_/platforms/android-14/arch-arm/usr/lib -L$_NDK_/platforms/android-14/arch-arm/usr/lib"
76
77 ../zanavi/configure RANLIB=arm-linux-androideabi-ranlib AR=arm-linux-androideabi-ar CC="$CCACHE arm-linux-androideabi-gcc -O2 $DEBUG_ -L. -L$_NDK_/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86$SUFFIX2/lib/gcc/arm-linux-androideabi/4.8/ -lgcc -ljnigraphics " CXX="$CCACHE arm-linux-androideabi-g++ -O2 -fno-rtti -fno-exceptions -L$_NDK_/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86$SUFFIX2/lib/gcc/arm-linux-androideabi/4.8/ -lgcc -ljnigraphics " --host=arm-eabi-linux_android --enable-avoid-float --enable-avoid-unaligned --disable-glib --disable-gmodule --disable-vehicle-gpsd $conf_addon --enable-vehicle-demo --disable-binding-dbus --disable-speech-cmdline --disable-gui-gtk --disable-font-freetype --disable-fontconfig --disable-graphics-qt-qpainter --disable-graphics-gtk-drawing-area --disable-maptool --enable-cache-size=20971520 --enable-svg2png-scaling=8,16,32,48,64,96,192,384 --enable-svg2png-scaling-nav=48,64,59,96,192,384 --enable-svg2png-scaling-flag=32 --with-xslts=android,plugin_menu --with-saxon=saxonb-xslt --enable-transformation-roll --with-android-project="android-21" > /dev/null 2> /dev/null
78
79 if [ "$COVERITY_BUILD_""x" == "1x" ]; then
80 export AND_API_LEVEL_C=14 && \
81 export NDK=$_NDK_ && \
82 export DO_RELEASE_BUILD=1 && \
83 export DO_PNG_BUILD=1 && \
84 export NDK_CCACHE="" && \
85 export PATH=/home/ubuntu/cov_scan/cov-analysis-linux64-8.5.0/bin:/usr/local/android-ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:$PATH
86 cd ~/android-build/
87 # cov-configure --comptype gcc --compiler /usr/local/android-ndk/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
88 cov-configure -co arm-linux-androideabi-gcc -- -march=armv5te -msoft-float -mthumb
89 make clean
90 cov-build --dir cov-int make
91
92 ls -al /home/ubuntu/android-build/navit/.libs/lib_data_data_com.zoffcc.applications.zanavi_lib_navit.so
93 ls -al /home/ubuntu/android-build/navit/.libs/navit2
94 ls -al /home/ubuntu/android-build/navit/navit2
95
96 make clean
97 conf_addon=''
98 sed -i -e 's#ABCDD="aaaabbb"#LIBS="$LIBS -rdynamic"#g' ../zanavi/configure
99 cat ../zanavi/configure | grep 'rdynamic'
100 cat ../zanavi/configure | grep 'aaaabbb'
101 ../zanavi/configure RANLIB=arm-linux-androideabi-ranlib AR=arm-linux-androideabi-ar CC="$CCACHE arm-linux-androideabi-gcc -O2 $DEBUG_ -L. -L$_NDK_/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86$SUFFIX2/lib/gcc/arm-linux-androideabi/4.8/ -lgcc -ljnigraphics " CXX="$CCACHE arm-linux-androideabi-g++ -O2 -fno-rtti -fno-exceptions -L$_NDK_/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86$SUFFIX2/lib/gcc/arm-linux-androideabi/4.8/ -lgcc -ljnigraphics " --host=arm-eabi-linux_android --enable-avoid-float --enable-avoid-unaligned --disable-glib --disable-gmodule --disable-vehicle-gpsd $conf_addon --enable-vehicle-demo --disable-binding-dbus --disable-speech-cmdline --disable-gui-gtk --disable-font-freetype --disable-fontconfig --disable-graphics-qt-qpainter --disable-graphics-gtk-drawing-area --disable-maptool --enable-cache-size=20971520 --enable-svg2png-scaling=8,16,32,48,64,96,192,384 --enable-svg2png-scaling-nav=48,64,59,96,192,384 --enable-svg2png-scaling-flag=32 --with-xslts=android,plugin_menu --with-saxon=saxonb-xslt --enable-transformation-roll --with-android-project="android-21" > /dev/null 2> /dev/null
102
103 fi
104
105 export AND_API_LEVEL_C=14 && \
106 export NDK=$_NDK_ && \
107 export DO_RELEASE_BUILD=1 && \
108 export DO_PNG_BUILD=1 && \
109 export NDK_CCACHE="" && \
110 make 2>&1 | grep -i error && \
111 pwd && \
112 cd navit
113 make apkg-release 2>&1 | grep '\[javac\]' || pwd
114
115 ls -al /home/ubuntu/android-build/navit/.libs/lib_data_data_com.zoffcc.applications.zanavi_lib_navit.so
116 ls -al /home/ubuntu/android-build/navit/.libs/navit2
117 ls -al /home/ubuntu/android-build/navit/navit2
118
119
120 cd android-support-v7-appcompat && \
121 cat local.properties |sed -e "s#/home/navit/_navit_develop/_need/SDK/_unpack/android-sdk-linux_x86#$_SDK_#" > l.txt && \
122 mv l.txt local.properties && \
123 cat local.properties
124
125 cd ../android
126
127 pwd
128 cat AndroidManifest.xml | sed -e 's#android:debuggable="true"#android:debuggable="false"#' > l.txt
129 mv l.txt AndroidManifest.xml
130
131 ant release 2>&1 | grep '\[javac\]' # > /dev/null 2> /dev/null
132
133 ###### --------------- delete debug signing-key ---------------
134 ### rm -f ~/.android/debug.keystore
135 ###### --------------- delete debug signing-key ---------------
136
137 cd bin/
138
139 if [ ! -f ~/.android/debug.keystore ]; then
140
141 echo "*** generating new signer key ***"
142 echo "*** generating new signer key ***"
143 echo "*** generating new signer key ***"
144
145 keytool -genkey -v -keystore ~/.android/debug.keystore -storepass android \
146 -keyalg RSA -keysize 2048 -validity 10000 \
147 -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"
148 fi
149
150 jarsigner -verbose -keystore ~/.android/debug.keystore \
151 -storepass android -keypass android -sigalg SHA1withRSA -digestalg SHA1 \
152 -sigfile CERT -signedjar zanavi_debug_signed.apk \
153 Navit-release-unsigned.apk androiddebugkey > /dev/null 2> /dev/null
154
155 $_SDK_/build-tools/23.0.1/zipalign -v 4 zanavi_debug_signed.apk zanavi_debug_signed_aligned.apk > /dev/null 2> /dev/null
156
157 pwd
158
159 ls -al
160
161 cd ..
162 pwd
163
164 cp -av bin/zanavi_debug_signed_aligned.apk $CIRCLE_ARTIFACTS/zanavi_circleci_$CIRCLE_SHA1.apk || exit 1
165
166
167

   
Visit the ZANavi Wiki