[Android] build: split vlcjni into 2 libs: vlc and vlcjni

Thomas Guillem git at videolan.org
Wed Feb 24 09:37:49 CET 2016


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue Feb 23 17:13:54 2016 +0100| [6d86f2063c1e19462790d614d641b38b9510a405] | committer: Thomas Guillem

build: split vlcjni into 2 libs: vlc and vlcjni

> https://code.videolan.org/videolan/vlc-android/commit/6d86f2063c1e19462790d614d641b38b9510a405
---

 compile-libvlc.sh                          | 28 ++++++++-------
 libvlc/jni/Android.mk                      | 55 ++++++++++++++++++------------
 libvlc/src/org/videolan/libvlc/LibVLC.java |  1 +
 3 files changed, 50 insertions(+), 34 deletions(-)

diff --git a/compile-libvlc.sh b/compile-libvlc.sh
index 0246c1a..3c5599d 100755
--- a/compile-libvlc.sh
+++ b/compile-libvlc.sh
@@ -619,19 +619,23 @@ EOF
     BUILTINS="$BUILTINS vlc_entry__$name,\n";
 done;
 BUILTINS="$BUILTINS NULL\n};\n"; \
-printf "/* Autogenerated from the list of modules */\n$DEFINITION\n$BUILTINS\n" > libvlc/jni/libvlcjni-modules.h
-rm ${REDEFINED_VLC_MODULES_DIR}/syms
+printf "/* Autogenerated from the list of modules */\n#include <unistd.h>\n$DEFINITION\n$BUILTINS\n" > libvlc/jni/libvlcjni-modules.c
+
+DEFINITION=""
+BUILTINS="const void *libvlc_functions[] = {\n";
+for func in `cat vlc/lib/libvlc.sym`
+do
+    DEFINITION=$DEFINITION"int $func(void);\n";
+    BUILTINS="$BUILTINS $func,\n";
+done
+BUILTINS="$BUILTINS NULL\n};\n"; \
+printf "/* Autogenerated from the list of modules */\n#include <unistd.h>\n$DEFINITION\n$BUILTINS\n" > libvlc/jni/libvlcjni-symbols.c
 
-# Generating the .ver file like libvlc.so upstream
-VER_FILE="vlc/$VLC_BUILD_DIR/lib/.libs/libvlc.ver"
-echo "{ global:" > $VER_FILE
-cat vlc/lib/libvlc.sym libvlc/libvlcjni.sym | sed -e "s/\(.*\)/\1;/" >> $VER_FILE
-echo "__gmp_binvert_limb_table;" >> $VER_FILE # FIXME
-echo "local: *; };" >> $VER_FILE
+rm ${REDEFINED_VLC_MODULES_DIR}/syms
 
-###############################
-# NDK-Build for libvlcjni.so  #
-###############################
+############################################
+# NDK-Build for libvlc.so and libvlcjni.so #
+############################################
 
 LIBVLC_LIBS="libvlcjni"
 VLC_MODULES=$(find_modules ${REDEFINED_VLC_MODULES_DIR})
@@ -661,7 +665,7 @@ $ANDROID_NDK/ndk-build -C libvlc \
     VLC_CONTRIB="$VLC_CONTRIB" \
     VLC_MODULES="$VLC_MODULES" \
     TARGET_CFLAGS="$EXTRA_CFLAGS" \
-    EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-soname -Wl,libvlc.so.5 -Wl,-version-script -Wl,$SRC_DIR/$VER_FILE" \
+    EXTRA_LDFLAGS="$EXTRA_LDFLAGS" \
     LIBVLC_LIBS="$LIBVLC_LIBS" \
     LIBIOMX_LIBS="$LIBIOMX_LIBS" \
     LIBANW_LIBS="$LIBANW_LIBS" \
diff --git a/libvlc/jni/Android.mk b/libvlc/jni/Android.mk
index d1714a8..0ad9672 100644
--- a/libvlc/jni/Android.mk
+++ b/libvlc/jni/Android.mk
@@ -1,31 +1,13 @@
 LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
 ANDROID_PRIVATE_LIBDIR := $(LOCAL_PATH)/../../android-libs
 
