Commit 8f6cc0f0 authored by Geoffrey Métais's avatar Geoffrey Métais

Multi-arch LibVLC & Medialibrary

parent 0e445db0
......@@ -501,10 +501,9 @@ $ANDROID_NDK/ndk-build$OSCMD -C libvlc \
checkfail "ndk-build libvlc failed"
echo "Dumping dbg symbols info ${OUT_DBG_DIR}"
cd ${SRC_DIR}
OUT_DBG_DIR=.dbg/${ANDROID_ABI}
echo "Dumping dbg symbols info ${OUT_DBG_DIR}"
mkdir -p $OUT_DBG_DIR
cp -a libvlc/jni/obj/local/${ANDROID_ABI}/*.so ${OUT_DBG_DIR}
......@@ -102,6 +102,8 @@ elif [ "$ANDROID_ABI" = "x86" ]; then
GRADLE_ABI="x86"
elif [ "$ANDROID_ABI" = "x86_64" ]; then
GRADLE_ABI="x86_64"
elif [ "$ANDROID_ABI" = "all" ]; then
GRADLE_ABI="all"
else
diagnostic "Invalid arch specified: '$ANDROID_ABI'."
diagnostic "Try --help for more information"
......@@ -260,24 +262,42 @@ cd ..
############
diagnostic "Configuring"
OPTS="-a ${ANDROID_ABI}"
if [ "$RELEASE" = 1 ]; then
OPTS="$OPTS release"
fi
if [ "$CHROME_OS" = 1 ]; then
OPTS="$OPTS -c"
fi
if [ "$ASAN" = 1 ]; then
OPTS="$OPTS --asan"
fi
compile() {
OPTS="-a $1"
if [ "$RELEASE" = 1 ]; then
OPTS="$OPTS release"
fi
if [ "$CHROME_OS" = 1 ]; then
OPTS="$OPTS -c"
fi
if [ "$ASAN" = 1 ]; then
OPTS="$OPTS --asan"
fi
# Build LibVLC if asked for it, or needed by medialibrary
if [ "$BUILD_MEDIALIB" != 1 -o ! -d "libvlc/jni/libs/$ANDROID_ABI" ]; then
GRADLE_ABI=$GRADLE_ABI ./compile-libvlc.sh $OPTS
fi
# Build LibVLC if asked for it, or needed by medialibrary
if [ "$BUILD_MEDIALIB" != 1 -o ! -d "libvlc/jni/libs/$ANDROID_ABI" ]; then
./compile-libvlc.sh $OPTS
fi
if [ "$NO_ML" != 1 ]; then
GRADLE_ABI=$GRADLE_ABI ./compile-medialibrary.sh $OPTS
if [ "$NO_ML" != 1 ]; then
./compile-medialibrary.sh $OPTS
fi
}
if [ "$ANDROID_ABI" = "all" ]; then
if [ -d libvlc/tmp ]; then
rm -rf libvlc/tmp
fi
mkdir libvlc/tmp
compile armeabi-v7a
mv libvlc/jni/libs/armeabi-v7a libvlc/tmp
compile arm64-v8a
mv libvlc/jni/libs/arm64-v8a libvlc/tmp
compile x86
mv libvlc/jni/libs/x86 libvlc/tmp
compile x86_64
mv libvlc/tmp/* libvlc/jni/libs
else
compile $ANDROID_ABI
fi
##################
......@@ -294,11 +314,11 @@ if [ "$CHROME_OS" = 1 ]; then
PLATFORM="Chrome"
fi
if [ "$BUILD_LIBVLC" = 1 ];then
./gradlew -p libvlc assemble${BUILDTYPE}
GRADLE_ABI=$GRADLE_ABI ./gradlew -p libvlc assemble${BUILDTYPE}
RUN=0
CHROME_OS=0
elif [ "$BUILD_MEDIALIB" = 1 ]; then
./gradlew -p medialibrary assemble${BUILDTYPE}
GRADLE_ABI=$GRADLE_ABI ./gradlew -p medialibrary assemble${BUILDTYPE}
RUN=0
CHROME_OS=0
else
......
......@@ -41,65 +41,15 @@ android {
// Make per-variant version code
libraryVariants.all { variant ->
def vlcVersion = rootProject.ext.versionName
//Custom APK name
variant.outputs.each { output ->
if (output.outputFileName != null && output.outputFileName.endsWith('.aar')) {
output.outputFileName = "libvlc-${vlcVersion}.aar"
output.outputFileName = "libvlc-${abi}-${library_version}.aar"
}
}
}
}
/*
* Include GDB files into apk
*/
//afterEvaluate {
// Sync packageTask = project.getTasks().findByName("packageReleaseJniLibs")
// packageTask.include(['**/gdbserver', '**/gdb.setup'])
//}
//class BuildNative extends Exec {}
//
//tasks.withType(BuildNative){
// /*
// Properties set for Android Studio own shell.
// when you run gradlew from cli, OS shell env variables will be used
//
// To be able to build from Android Studio, you have to set ndk.dir & sdk.dir
// properties in local.properties in the root folder, like this (for example):
// sdk.dir=/home/<username>/SDK/android-sdk-linux
// ndk.dir=/home/<username>/SDK/android-ndk-r10b
// */
// if (System.getenv('ANDROID_SDK') == null || System.getenv('ANDROID_NDK') == null) {
// Properties properties = new Properties()
// properties.load(project.rootProject.file('local.properties').newDataInputStream())
// environment 'ANDROID_NDK', properties.getProperty('ndk.dir')
// environment 'ANDROID_SDK', properties.getProperty('sdk.dir')
// }
// workingDir '..'
// commandLine './compile-libvlc.sh'
//}
//
//task buildDebugARMv7(type:BuildNative) {
// args('-a', "armeabi-v7a")
//}
//task buildDebugARM64(type:BuildNative) {
// args('-a', "arm64-v8a")
//}
//task buildDebugx86(type:BuildNative) {
// args('-a', "x86")
//}
//task buildDebugx86_64(type:BuildNative) {
// args('-a', "x86_64")
//}
//task buildDebugMIPS(type:BuildNative) {
// args('-a', "mips")
//}
//task buildDebugMIPS64(type:BuildNative) {
// args('-a', "mips64")
//}
//
task generateSources (type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.srcDirs
......
......@@ -71,6 +71,16 @@ android {
dataBinding {
enabled = true
}
// Make per-variant version code
libraryVariants.all { variant ->
//Custom APK name
variant.outputs.each { output ->
if (output.outputFileName != null && output.outputFileName.endsWith('.aar')) {
output.outputFileName = "medialibrary-${abi}-${library_version}.aar"
}
}
}
}
task generateSources (type: Jar) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment