]> sigrok.org Git - sigrok-util.git/blobdiff - cross-compile/android/sigrok-cross-android
sigrok-cross-android: Update repo URLs.
[sigrok-util.git] / cross-compile / android / sigrok-cross-android
index 81dc357f2e3143b63fc03981097907f085b0a60d..f802a5d7b977a85ac59f11e5f231fe7fe9fc4b68 100755 (executable)
 
 set -e
 
+# The path where Android NDK is located.
+ANDROID_NDK=$HOME/android/android-ndk-r9d
+
+# The path where Android SDK is located.
+ANDROID_SDK=$HOME/android/android-sdk-linux
+
 # The path where your Android toolchain directory is located.
 TOOLCHAIN=$HOME/android/android-arm-toolchain
 # TOOLCHAIN=$HOME/android/android-mipsel-toolchain
@@ -56,6 +62,8 @@ VER_LIBZIP=0.11.1
 VER_LIBFTDI1=1.1
 VER_LIBUSBX=1.0.17
 VER_PYTHON=3.3.3
+VER_BOOST=1.55.0
+VER_QT=5.3.1
 
 SF_MIRROR=switch.dl.sourceforge.net
 
@@ -82,9 +90,7 @@ tar xJf Python-$VER_PYTHON.tar.xz
 cd Python-$VER_PYTHON
 ./configure
 make python $PARALLEL
-make Parser/pgen $PARALLEL
 mv python hostpython
-mv Parser/pgen Parser/hostpgen
 cd ..
 
 # -----------------------------------------------------------------------------
@@ -115,7 +121,8 @@ make distclean
 autoreconf
 patch -p1 < ../../Python-$VER_PYTHON.patch
 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
-make HOSTPYTHON=./hostpython HOSTPGEN=./Parser/hostpgen install $PARALLEL
+sed -i "s/^#zlib/zlib/g" Modules/Setup
+make PYTHON_FOR_BUILD=./hostpython install $PARALLEL
 cd ..
 
 # libiconv (needed for glib)
@@ -231,7 +238,7 @@ cd ..
 $GIT_CLONE git://sigrok.org/libsigrok
 cd libsigrok
 ./autogen.sh
-./configure $C
+./configure $C --datadir=/sdcard
 make $PARALLEL V=1
 make install
 cd ..
@@ -254,3 +261,69 @@ 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-8 -o \
+     ! -d "$ANDROID_SDK"/platforms/android-10 -o \
+     ! -d "$ANDROID_SDK"/platforms/android-11 -o \
+     ! -d "$ANDROID_SDK"/platforms/android-14 -o \
+     ! -d "$ANDROID_SDK"/platforms/android-16 ]; then
+  echo "Android SDK with platforms 8 10 11 14 16 not available, not building PulseView"
+  exit 0
+fi
+
+ANDROID_TOOLS=${ANDROID_SDK}/tools
+
+if [ ! -e "$ANDROID_TOOLS/android" ]; 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 --without-icu
+echo "using gcc : $NDK_TOOLCHAIN_VERSION : \"${TOOLCHAIN_TRIPLET}-g++\" : <cxxflags>\"-I$PREFIX/include -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${NDK_TOOLCHAIN_VERSION}/include -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${NDK_TOOLCHAIN_VERSION}/libs/${TARGET_ARCH}/include\" <linkflags>\"-L$PREFIX/lib -L${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${NDK_TOOLCHAIN_VERSION}/libs/${TARGET_ARCH} -Wl,-rpath=${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${NDK_TOOLCHAIN_VERSION}/libs/${TARGET_ARCH} -lgnustl_shared\" ;" > 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
+cd ..
+
+# qt (needed for PulseView)
+$WGET http://download.qt-project.org/official_releases/qt/${VER_QT%.*}/${VER_QT}/single/qt-everywhere-opensource-src-${VER_QT}.tar.gz
+tar xfz qt-everywhere-opensource-src-${VER_QT}.tar.gz
+cd qt-everywhere-opensource-src-${VER_QT}
+patch -p1 < ../../android-qt.patch
+./configure --prefix="$PREFIX" -developer-build -xplatform android-g++ -nomake tests -nomake examples -android-sdk "$ANDROID_SDK" -android-ndk "$ANDROID_NDK" -android-ndk-host "$NDK_HOST" -android-arch "$TARGET_ARCH" -android-toolchain-version "$NDK_TOOLCHAIN_VERSION" -skip qttranslations -skip qtwebkit -skip qtserialport -skip qtwebkit-examples -skip qtlocation -skip qtconnectivity -opensource -confirm-license
+make $PARALLEL
+make install
+cd ..
+
+# sigrok-androidutils
+$GIT_CLONE git://sigrok.org/sigrok-androidutils
+cd sigrok-androidutils
+./autogen.sh
+./configure $C --with-android-sdk="${ANDROID_SDK}"
+make
+make install
+cd ..
+
+# PulseView
+$GIT_CLONE git://sigrok.org/pulseview
+cd pulseview
+cmake $CM -DANDROID_STL_PATH=${ANDROID_NDK}/sources/cxx-stl .
+make $PARALLEL
+cd android
+"$ANDROID_TOOLS/android" update project -p . -t android-14 -n PulseView
+ant debug
+cd ../..