-LOCAL_MODULE    := libvlcjni
-
-LOCAL_SRC_FILES := libvlcjni.c
-LOCAL_SRC_FILES += libvlcjni-mediaplayer.c
-LOCAL_SRC_FILES += libvlcjni-vlcobject.c
-LOCAL_SRC_FILES += libvlcjni-media.c libvlcjni-medialist.c libvlcjni-mediadiscoverer.c
-LOCAL_SRC_FILES += libvlcjni-dialog.c
-LOCAL_SRC_FILES += native_crash_handler.c thumbnailer.c
-LOCAL_SRC_FILES += std_logger.c
-
-LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/include
-
+include $(CLEAR_VARS)
+LOCAL_MODULE := libvlc
 ARCH=$(APP_ABI)
-
-LOCAL_CFLAGS := -std=gnu99
 ifeq ($(ARCH), armeabi)
-	LOCAL_CFLAGS += -DHAVE_ARMEABI
-	# Needed by ARMv6 Thumb1 (the System Control coprocessor/CP15 is mandatory on ARMv6)
-	# On newer ARM architectures we can use Thumb2
 	LOCAL_ARM_MODE := arm
 endif
-ifeq ($(ARCH), armeabi-v7a)
-	LOCAL_CFLAGS += -DHAVE_ARMEABI_V7A
-endif
+LOCAL_SRC_FILES += libvlcjni-modules.c libvlcjni-symbols.c
 LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
 	$(VLC_MODULES) \
 	$(VLC_BUILD_DIR)/lib/.libs/libvlc.a \
@@ -56,8 +38,37 @@ LOCAL_LDLIBS := -L$(VLC_CONTRIB)/lib \
 	$(EXTRA_LDFLAGS)
 
 LOCAL_SHARED_LIBRARIES:= libcompat.7
+include $(BUILD_SHARED_LIBRARY)
+
+include $(CLEAR_VARS)
+LOCAL_MODULE    := libvlcjni
+
+LOCAL_SRC_FILES := libvlcjni.c
+LOCAL_SRC_FILES += libvlcjni-mediaplayer.c
+LOCAL_SRC_FILES += libvlcjni-vlcobject.c
+LOCAL_SRC_FILES += libvlcjni-media.c libvlcjni-medialist.c libvlcjni-mediadiscoverer.c
+LOCAL_SRC_FILES += libvlcjni-dialog.c
+LOCAL_SRC_FILES += native_crash_handler.c thumbnailer.c
+LOCAL_SRC_FILES += std_logger.c
+
+LOCAL_LDLIBS := -llog
+LOCAL_C_INCLUDES := $(VLC_SRC_DIR)/include
+
+ARCH=$(APP_ABI)
+
+LOCAL_CFLAGS := -std=gnu99
+ifeq ($(ARCH), armeabi)
+	LOCAL_CFLAGS += -DHAVE_ARMEABI
+	# Needed by ARMv6 Thumb1 (the System Control coprocessor/CP15 is mandatory on ARMv6)
+	# On newer ARM architectures we can use Thumb2
+	LOCAL_ARM_MODE := arm
+endif
+ifeq ($(ARCH), armeabi-v7a)
+	LOCAL_CFLAGS += -DHAVE_ARMEABI_V7A
+endif
+
+LOCAL_SHARED_LIBRARIES:= libvlc
 
-$(TARGET_OUT)/$(LOCAL_MODULE).so: $(ANDROID_PRIVATE_LIBS)
 include $(BUILD_SHARED_LIBRARY)
 
 ####################
diff --git a/libvlc/src/org/videolan/libvlc/LibVLC.java b/libvlc/src/org/videolan/libvlc/LibVLC.java
index 2b4bf07..0a0ef91 100644
--- a/libvlc/src/org/videolan/libvlc/LibVLC.java
+++ b/libvlc/src/org/videolan/libvlc/LibVLC.java
@@ -188,6 +188,7 @@ public class LibVLC extends VLCObject<LibVLC.Event> {
         }
 
         try {
+            System.loadLibrary("vlc");
             System.loadLibrary("vlcjni");
         } catch (UnsatisfiedLinkError ule) {
             Log.e(TAG, "Can't load vlcjni library: " + ule);



More information about the Android mailing list