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