[Android] build: keep debug info in a seperate .so.dbg file for release

Thomas Guillem git at videolan.org
Wed Apr 8 09:35:46 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Apr  7 17:56:02 2015 +0200| [189e3b6ec913e8d7b6b28428fea1667a40d41883] | committer: Thomas Guillem

build: keep debug info in a seperate .so.dbg file for release

*.so.dbg files are saved in .dbg/<apk_version> directory

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=189e3b6ec913e8d7b6b28428fea1667a40d41883
---

 .gitignore        |    2 ++
 compile-libvlc.sh |   18 ++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/.gitignore b/.gitignore
index 70d741a..78f0081 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,8 @@
 
 # tmp dir used by gdb.sh
 .gdb
+# debug symbols
+.dbg
 
 # Local configuration
 local.properties
diff --git a/compile-libvlc.sh b/compile-libvlc.sh
index 7c64c0c..0d92167 100755
--- a/compile-libvlc.sh
+++ b/compile-libvlc.sh
@@ -633,3 +633,21 @@ $ANDROID_NDK/ndk-build -C libvlc \
     HAVE_64=${HAVE_64} \
     NDK_PROJECT_PATH=jni \
     NDK_DEBUG=${NDK_DEBUG}
+
+checkfail "ndk-build failed"
+
+if [ "$RELEASE" = 1 ]; then
+    DBG_LIB_DIR=libvlc/jni/obj/local/${ANDROID_ABI}
+    OUT_LIB_DIR=libvlc/jni/libs/${ANDROID_ABI}
+    VERSION=$(grep "android:versionName" vlc-android/AndroidManifest.xml|cut -d\" -f 2)
+    OUT_DBG_DIR=.dbg/${ANDROID_ABI}/$VERSION
+
+    mkdir -p $OUT_DBG_DIR
+
+    for lib in ${DBG_LIB_DIR}/*.so; do
+        ${CROSS_COMPILE}objcopy --only-keep-debug "$lib" "$OUT_DBG_DIR/`basename $lib.dbg`"; \
+    done
+    for lib in ${OUT_LIB_DIR}/*.so; do
+        ${CROSS_COMPILE}objcopy --add-gnu-debuglink="$OUT_DBG_DIR/`basename $lib.dbg`" "$lib" ; \
+    done
+fi



More information about the Android mailing list