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