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