sigrok-cross-android: Patch Boost to remove dependencies on libc wchar stuff
authorMarcus Comstedt <marcus@mc.pp.se>
Sat, 3 Dec 2016 14:11:12 +0000 (15:11 +0100)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 3 Dec 2016 18:55:46 +0000 (19:55 +0100)
This avoids issues like these:

  libboost_serialization.so: error: undefined reference to 'mbtowc'

  E/dalvikvm(28980): dlopen("/data/app-lib/org.sigrok.pulseview-1/
    libboost_serialization.so") failed: dlopen failed: cannot locate
    symbol "mbtowc" referenced by "libboost_serialization.so"

cross-compile/android/boost_wchar.patch [new file with mode: 0644]
cross-compile/android/sigrok-cross-android

diff --git a/cross-compile/android/boost_wchar.patch b/cross-compile/android/boost_wchar.patch
new file mode 100644 (file)
index 0000000..31c267a
--- /dev/null
@@ -0,0 +1,46 @@
+--- boost/config/platform/linux.hpp.orig       2016-12-03 12:31:10.512815722 +0100
++++ boost/config/platform/linux.hpp    2016-12-03 12:31:58.180223676 +0100
+@@ -102,4 +102,7 @@
+ #  endif
+ #endif
++#ifdef __ANDROID__
++#define BOOST_NO_CWCHAR
++#endif
+--- boost/integer_traits.hpp.orig      2016-12-03 14:22:08.001314430 +0100
++++ boost/integer_traits.hpp   2016-12-03 14:22:19.582412591 +0100
+@@ -23,7 +23,7 @@
+ #include <limits.h>
+ // we need wchar.h for WCHAR_MAX/MIN but not all platforms provide it,
+ // and some may have <wchar.h> but not <cwchar> ...
+-#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun) || defined(__QNX__))
++#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) && (!defined(BOOST_NO_CWCHAR) || defined(sun) || defined(__sun) || defined(__QNX__) || defined(__ANDROID__))
+ #include <wchar.h>
+ #endif
+--- libs/serialization/build/Jamfile.v2.orig   2016-12-03 13:29:51.821334991 +0100
++++ libs/serialization/build/Jamfile.v2        2016-12-03 13:30:21.457586514 +0100
+@@ -103,12 +103,13 @@
+     <link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
+     ;
+-lib boost_wserialization 
+-    : $(WSOURCES).cpp boost_serialization 
+-    :     
+-    <toolset>msvc:<cxxflags>/Gy 
+-    #<toolset>gcc:<cxxflags>"-fvisibility=hidden"
+-    <link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
+-    ;
+-
+-boost-install boost_serialization boost_wserialization ;
++# lib boost_wserialization 
++#     : $(WSOURCES).cpp boost_serialization 
++#     :     
++#     <toolset>msvc:<cxxflags>/Gy 
++#     #<toolset>gcc:<cxxflags>"-fvisibility=hidden"
++#     <link>shared:<define>BOOST_SERIALIZATION_DYN_LINK=1
++#     ;
++#
++# boost-install boost_serialization boost_wserialization ;
++boost-install boost_serialization ;
index 6b219efc49457266f46fd9db9472a08ff9070ae3..ea67d6b7ae4de705b7404d5108d0ff95d304cc4c 100755 (executable)
@@ -440,6 +440,7 @@ NDK_HOST=`"$ANDROID_NDK/ndk-build" -p 2>/dev/null | awk '$1 == "HOST_TAG" { prin
 $WGET http://$SF_MIRROR/project/boost/boost/$VER_BOOST/boost_${VER_BOOST//./_}.tar.bz2
 tar xfj boost_${VER_BOOST//./_}.tar.bz2
 cd boost_${VER_BOOST//./_}
+patch -p0 < ../../boost_wchar.patch
 CC= ./bootstrap.sh --with-toolset=gcc --with-libraries=filesystem,system,thread,serialization,test --without-icu
 echo "using gcc : $NDK_TOOLCHAIN_VERSION : \"${TOOLCHAIN_TRIPLET}-g++\" : <cxxflags>\"$SYSROOT -I$PREFIX/include $CPPFLAGS_STL\" <linkflags>\"$SYSROOT -L$PREFIX/lib $LDFLAGS_STL -lgnustl_shared\" ;" > user-config.jam
 ./b2 -q -d+2 --ignore-site-config --user-config=user-config.jam toolset=gcc variant=release link=shared threading=multi runtime-link=shared target-os=android --prefix=$PREFIX --layout=system install $PARALLEL