[Android] create the ASAN stdblib.h in our contrib includes, not the toolchain

Steve Lhomme git at videolan.org
Fri Oct 21 15:24:48 CEST 2016


vlc-android | branch: master | Steve Lhomme <robux4 at videolabs.io> | Tue Oct 18 12:41:23 2016 +0200| [5916c9d535455b538dec6fc95ff69bd7c5924a05] | committer: Thomas Guillem

create the ASAN stdblib.h in our contrib includes, not the toolchain

also fix stdlib.h include from C++

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> https://code.videolan.org/videolan/vlc-android/commit/5916c9d535455b538dec6fc95ff69bd7c5924a05
---

 compile-libvlc.sh | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/compile-libvlc.sh b/compile-libvlc.sh
index 76ffb0f..acb2fc2 100755
--- a/compile-libvlc.sh
+++ b/compile-libvlc.sh
@@ -425,10 +425,18 @@ if [ "${ASAN}" = 1 ];then
     VLC_LDFLAGS="${VLC_LDFLAGS} -ldl -fsanitize=address"
     # ugly, sorry
     if [ "${ANDROID_API}" = "9" ];then
-        cp ${ANDROID_NDK}/platforms/android-9/arch-${PLATFORM_SHORT_ARCH}/usr/include/stdlib.h \
-            ${NDK_TOOLCHAIN_DIR}/sysroot/usr/include
-        echo "extern int posix_memalign(void **memptr, size_t alignment, size_t size);" \
-            >> ${NDK_TOOLCHAIN_DIR}/sysroot/usr/include/stdlib.h
+        if [ ! -f vlc/contrib/${TARGET_TUPLE}/include/stdlib.h ]; then
+            mkdir -p vlc/contrib/${TARGET_TUPLE}/include
+            printf "#include_next <stdlib.h>\n"
+                   "#ifdef __cplusplus\n"
+                   "extern \"C\" {\n"
+                   "#endif\n"
+                   "extern int posix_memalign(void **memptr, size_t alignment, size_t size);\n"
+                   "#ifdef __cplusplus\n"
+                   "}\n"
+                   "#endif\n" \
+                > vlc/contrib/${TARGET_TUPLE}/include/stdlib.h
+        fi
     fi
 fi
 



More information about the Android mailing list