[Android] build: build VLC libs inside vlc build dir

Thomas Guillem git at videolan.org
Tue May 14 16:47:33 CEST 2019


vlc-android | branch: master | Thomas Guillem <thomas at gllm.fr> | Tue May 14 09:22:15 2019 +0200| [6ced6a51996cd6a62d3478b3ac583ea9150c9f1b] | committer: Thomas Guillem

build: build VLC libs inside vlc build dir

This will allow the following:

 ~/git/vlc $ ../vlc-android/compile-libvlc.sh -a arm64

Run an android build from a vlc source dir.

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

 compile-libvlc.sh   | 4 ++--
 compile.sh          | 9 ++++++---
 libvlc/build.gradle | 4 +++-
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/compile-libvlc.sh b/compile-libvlc.sh
index d6825fe94..7a58c56e9 100755
--- a/compile-libvlc.sh
+++ b/compile-libvlc.sh
@@ -170,7 +170,7 @@ else
 fi
 
 VLC_BUILD_DIR=`realpath $VLC_SRC_DIR/build-android-${TARGET_TUPLE}`
-VLC_OUT_PATH="$SRC_DIR/build/ndk"
+VLC_OUT_PATH="$VLC_BUILD_DIR/ndk"
 VLC_OUT_LDLIBS="-L$VLC_OUT_PATH/libs/${ANDROID_ABI} -lvlc"
 
 avlc_checkfail()
@@ -678,7 +678,7 @@ LOCAL_CXXFLAGS := -std=c++11
 include $(BUILD_SHARED_LIBRARY)
 EOF
 
-$NDK_BUILD -C build \
+$NDK_BUILD -C $VLC_OUT_PATH/.. \
     APP_STL="c++_shared" \
     APP_CPPFLAGS="-frtti -fexceptions" \
     VLC_SRC_DIR="$VLC_SRC_DIR" \
diff --git a/compile.sh b/compile.sh
index e675b628d..f756d3de1 100755
--- a/compile.sh
+++ b/compile.sh
@@ -326,8 +326,11 @@ if [ "$ANDROID_ABI" = "all" ]; then
     (ANDROID_ABI=x86_64 RELEASE=$RELEASE compile $copy_tmp)
     rm -rf $LIB_DIR/jni/libs/
     mv build/tmp $LIB_DIR/jni/libs/
+
+    GRADLE_VLC_SRC_DIRS="''"
 else
     compile
+    GRADLE_VLC_SRC_DIRS="$VLC_OUT_PATH/libs"
 fi
 
 ##################
@@ -341,10 +344,10 @@ elif [ "$RELEASE" = 1 ]; then
 fi
 
 if [ "$BUILD_LIBVLC" = 1 ];then
-    GRADLE_ABI=$GRADLE_ABI ./gradlew -p libvlc assemble${BUILDTYPE}
+    GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" GRADLE_ABI=$GRADLE_ABI ./gradlew -p libvlc assemble${BUILDTYPE}
     RUN=0
     if [ "$PUBLISH" = 1 ];then
-        GRADLE_ABI=$GRADLE_ABI ./gradlew -p libvlc install bintrayUpload
+        GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" GRADLE_ABI=$GRADLE_ABI ./gradlew -p libvlc install bintrayUpload
     fi
 elif [ "$BUILD_MEDIALIB" = 1 ]; then
     GRADLE_ABI=$GRADLE_ABI ./gradlew -p medialibrary assemble${BUILDTYPE}
@@ -359,7 +362,7 @@ else
         ACTION="assemble"
     fi
     TARGET="${ACTION}${BUILDTYPE}"
-    CLI="" GRADLE_ABI=$GRADLE_ABI ./gradlew $TARGET
+    GRADLE_VLC_SRC_DIRS="$GRADLE_VLC_SRC_DIRS" CLI="" GRADLE_ABI=$GRADLE_ABI ./gradlew $TARGET
 fi
 
 #######
diff --git a/libvlc/build.gradle b/libvlc/build.gradle
index 558b30bbf..2ab7ddbb5 100644
--- a/libvlc/build.gradle
+++ b/libvlc/build.gradle
@@ -2,6 +2,7 @@ apply plugin: 'com.android.library'
 apply plugin: 'com.github.dcendents.android-maven'
 
 def abi = System.getenv('GRADLE_ABI')?.toLowerCase()
+def vlcSrcDirs = System.getenv('GRADLE_VLC_SRC_DIRS')
 ext {
     library_version = '3.2-eap2'
     repoName = 'Android'
@@ -22,7 +23,8 @@ android {
     sourceSets {
         main {
             jni.srcDirs = [] // Prevent gradle from building native code with ndk; we have our own Makefile for it.
-            jniLibs.srcDirs = [ 'jni/libs', '../build/ndk/libs' ] // Where generated .so files are placed.
+            jniLibs.srcDirs = [ 'jni/libs' ]
+            jniLibs.srcDirs += "$vlcSrcDirs"
             manifest.srcFile 'AndroidManifest.xml'
             java.srcDirs = ['src']
             resources.srcDirs = ['src']



More information about the Android mailing list