+# libftdi1
+$WGET http://www.intra2net.com/en/developer/libftdi/download/libftdi1-$VER_LIBFTDI1.tar.bz2
+tar xfj libftdi1-$VER_LIBFTDI1.tar.bz2
+cd libftdi1-$VER_LIBFTDI1
+cmake $CM .
+make $PARALLEL
+make install
+cd ..
+
+# libserialport
+$GIT_CLONE git://sigrok.org/libserialport
+cd libserialport
+./autogen.sh
+./configure $C
+make $PARALLEL V=1
+make install
+cd ..
+
+# libsigrok
+$GIT_CLONE git://sigrok.org/libsigrok
+cd libsigrok
+./autogen.sh
+./configure $C
+make $PARALLEL V=1
+make install
+cd ..
+
+# libsigrokdecode
+$GIT_CLONE git://sigrok.org/libsigrokdecode
+cd libsigrokdecode
+./autogen.sh
+./configure $C
+make $PARALLEL V=1
+make install
+cd ..
+
+# sigrok-cli
+$GIT_CLONE git://sigrok.org/sigrok-cli
+cd sigrok-cli
+./autogen.sh
+./configure $C
+make $PARALLEL V=1
+make install
+cd ..
+
+
+# Check if we have kit to build PulseView
+
+if [ -z "$ANDROID_NDK" -o ! -d "$ANDROID_NDK" ]; then
+ echo "Android NDK not available, not building PulseView"
+ exit 0
+fi
+
+if [ -z "$ANDROID_SDK" -o ! -d "$ANDROID_SDK"/platforms/android-4 -o \
+ ! -d "$ANDROID_SDK"/platforms/android-7 -o \
+ ! -d "$ANDROID_SDK"/platforms/android-8 -o \
+ ! -d "$ANDROID_SDK"/platforms/android-14 ]; then
+ echo "Android SDK with platforms 4 7 8 14 not available, not building PulseView"
+ exit 0
+fi
+
+ANDROID_TOOLS=${ANDROID_SDK}/tools
+ANDROID_BUILD_TOOLS=${ANDROID_SDK}/build-tools/19.0.1
+
+if [ ! -e "$ANDROID_TOOLS/android" -o ! -e "$ANDROID_BUILD_TOOLS/dx" ]; then
+ echo "Essential Android build tools not available, not building PulseView"
+ exit 0
+fi
+
+NDK_TOOLCHAIN_VERSION=`${TOOLCHAIN_TRIPLET}-gcc --version | head -1 | sed -e 's/.* \([0-9]\+\.[0-9.]\+\)\( \|.*\)$/\1/'`
+NDK_HOST=`"$ANDROID_NDK/ndk-build" -p 2>/dev/null | awk '$1 == "HOST_TAG" { print $3 }'`
+
+
+# boost (needed for PulseView)
+$WGET http://$SF_MIRROR/project/boost/boost/$VER_BOOST/boost_${VER_BOOST//./_}.tar.bz2
+tar xfj boost_${VER_BOOST//./_}.tar.bz2
+cd boost_${VER_BOOST//./_}
+patch -p1 < ../../boost.patch
+./bootstrap.sh --with-toolset=gcc --with-libraries=filesystem,system,thread --without-icu
+echo "using gcc : $NDK_TOOLCHAIN_VERSION : \"${TOOLCHAIN_TRIPLET}-g++\" : <cxxflags>\"-I$PREFIX/include -I${ANDROID_NDK}/sources/cxx-stl/stlport/stlport\" <linkflags>\"-L$PREFIX/lib\" ;" > user-config.jam
+./b2 -q -d+2 --user-config=user-config.jam toolset=gcc variant=release link=shared threading=multi runtime-link=shared target-os=android --prefix=$PREFIX --layout=system install