]> sigrok.org Git - sigrok-util.git/blobdiff - cross-compile/android/sigrok-cross-android
sigrok-cross-android: Initial support for MIPS/x86 Android builds.
[sigrok-util.git] / cross-compile / android / sigrok-cross-android
index 0baf485df24c97f4487847100aeede45d77df0fe..c0aa4fd3dc93f9ef971ec14091dfc59f89337047 100755 (executable)
@@ -23,6 +23,14 @@ set -e
 
 # The path where your Android toolchain directory is located.
 TOOLCHAIN=$HOME/android/android-arm-toolchain
+# TOOLCHAIN=$HOME/android/android-mipsel-toolchain
+# TOOLCHAIN=$HOME/android/android-i686-toolchain
+
+# Select which Android toolchain to use.
+# Don't forget to also adapt TOOLCHAIN above if you change TOOLCHAIN_TRIPLET!
+TOOLCHAIN_TRIPLET=arm-linux-androideabi
+# TOOLCHAIN_TRIPLET=mipsel-linux-android
+# TOOLCHAIN_TRIPLET=i686-linux-android
 
 # The path where the cross-compiled packages will be installed.
 PREFIX=$HOME/sr_android
@@ -43,7 +51,7 @@ VER_GLIB=2.34.3
 VER_LIBZIP=0.11.1
 VER_LIBUSB=0.1.12
 VER_LIBFTDI=0.20
-VER_LIBUSB_1_0=1.0.9
+VER_LIBUSBX=1.0.17
 VER_PYTHON=3.3.3
 
 SF_MIRROR=switch.dl.sourceforge.net
@@ -56,7 +64,7 @@ mkdir $BUILDDIR
 cd $BUILDDIR
 
 # Build host Python before we start messing with the environment.
-wget http://python.org/ftp/python/$VER_PYTHON/Python-3.3.3.tar.xz
+wget http://python.org/ftp/python/$VER_PYTHON/Python-$VER_PYTHON.tar.xz
 tar xJf Python-$VER_PYTHON.tar.xz
 cd Python-$VER_PYTHON
 ./configure
@@ -76,13 +84,7 @@ export PKG_CONFIG_LIBDIR="$PREFIX/lib/pkgconfig"
 export -n PKG_CONFIG_PATH
 
 # Define some helper variables.
-C="--host=arm-linux-androideabi --prefix=$PREFIX"
-
-# Remember the directory we're in.
-case "$0" in
-  /*) TOP=$(dirname "$0");;
-  *) TOP=$(dirname "$(pwd)"/"$0");;
-esac
+C="--host=$TOOLCHAIN_TRIPLET --prefix=$PREFIX"
 
 # Get the latest versions of config.guess/config.sub that know about Android.
 git clone git://git.savannah.gnu.org/config.git
@@ -125,7 +127,7 @@ wget http://zlib.net/zlib-$VER_ZLIB.tar.gz
 tar xfvz zlib-$VER_ZLIB.tar.gz
 cd zlib-$VER_ZLIB
 # Note: zlib's configure doesn't understand --host, we need to pass $CC.
-CC=arm-linux-androideabi-gcc ./configure --prefix=$PREFIX
+CC=$TOOLCHAIN_TRIPLET-gcc ./configure --prefix=$PREFIX
 make
 make install
 cd ..
@@ -154,7 +156,7 @@ tar xJf glib-2.38.2.tar.xz
 cd glib-2.38.2
 ./autogen.sh
 # Note: Manual LDFLAGS/CPPFLAGS needed for libiconv, rest uses pkg-config.
-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 $C
+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
 make
 make install
 cd ..
@@ -195,11 +197,11 @@ make install
 cd ..
 
 # libusb-1.0
-wget http://$SF_MIRROR/project/libusb/libusb-1.0/libusb-$VER_LIBUSB_1_0/libusb-$VER_LIBUSB_1_0.tar.bz2
-tar xfj libusb-$VER_LIBUSB_1_0.tar.bz2
-cd libusb-$VER_LIBUSB_1_0
-patch -p1 < $TOP/libusb-1.0.patch
-./configure $C
+wget http://$SF_MIRROR/project/libusbx/releases/$VER_LIBUSBX/source/libusbx-$VER_LIBUSBX.tar.bz2
+tar xfj libusbx-$VER_LIBUSBX.tar.bz2
+cd libusbx-$VER_LIBUSBX
+patch -p1 < ../../libusb-1.0.patch
+./configure $C --disable-udev
 make
 make install
 cd ..