]> sigrok.org Git - sigrok-util.git/commitdiff
sigrok-cross-android: Build libusb-1.0
authorMarcus Comstedt <redacted>
Wed, 28 Aug 2013 13:07:18 +0000 (15:07 +0200)
committerUwe Hermann <redacted>
Fri, 30 Aug 2013 12:43:45 +0000 (14:43 +0200)
cross-compile/android/libusb-1.0.patch [new file with mode: 0644]
cross-compile/android/sigrok-cross-android

diff --git a/cross-compile/android/libusb-1.0.patch b/cross-compile/android/libusb-1.0.patch
new file mode 100644 (file)
index 0000000..5154bf0
--- /dev/null
@@ -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
+  *
index 96224755e0b147b75c13aed2fca73ef8985ebeca..f6ea322f0dfcb05313c536e83a265813c3b9b8e5 100755 (executable)
@@ -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 ..