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