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