]>
Commit | Line | Data |
---|---|---|
0832e7d6 UH |
1 | #!/bin/bash |
2 | ## | |
3 | ## This file is part of the sigrok-util project. | |
4 | ## | |
25b2b9f5 | 5 | ## Copyright (C) 2013-2014 Uwe Hermann <uwe@hermann-uwe.de> |
0832e7d6 UH |
6 | ## |
7 | ## This program is free software; you can redistribute it and/or modify | |
8 | ## it under the terms of the GNU General Public License as published by | |
9 | ## the Free Software Foundation; either version 2 of the License, or | |
10 | ## (at your option) any later version. | |
11 | ## | |
12 | ## This program is distributed in the hope that it will be useful, | |
13 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ## GNU General Public License for more details. | |
16 | ## | |
17 | ## You should have received a copy of the GNU General Public License | |
18 | ## along with this program; if not, write to the Free Software | |
19 | ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | ## | |
21 | ||
c28fee03 MC |
22 | set -e |
23 | ||
3bdccc55 UH |
24 | # The path where the NDK, SDK, and toolchains are located. |
25 | ANDROID_PATH=$HOME/android | |
26 | ||
e25d7d5a | 27 | # The path where the Android NDK is located. |
3bdccc55 | 28 | ANDROID_NDK=$ANDROID_PATH/android-ndk-r10c |
11b9792e | 29 | |
e25d7d5a | 30 | # The path where the Android SDK is located. |
3bdccc55 | 31 | ANDROID_SDK=$ANDROID_PATH/android-sdk-linux |
11b9792e | 32 | |
0832e7d6 | 33 | # The path where your Android toolchain directory is located. |
3bdccc55 UH |
34 | TOOLCHAIN=$ANDROID_PATH/android-arm-toolchain |
35 | # TOOLCHAIN=$ANDROID_PATH/android-mipsel-toolchain | |
36 | # TOOLCHAIN=$ANDROID_PATH/android-i686-toolchain | |
e2bb3ab1 UH |
37 | |
38 | # Select which Android toolchain to use. | |
39 | # Don't forget to also adapt TOOLCHAIN above if you change TOOLCHAIN_TRIPLET! | |
40 | TOOLCHAIN_TRIPLET=arm-linux-androideabi | |
41 | # TOOLCHAIN_TRIPLET=mipsel-linux-android | |
42 | # TOOLCHAIN_TRIPLET=i686-linux-android | |
0832e7d6 UH |
43 | |
44 | # The path where the cross-compiled packages will be installed. | |
45 | PREFIX=$HOME/sr_android | |
46 | ||
47 | # The path where to download files to and where to build packages. | |
07947dda | 48 | BUILDDIR=./build |
0832e7d6 | 49 | |
819eb05b UH |
50 | # Edit this to enable/disable/modify parallel compiles. |
51 | PARALLEL="-j 2" | |
52 | ||
0832e7d6 UH |
53 | # You usually don't need to change anything below this line. |
54 | ||
55 | # ----------------------------------------------------------------------------- | |
56 | ||
57 | VER_LIBICONV=1.14 | |
d4069d6e | 58 | VER_GETTEXT=0.19.2 |
b118df5f | 59 | VER_ZLIB=1.2.8 |
d4069d6e UH |
60 | VER_PCRE=8.35 |
61 | VER_LIBFFI=3.1 | |
62 | VER_GLIB=2.41.3 | |
63 | VER_GLIB_SHORT=2.41 | |
64 | VER_LIBSIGCXX=2.3.2 | |
65 | VER_LIBSIGCXX_SHORT=2.3 | |
66 | VER_LIBZIP=0.11.2 | |
7966c37c | 67 | VER_LIBFTDI1=1.1 |
d4069d6e | 68 | VER_LIBUSB=1.0.19 |
5451bfe2 | 69 | VER_PYTHON=3.3.3 |
11b9792e | 70 | VER_BOOST=1.55.0 |
2256009e | 71 | VER_QT=5.3.1 |
3bdccc55 UH |
72 | VER_NDK=10c |
73 | VER_SDK=23.0.2 | |
0832e7d6 UH |
74 | |
75 | SF_MIRROR=switch.dl.sourceforge.net | |
76 | ||
ec49447e | 77 | WGET="wget --quiet" |
a51ca6bd | 78 | GIT_CLONE="git clone --depth=1" |
ec49447e | 79 | |
7966c37c MC |
80 | case "$TOOLCHAIN_TRIPLET" in |
81 | arm*) TARGET_ARCH=armeabi;; | |
82 | mips*) TARGET_ARCH=mips;; | |
83 | i686*) TARGET_ARCH=x86;; | |
e25d7d5a | 84 | *) echo >&2 "Unknown prefix for TOOLCHAIN_TRIPLET."; exit 1;; |
7966c37c MC |
85 | esac |
86 | ||
0832e7d6 | 87 | # ----------------------------------------------------------------------------- |
3bdccc55 UH |
88 | |
89 | # Get the Android NDK and SDK, install required packages and toolchains. | |
90 | if [ "x$1" = "xprepare" ]; then | |
91 | mkdir -p $ANDROID_PATH | |
92 | cd $ANDROID_PATH | |
93 | ||
94 | # NDK | |
95 | $WGET http://dl.google.com/android/ndk/android-ndk-r$VER_NDK-linux-x86.bin | |
96 | chmod 700 android-ndk-r$VER_NDK-linux-x86.bin | |
97 | ./android-ndk-r$VER_NDK-linux-x86.bin | |
98 | cd android-ndk-r$VER_NDK | |
99 | ./build/tools/make-standalone-toolchain.sh --platform=android-16 \ | |
100 | --toolchain=arm-linux-androideabi-4.9 \ | |
101 | --install-dir=$ANDROID_PATH/android-arm-toolchain | |
102 | cd .. | |
103 | ||
104 | # SDK | |
105 | $WGET http://dl.google.com/android/android-sdk_r$VER_SDK-linux.tgz | |
106 | tar xfz android-sdk_r$VER_SDK-linux.tgz | |
107 | cd android-sdk-linux | |
108 | ./tools/android update sdk --no-ui --filter platform-tools,build-tools-21.1.0,android-8,android-10,android-11,android-14,android-16 | |
109 | cd .. | |
110 | ||
111 | exit | |
112 | fi | |
113 | ||
114 | # ----------------------------------------------------------------------------- | |
0832e7d6 | 115 | |
2e353a08 ML |
116 | # Remove build directory contents (if any) and create a new build dir. |
117 | rm -rf $BUILDDIR | |
118 | mkdir $BUILDDIR | |
119 | cd $BUILDDIR | |
120 | ||
e25d7d5a UH |
121 | # ----------------------------------------------------------------------------- |
122 | ||
2e353a08 | 123 | # Build host Python before we start messing with the environment. |
510f5ccb | 124 | # Don't do parallel builds, this doesn't seem to work well. |
ec49447e | 125 | $WGET http://python.org/ftp/python/$VER_PYTHON/Python-$VER_PYTHON.tar.xz |
25b2b9f5 | 126 | tar xfJ Python-$VER_PYTHON.tar.xz |
5451bfe2 | 127 | cd Python-$VER_PYTHON |
2e353a08 | 128 | ./configure |
510f5ccb | 129 | make python |
2e353a08 | 130 | mv python hostpython |
2e353a08 ML |
131 | cd .. |
132 | ||
133 | # ----------------------------------------------------------------------------- | |
134 | ||
135 | # We need to find tools in the toolchain. | |
136 | export PATH=$TOOLCHAIN/bin:$PATH | |
0832e7d6 | 137 | |
02c87af2 | 138 | # Tell pkg-config to only look for our cross-built stuff. |
226830e4 MC |
139 | export PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig" |
140 | export -n PKG_CONFIG_PATH | |
141 | ||
890c9708 MC |
142 | # Check toolchain |
143 | if test -d "$TOOLCHAIN"/sysroot; then | |
144 | echo "Toolchain is standalone" | |
145 | STANDALONE_TOOLCHAIN=$TOOLCHAIN | |
146 | SYSROOT= | |
147 | else | |
148 | STANDALONE_TOOLCHAIN= | |
149 | NATIVE_API_LEVEL=16 | |
150 | SYSROOT_DIR=${ANDROID_NDK}/platforms/android-${NATIVE_API_LEVEL}/arch-${TARGET_ARCH%eabi*} | |
151 | if [ ! -d "$SYSROOT_DIR" ]; then | |
152 | echo >&2 "Can't build with NDK toolchain; sysroot $SYSROOT_DIR is missing" | |
153 | exit 1 | |
154 | fi | |
155 | SYSROOT="--sysroot $SYSROOT_DIR" | |
156 | CC="$TOOLCHAIN_TRIPLET-gcc $SYSROOT" | |
157 | CXX="$TOOLCHAIN_TRIPLET-g++ $SYSROOT" | |
158 | export CC CXX | |
159 | fi | |
160 | NDK_TOOLCHAIN_VERSION=`${TOOLCHAIN_TRIPLET}-gcc --version | head -1 | sed -e 's/.* \([0-9]\+\.[0-9.]\+\)\( \|.*\)$/\1/'` | |
161 | ||
0832e7d6 | 162 | # Define some helper variables. |
e2bb3ab1 | 163 | C="--host=$TOOLCHAIN_TRIPLET --prefix=$PREFIX" |
890c9708 MC |
164 | CM="-Wno-dev -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_ABI=${TARGET_ARCH} -DCMAKE_INSTALL_PREFIX=${PREFIX}" |
165 | if [ -n "$STANDALONE_TOOLCHAIN" ]; then | |
166 | CM="$CM -DANDROID_STANDALONE_TOOLCHAIN=${STANDALONE_TOOLCHAIN}" | |
167 | if [ -d "${ANDROID_NDK}/sources/cxx-stl" ]; then | |
168 | CM="$CM -DANDROID_STL_PATH=${ANDROID_NDK}/sources/cxx-stl" | |
169 | fi | |
170 | else | |
171 | CM="$CM -DANDROID_NDK=${ANDROID_NDK}" | |
172 | CM="$CM -DANDROID_NATIVE_API_LEVEL=${NATIVE_API_LEVEL}" | |
173 | CM="$CM -DANDROID_TOOLCHAIN_NAME=${TOOLCHAIN_TRIPLET}-${NDK_TOOLCHAIN_VERSION}" | |
174 | fi | |
0832e7d6 | 175 | |
2fddc139 | 176 | # Look for STL, needed to build bindings |
2fddc139 MC |
177 | STL_BASE="${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${NDK_TOOLCHAIN_VERSION}" |
178 | if [ -d ${STL_BASE}/include ]; then | |
179 | CPPFLAGS_STL="-I${STL_BASE}/include -I${STL_BASE}/libs/${TARGET_ARCH}/include" | |
180 | LDFLAGS_STL="-L${STL_BASE}/libs/${TARGET_ARCH} -Wl,-rpath=${STL_BASE}/libs/${TARGET_ARCH}" | |
181 | BINDINGS_CONFIG="--enable-bindings" | |
182 | else | |
183 | echo "Warning: STL unavailable, libsigrok bindings will not be built." | |
184 | CPPFLAGS_STL= | |
185 | LDFLAGS_STL= | |
186 | BINDINGS_CONFIG="--disable-bindings" | |
187 | fi | |
188 | ||
e25d7d5a UH |
189 | # ----------------------------------------------------------------------------- |
190 | ||
0832e7d6 | 191 | # Get the latest versions of config.guess/config.sub that know about Android. |
a51ca6bd | 192 | $GIT_CLONE git://git.savannah.gnu.org/config.git |
0832e7d6 | 193 | |
e25d7d5a UH |
194 | # Get a toolchain for cmake that knows about Android. |
195 | $WGET https://android-cmake.googlecode.com/hg/toolchain/android.toolchain.cmake | |
7966c37c MC |
196 | patch < ../android.toolchain.cmake.patch android.toolchain.cmake |
197 | ||
0832e7d6 UH |
198 | # ----------------------------------------------------------------------------- |
199 | ||
f7b8aa73 | 200 | # Python (needed for libsigrokdecode) |
510f5ccb | 201 | # Don't do parallel Python builds, this doesn't seem to work well. |
f7b8aa73 UH |
202 | cd Python-$VER_PYTHON |
203 | make distclean | |
204 | autoreconf | |
205 | patch -p1 < ../../Python-$VER_PYTHON.patch | |
206 | ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no ac_cv_func_pipe2=no ac_cv_func_fdatasync=no ac_cv_func_killpg=no ac_cv_func_waitid=no ac_cv_func_sigaltstack=no ./configure $C --build=x86_64-linux-gnu --disable-ipv6 | |
9a98e0d1 | 207 | sed -i "s/^#zlib/zlib/g" Modules/Setup |
d8a9354e | 208 | make PYTHON_FOR_BUILD='_PYTHON_HOST_PLATFORM=$(_PYTHON_HOST_PLATFORM) ./hostpython' install |
f7b8aa73 UH |
209 | cd .. |
210 | ||
85b46172 | 211 | # libiconv (needed for glib) |
ec49447e | 212 | $WGET http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$VER_LIBICONV.tar.gz |
85b46172 MC |
213 | tar xfz libiconv-$VER_LIBICONV.tar.gz |
214 | cd libiconv-$VER_LIBICONV | |
215 | cp -f ../config/config.guess build-aux | |
216 | cp -f ../config/config.sub build-aux | |
217 | cp -f ../config/config.guess libcharset/build-aux | |
218 | cp -f ../config/config.sub libcharset/build-aux | |
219 | ./configure $C --enable-shared | |
220 | make lib/localcharset.h | |
221 | cd libcharset | |
819eb05b | 222 | make $PARALLEL |
85b46172 MC |
223 | make install |
224 | cd ../lib | |
819eb05b | 225 | make $PARALLEL |
85b46172 MC |
226 | make install |
227 | cd .. | |
228 | test -d $PREFIX/include || mkdir $PREFIX/include | |
229 | cp include/iconv.h.inst $PREFIX/include/iconv.h | |
230 | cd .. | |
0832e7d6 | 231 | |
87ea3974 | 232 | # gettext (needed for glib) |
ec49447e | 233 | $WGET http://ftp.gnu.org/pub/gnu/gettext/gettext-$VER_GETTEXT.tar.gz |
87ea3974 MC |
234 | tar xfz gettext-$VER_GETTEXT.tar.gz |
235 | cd gettext-$VER_GETTEXT | |
236 | ./configure $C --enable-shared --disable-libasprintf | |
237 | cd gettext-runtime | |
819eb05b | 238 | make $PARALLEL |
87ea3974 MC |
239 | make install |
240 | cd ../.. | |
0832e7d6 UH |
241 | |
242 | # zlib (needed for glib and libzip) | |
ec49447e | 243 | $WGET http://zlib.net/zlib-$VER_ZLIB.tar.gz |
25b2b9f5 | 244 | tar xfz zlib-$VER_ZLIB.tar.gz |
167cb16e UH |
245 | cd zlib-$VER_ZLIB |
246 | # Note: zlib's configure doesn't understand --host, we need to pass $CC. | |
890c9708 | 247 | CC="$TOOLCHAIN_TRIPLET-gcc $SYSROOT" ./configure --prefix=$PREFIX |
819eb05b | 248 | make $PARALLEL |
c28fee03 | 249 | make install |
167cb16e | 250 | cd .. |
0832e7d6 UH |
251 | |
252 | # pcre (needed for glib) | |
ec49447e | 253 | $WGET ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-$VER_PCRE.tar.gz |
25b2b9f5 | 254 | tar xfz pcre-$VER_PCRE.tar.gz |
85c9910a | 255 | cd pcre-$VER_PCRE |
091ed535 | 256 | ./configure $C --disable-cpp |
819eb05b | 257 | make $PARALLEL |
c28fee03 | 258 | make install |
85c9910a | 259 | cd .. |
0832e7d6 UH |
260 | |
261 | # libffi (needed for glib) | |
ec49447e | 262 | $WGET ftp://sourceware.org/pub/libffi/libffi-$VER_LIBFFI.tar.gz |
0832e7d6 UH |
263 | tar xfz libffi-$VER_LIBFFI.tar.gz |
264 | cd libffi-$VER_LIBFFI | |
c28fee03 | 265 | ./configure $C |
819eb05b | 266 | make $PARALLEL |
c28fee03 | 267 | make install |
0832e7d6 UH |
268 | cd .. |
269 | ||
e25d7d5a | 270 | # glib (needed for libsigrok) |
ec49447e | 271 | $WGET http://ftp.gnome.org/pub/gnome/sources/glib/$VER_GLIB_SHORT/glib-$VER_GLIB.tar.xz |
25b2b9f5 | 272 | tar xfJ glib-$VER_GLIB.tar.xz |
f7b8aa73 | 273 | cd glib-$VER_GLIB |
c38bb075 | 274 | NOCONFIGURE=yes ./autogen.sh |
559be0ff | 275 | # Note: Manual LDFLAGS/CPPFLAGS needed for libiconv, rest uses pkg-config. |
e2bb3ab1 | 276 | LDFLAGS=-L$PREFIX/lib CPPFLAGS=-I$PREFIX/include glib_cv_stack_grows=no glib_cv_uscore=no ac_cv_func_posix_getpwuid_r=no ac_cv_func_posix_getgrgid_r=no ./configure --disable-compile-warnings $C |
819eb05b | 277 | make $PARALLEL |
f0e760bb MC |
278 | make install |
279 | cd .. | |
0832e7d6 | 280 | |
e25d7d5a | 281 | # libzip (needed for libsigrok) |
ec49447e | 282 | $WGET http://www.nih.at/libzip/libzip-$VER_LIBZIP.tar.gz |
0832e7d6 UH |
283 | tar xfz libzip-$VER_LIBZIP.tar.gz |
284 | cd libzip-$VER_LIBZIP | |
285 | cp -f ../config/config.guess . | |
286 | cp -f ../config/config.sub . | |
c28fee03 | 287 | ./configure $C |
819eb05b | 288 | make $PARALLEL |
c28fee03 | 289 | make install |
0832e7d6 UH |
290 | cd .. |
291 | ||
e25d7d5a | 292 | # libusb-1.0 (needed for libsigrok) |
d4069d6e UH |
293 | $WGET http://$SF_MIRROR/project/libusb/libusb-1.0/libusb-$VER_LIBUSB/libusb-$VER_LIBUSB.tar.bz2 |
294 | tar xfj libusb-$VER_LIBUSB.tar.bz2 | |
295 | cd libusb-$VER_LIBUSB | |
c09c85b3 | 296 | patch -p1 < ../../libusb-1.0.patch |
6907ee7e | 297 | ./configure $C --disable-udev |
819eb05b | 298 | make $PARALLEL |
13b2dfdc MC |
299 | make install |
300 | cd .. | |
301 | ||
e25d7d5a | 302 | # libftdi1 (needed for libsigrok) |
7966c37c MC |
303 | $WGET http://www.intra2net.com/en/developer/libftdi/download/libftdi1-$VER_LIBFTDI1.tar.bz2 |
304 | tar xfj libftdi1-$VER_LIBFTDI1.tar.bz2 | |
305 | cd libftdi1-$VER_LIBFTDI1 | |
9773a798 | 306 | cmake $CM -DFTDIPP=no -DDOCUMENTATION=no -DEXAMPLES=no -DFTDI_EEPROM=no -DPYTHON_BINDINGS=no . |
7966c37c MC |
307 | make $PARALLEL |
308 | make install | |
309 | cd .. | |
310 | ||
900a8684 | 311 | # libserialport |
a51ca6bd | 312 | $GIT_CLONE git://sigrok.org/libserialport |
900a8684 ML |
313 | cd libserialport |
314 | ./autogen.sh | |
67b2de8a UH |
315 | mkdir build |
316 | cd build | |
317 | ../configure $C | |
83b801db | 318 | make $PARALLEL V=1 |
900a8684 | 319 | make install |
67b2de8a | 320 | cd ../.. |
900a8684 | 321 | |
2fddc139 MC |
322 | # Build dependencies for libsigrok bindings if needed |
323 | ||
324 | if [ x"$CPPFLAGS_STL" != x ]; then | |
325 | ||
326 | # libsigc++ (needed for glibmm) | |
327 | $WGET http://ftp.gnome.org/pub/gnome/sources/libsigc++/$VER_LIBSIGCXX_SHORT/libsigc++-$VER_LIBSIGCXX.tar.xz | |
25b2b9f5 | 328 | tar xfJ libsigc++-$VER_LIBSIGCXX.tar.xz |
2fddc139 MC |
329 | cd libsigc++-$VER_LIBSIGCXX |
330 | cp -f ../config/config.guess build | |
331 | cp -f ../config/config.sub build | |
9773a798 | 332 | CPPFLAGS="$CPPFLAGS_STL" LDFLAGS="$LDFLAGS_STL -lgnustl_shared" ./configure --disable-documentation $C |
2fddc139 MC |
333 | make $PARALLEL |
334 | make install | |
335 | cd .. | |
336 | ||
337 | # glibmm (needed for libsigrok bindings) | |
338 | $WGET http://ftp.gnome.org/pub/gnome/sources/glibmm/$VER_GLIB_SHORT/glibmm-$VER_GLIB.tar.xz | |
25b2b9f5 | 339 | tar xfJ glibmm-$VER_GLIB.tar.xz |
2fddc139 | 340 | cd glibmm-$VER_GLIB |
9773a798 | 341 | CPPFLAGS="$CPPFLAGS_STL" LDFLAGS="$LDFLAGS_STL -lgnustl_shared" ./configure --disable-documentation $C |
2fddc139 MC |
342 | make $PARALLEL |
343 | make install | |
344 | cd .. | |
345 | ||
346 | fi | |
347 | ||
c062d1dc | 348 | # libsigrok |
a51ca6bd | 349 | $GIT_CLONE git://sigrok.org/libsigrok |
c062d1dc MC |
350 | cd libsigrok |
351 | ./autogen.sh | |
67b2de8a UH |
352 | mkdir build |
353 | cd build | |
354 | CPPFLAGS="$CPPFLAGS_STL" LDFLAGS="$LDFLAGS_STL" ../configure $C $BINDINGS_CONFIG --datadir=/sdcard | |
83b801db | 355 | make $PARALLEL V=1 |
2fddc139 | 356 | make datadir='$(datarootdir)' install |
67b2de8a | 357 | cd ../.. |
02c87af2 | 358 | |
2fbea156 | 359 | # libsigrokdecode |
a51ca6bd | 360 | $GIT_CLONE git://sigrok.org/libsigrokdecode |
2fbea156 ML |
361 | cd libsigrokdecode |
362 | ./autogen.sh | |
67b2de8a UH |
363 | mkdir build |
364 | cd build | |
365 | ../configure $C | |
83b801db | 366 | make $PARALLEL V=1 |
2fbea156 | 367 | make install |
67b2de8a | 368 | cd ../.. |
2fbea156 ML |
369 | |
370 | # sigrok-cli | |
a51ca6bd | 371 | $GIT_CLONE git://sigrok.org/sigrok-cli |
2fbea156 ML |
372 | cd sigrok-cli |
373 | ./autogen.sh | |
67b2de8a UH |
374 | mkdir build |
375 | cd build | |
376 | ../configure $C | |
83b801db | 377 | make $PARALLEL V=1 |
2fbea156 | 378 | make install |
67b2de8a | 379 | cd ../.. |
819eb05b | 380 | |
e25d7d5a | 381 | # Check if we have all requirements to build PulseView: |
11b9792e MC |
382 | |
383 | if [ -z "$ANDROID_NDK" -o ! -d "$ANDROID_NDK" ]; then | |
e25d7d5a | 384 | echo "Android NDK not available, not building PulseView." |
11b9792e MC |
385 | exit 0 |
386 | fi | |
387 | ||
e25d7d5a UH |
388 | if [ -z "$ANDROID_SDK" -o \ |
389 | ! -d "$ANDROID_SDK"/platforms/android-8 -o \ | |
7b888971 MC |
390 | ! -d "$ANDROID_SDK"/platforms/android-10 -o \ |
391 | ! -d "$ANDROID_SDK"/platforms/android-11 -o \ | |
392 | ! -d "$ANDROID_SDK"/platforms/android-14 -o \ | |
393 | ! -d "$ANDROID_SDK"/platforms/android-16 ]; then | |
e25d7d5a | 394 | echo "Android SDK with platforms 8 10 11 14 16 not available, not building PulseView." |
11b9792e MC |
395 | exit 0 |
396 | fi | |
397 | ||
e25d7d5a UH |
398 | if [ ! -e "${ANDROID_SDK}/tools/android" ]; then |
399 | echo "Essential Android build tools not available, not building PulseView." | |
11b9792e MC |
400 | exit 0 |
401 | fi | |
402 | ||
11b9792e MC |
403 | NDK_HOST=`"$ANDROID_NDK/ndk-build" -p 2>/dev/null | awk '$1 == "HOST_TAG" { print $3 }'` |
404 | ||
e25d7d5a | 405 | # Boost (needed for PulseView) |
11b9792e MC |
406 | $WGET http://$SF_MIRROR/project/boost/boost/$VER_BOOST/boost_${VER_BOOST//./_}.tar.bz2 |
407 | tar xfj boost_${VER_BOOST//./_}.tar.bz2 | |
408 | cd boost_${VER_BOOST//./_} | |
409 | patch -p1 < ../../boost.patch | |
890c9708 MC |
410 | CC= ./bootstrap.sh --with-toolset=gcc --with-libraries=filesystem,system --without-icu |
411 | echo "using gcc : $NDK_TOOLCHAIN_VERSION : \"${TOOLCHAIN_TRIPLET}-g++\" : <cxxflags>\"$SYSROOT -I$PREFIX/include $CPPFLAGS_STL\" <linkflags>\"$SYSROOT -L$PREFIX/lib $LDFLAGS_STL -lgnustl_shared\" ;" > user-config.jam | |
ea9301bf | 412 | ./b2 -q -d+2 --user-config=user-config.jam toolset=gcc variant=release link=shared threading=multi runtime-link=shared target-os=android --prefix=$PREFIX --layout=system install $PARALLEL |
11b9792e MC |
413 | cd .. |
414 | ||
e25d7d5a | 415 | # Qt (needed for PulseView) |
7b888971 MC |
416 | $WGET http://download.qt-project.org/official_releases/qt/${VER_QT%.*}/${VER_QT}/single/qt-everywhere-opensource-src-${VER_QT}.tar.gz |
417 | tar xfz qt-everywhere-opensource-src-${VER_QT}.tar.gz | |
418 | cd qt-everywhere-opensource-src-${VER_QT} | |
11b9792e | 419 | patch -p1 < ../../android-qt.patch |
890c9708 | 420 | CC= CXX= ./configure --prefix="$PREFIX" -developer-build -xplatform android-g++ -nomake tests -nomake examples -android-sdk "$ANDROID_SDK" -android-ndk "$ANDROID_NDK" -android-ndk-host "$NDK_HOST" -android-arch "$TARGET_ARCH" -android-toolchain-version "$NDK_TOOLCHAIN_VERSION" -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples -skip qtlocation -skip qtconnectivity -opensource -confirm-license |
30adf6b9 | 421 | make module-qtbase module-qtandroidextras module-qtsvg module-qtimageformats $PARALLEL |
7b888971 | 422 | make install |
11b9792e | 423 | cd .. |
5d1a9a53 | 424 | |
7d3d2c0c | 425 | # sigrok-androidutils |
621e2e6e | 426 | $GIT_CLONE git://sigrok.org/sigrok-androidutils |
7d3d2c0c MC |
427 | cd sigrok-androidutils |
428 | ./autogen.sh | |
429 | ./configure $C --with-android-sdk="${ANDROID_SDK}" | |
bb260ef2 | 430 | make $PARALLEL V=1 |
7d3d2c0c MC |
431 | make install |
432 | cd .. | |
433 | ||
f6a6d164 UH |
434 | # Strip all shared libs to reduce size. |
435 | find $PREFIX -iname "*.so" -exec ${TOOLCHAIN_TRIPLET}-strip -S {} \; | |
436 | ||
5d1a9a53 | 437 | # PulseView |
621e2e6e | 438 | $GIT_CLONE git://sigrok.org/pulseview |
5d1a9a53 | 439 | cd pulseview |
890c9708 | 440 | cmake $CM . |
bb260ef2 | 441 | make $PARALLEL VERBOSE=1 |
f6a6d164 UH |
442 | make install |
443 | ${TOOLCHAIN_TRIPLET}-strip -S libs/$TARGET_ARCH/libpulseview.so | |
1238f785 | 444 | cd android |
e25d7d5a | 445 | "${ANDROID_SDK}/tools/android" update project -p . -t android-14 -n PulseView |
aef0361e MC |
446 | ant debug |
447 | cd ../.. | |
e25d7d5a | 448 |