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