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