From: Marcus Comstedt Date: Wed, 28 Aug 2013 13:07:18 +0000 (+0200) Subject: sigrok-cross-android: Build libusb-1.0 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=13b2dfdc90c4533b3bd651ef79f5bc2c40422f5d;p=sigrok-util.git sigrok-cross-android: Build libusb-1.0 --- diff --git a/cross-compile/android/libusb-1.0.patch b/cross-compile/android/libusb-1.0.patch new file mode 100644 index 0000000..5154bf0 --- /dev/null +++ b/cross-compile/android/libusb-1.0.patch @@ -0,0 +1,18 @@ +diff -urp libusb-1.0.9.orig/libusb/io.c libusb-1.0.9/libusb/io.c +--- libusb-1.0.9.orig/libusb/io.c 2013-08-28 14:33:15.000000000 +0200 ++++ libusb-1.0.9/libusb/io.c 2013-08-28 14:31:25.000000000 +0200 +@@ -36,6 +36,14 @@ + + #include "libusbi.h" + ++#ifndef TIMESPEC_TO_TIMEVAL ++#define TIMESPEC_TO_TIMEVAL(tv, ts) \ ++ do { \ ++ (tv)->tv_sec = (ts)->tv_sec; \ ++ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ ++ } while (0) ++#endif ++ + /** + * \page io Synchronous and asynchronous device I/O + * diff --git a/cross-compile/android/sigrok-cross-android b/cross-compile/android/sigrok-cross-android index 9622475..f6ea322 100755 --- a/cross-compile/android/sigrok-cross-android +++ b/cross-compile/android/sigrok-cross-android @@ -43,6 +43,7 @@ VER_GLIB=2.34.3 VER_LIBZIP=0.10.1 VER_LIBUSB=0.1.12 VER_LIBFTDI=0.20 +VER_LIBUSB_1_0=1.0.9 SF_MIRROR=switch.dl.sourceforge.net @@ -58,6 +59,12 @@ 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 + # Remove build directory contents (if any) and create a new build dir. rm -rf $BUILDDIR mkdir $BUILDDIR @@ -172,11 +179,21 @@ make 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 +make +make install +cd .. + # libsigrok git clone git://sigrok.org/libsigrok cd libsigrok ./autogen.sh -LDFLAGS=-L$PREFIX/lib CPPFLAGS="-I$PREFIX/include -I$PREFIX/lib/libzip/include" ./configure $C --disable-alsa --disable-link-mso19 --disable-kecheng-kc-330b +LDFLAGS=-L$PREFIX/lib CPPFLAGS="-I$PREFIX/include -I$PREFIX/lib/libzip/include" ./configure $C --disable-alsa make make install cd ..