]> sigrok.org Git - sigrok-util.git/commitdiff
sigrok-cross-android: Use new libftdi1, drop libusb-0.1
authorMarcus Comstedt <redacted>
Fri, 4 Jul 2014 17:01:20 +0000 (19:01 +0200)
committerMarcus Comstedt <redacted>
Fri, 4 Jul 2014 17:13:19 +0000 (19:13 +0200)
cross-compile/android/android.toolchain.cmake.patch [new file with mode: 0644]
cross-compile/android/sigrok-cross-android

diff --git a/cross-compile/android/android.toolchain.cmake.patch b/cross-compile/android/android.toolchain.cmake.patch
new file mode 100644 (file)
index 0000000..79b97ed
--- /dev/null
@@ -0,0 +1,35 @@
+--- android.toolchain.cmake.orig       2014-04-06 16:08:25.765699476 +0200
++++ android.toolchain.cmake    2014-04-06 16:22:30.671987319 +0200
+@@ -464,7 +464,7 @@ if( BUILD_WITH_STANDALONE_TOOLCHAIN )
+  else()\r
+   execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" --version\r
+    OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE )\r
+-  string( REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" __availableToolchainCompilerVersions "${__availableToolchainCompilerVersions}" )\r
++  string( REGEX MATCH "[0-9]+(\\.[0-9]+)+" __availableToolchainCompilerVersions "${__availableToolchainCompilerVersions}" )\r
+  endif()\r
+ endif()\r
\r
+@@ -667,7 +667,12 @@ endif()
+ if( BUILD_WITH_STANDALONE_TOOLCHAIN )\r
+  set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_STANDALONE_TOOLCHAIN}" )\r
+  set( ANDROID_SYSROOT "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot" )\r
+- set( __stlLibPath "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib" )\r
++ if (NOT DEFINED ANDROID_STL_PATH)\r
++  set( __stlLibPath "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib" )\r
++ else()\r
++   set( __stlIncludePath "${ANDROID_STL_PATH}/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/include" )\r
++   set( __stlLibPath "${ANDROID_STL_PATH}/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/libs/${ANDROID_NDK_ABI_NAME}" )\r
++ endif()\r
+ endif()\r
+ if( BUILD_WITH_ANDROID_NDK )\r
+  set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" )\r
+@@ -732,6 +737,9 @@ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS
+ if( __stlIncludePath AND EXISTS "${__stlIncludePath}" )\r
+  list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${__stlIncludePath}" )\r
+ endif()\r
++if( __stlLibPath AND EXISTS "${__stlLibPath}/include" )\r
++ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${__stlLibPath}/include" )\r
++endif()\r
\r
+ # c++ bits includes\r
+ if( __stlLibPath AND EXISTS "${__stlLibPath}/include" )\r
index 1c158339cb0c9de099c0e0ffd16653d42e4d7dcc..81dc357f2e3143b63fc03981097907f085b0a60d 100755 (executable)
@@ -53,8 +53,7 @@ VER_LIBFFI=3.0.13
 VER_GLIB=2.38.2
 VER_GLIB_SHORT=2.38
 VER_LIBZIP=0.11.1
-VER_LIBUSB=0.1.12
-VER_LIBFTDI=0.20
+VER_LIBFTDI1=1.1
 VER_LIBUSBX=1.0.17
 VER_PYTHON=3.3.3
 
@@ -63,6 +62,13 @@ SF_MIRROR=switch.dl.sourceforge.net
 WGET="wget --quiet"
 GIT_CLONE="git clone --depth=1"
 
+case "$TOOLCHAIN_TRIPLET" in
+  arm*) TARGET_ARCH=armeabi;;
+  mips*) TARGET_ARCH=mips;;
+  i686*) TARGET_ARCH=x86;;
+  *) echo >&2 "Unknown prefix for TOOLCHAIN_TRIPLET"; exit 1;;
+esac
+
 # -----------------------------------------------------------------------------
 
 # Remove build directory contents (if any) and create a new build dir.
@@ -92,10 +98,15 @@ export -n PKG_CONFIG_PATH
 
 # Define some helper variables.
 C="--host=$TOOLCHAIN_TRIPLET --prefix=$PREFIX"
+CM="-Wno-dev -DCMAKE_TOOLCHAIN_FILE=../android.toolchain.cmake -DANDROID_ABI=${TARGET_ARCH} -DCMAKE_INSTALL_PREFIX=${PREFIX} -DANDROID_STANDALONE_TOOLCHAIN=${TOOLCHAIN}"
 
 # Get the latest versions of config.guess/config.sub that know about Android.
 $GIT_CLONE git://git.savannah.gnu.org/config.git
 
+# Get a toolchain for cmake that knows about Android
+wget https://android-cmake.googlecode.com/hg/toolchain/android.toolchain.cmake
+patch < ../android.toolchain.cmake.patch android.toolchain.cmake
+
 # -----------------------------------------------------------------------------
 
 # Python (needed for libsigrokdecode)
@@ -188,30 +199,6 @@ make $PARALLEL
 make install
 cd ..
 
-# libusb-0.1 (not used directly, but needed for libftdi)
-$WGET http://$SF_MIRROR/project/libusb/libusb-0.1%20%28LEGACY%29/$VER_LIBUSB/libusb-$VER_LIBUSB.tar.gz
-tar xfz libusb-$VER_LIBUSB.tar.gz
-cd libusb-$VER_LIBUSB
-cp -f ../config/config.guess .
-cp -f ../config/config.sub .
-./configure $C
-# Explicitly exclude libusbpp.la from lib_LTLIBRARIES, and skip subdirs.
-make lib_LTLIBRARIES=libusb.la SUBDIRS=. $PARALLEL
-make lib_LTLIBRARIES=libusb.la SUBDIRS=. install
-cd ..
-
-# libftdi
-$WGET http://www.intra2net.com/en/developer/libftdi/download/libftdi-$VER_LIBFTDI.tar.gz
-tar xfz libftdi-$VER_LIBFTDI.tar.gz
-cd libftdi-$VER_LIBFTDI
-cp -f ../config/config.guess .
-cp -f ../config/config.sub .
-# libftdi needs to find libusb-config which is installed in $PREFIX/bin.
-PATH=$PREFIX/bin:$PATH ./configure $C
-make $PARALLEL
-make install
-cd ..
-
 # libusb-1.0
 $WGET http://$SF_MIRROR/project/libusbx/releases/$VER_LIBUSBX/source/libusbx-$VER_LIBUSBX.tar.bz2
 tar xfj libusbx-$VER_LIBUSBX.tar.bz2
@@ -222,6 +209,15 @@ make $PARALLEL
 make install
 cd ..
 
+# 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