From: Marcus Comstedt Date: Fri, 4 Jul 2014 17:01:20 +0000 (+0200) Subject: sigrok-cross-android: Use new libftdi1, drop libusb-0.1 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7966c37c48496a1a44582001d601b6cdc72463e4;p=sigrok-util.git sigrok-cross-android: Use new libftdi1, drop libusb-0.1 --- diff --git a/cross-compile/android/android.toolchain.cmake.patch b/cross-compile/android/android.toolchain.cmake.patch new file mode 100644 index 0000000..79b97ed --- /dev/null +++ b/cross-compile/android/android.toolchain.cmake.patch @@ -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() + execute_process( COMMAND "${ANDROID_STANDALONE_TOOLCHAIN}/bin/${__availableToolchainMachines}-gcc${TOOL_OS_SUFFIX}" --version + OUTPUT_VARIABLE __availableToolchainCompilerVersions OUTPUT_STRIP_TRAILING_WHITESPACE ) +- string( REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" __availableToolchainCompilerVersions "${__availableToolchainCompilerVersions}" ) ++ string( REGEX MATCH "[0-9]+(\\.[0-9]+)+" __availableToolchainCompilerVersions "${__availableToolchainCompilerVersions}" ) + endif() + endif() + +@@ -667,7 +667,12 @@ endif() + if( BUILD_WITH_STANDALONE_TOOLCHAIN ) + set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_STANDALONE_TOOLCHAIN}" ) + set( ANDROID_SYSROOT "${ANDROID_STANDALONE_TOOLCHAIN}/sysroot" ) +- set( __stlLibPath "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib" ) ++ if (NOT DEFINED ANDROID_STL_PATH) ++ set( __stlLibPath "${ANDROID_STANDALONE_TOOLCHAIN}/${ANDROID_TOOLCHAIN_MACHINE_NAME}/lib" ) ++ else() ++ set( __stlIncludePath "${ANDROID_STL_PATH}/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/include" ) ++ set( __stlLibPath "${ANDROID_STL_PATH}/gnu-libstdc++/${ANDROID_COMPILER_VERSION}/libs/${ANDROID_NDK_ABI_NAME}" ) ++ endif() + endif() + if( BUILD_WITH_ANDROID_NDK ) + set( ANDROID_TOOLCHAIN_ROOT "${ANDROID_NDK}/toolchains/${ANDROID_TOOLCHAIN_NAME}/prebuilt/${ANDROID_NDK_HOST_SYSTEM_NAME}" ) +@@ -732,6 +737,9 @@ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS + if( __stlIncludePath AND EXISTS "${__stlIncludePath}" ) + list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${__stlIncludePath}" ) + endif() ++if( __stlLibPath AND EXISTS "${__stlLibPath}/include" ) ++ list( APPEND ANDROID_SYSTEM_INCLUDE_DIRS "${__stlLibPath}/include" ) ++endif() + + # c++ bits includes + if( __stlLibPath AND EXISTS "${__stlLibPath}/include" ) diff --git a/cross-compile/android/sigrok-cross-android b/cross-compile/android/sigrok-cross-android index 1c15833..81dc357 100755 --- a/cross-compile/android/sigrok-cross-android +++ b/cross-compile/android/sigrok-cross-android @@ -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