[Android] buildsystem: Bump medialib hash & switch to meson
Hugo Beauzée-Luyssen
git at videolan.org
Tue Feb 23 08:49:28 UTC 2021
vlc-android | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Feb 19 14:04:25 2021 +0100| [598d4758e6a7c09a84efd064916b719575b08729] | committer: Nicolas Pomepuy
buildsystem: Bump medialib hash & switch to meson
> https://code.videolan.org/videolan/vlc-android/commit/598d4758e6a7c09a84efd064916b719575b08729
---
buildsystem/compile-medialibrary.sh | 52 ++++++++++++++------------------
medialibrary/jni/AndroidMediaLibrary.cpp | 9 +++---
medialibrary/jni/AndroidMediaLibrary.h | 4 +--
medialibrary/jni/medialibrary.cpp | 6 ++--
4 files changed, 32 insertions(+), 39 deletions(-)
diff --git a/buildsystem/compile-medialibrary.sh b/buildsystem/compile-medialibrary.sh
index ada1e0590..251940ba6 100755
--- a/buildsystem/compile-medialibrary.sh
+++ b/buildsystem/compile-medialibrary.sh
@@ -4,7 +4,7 @@
# ARGUMENTS #
#############
-MEDIALIBRARY_HASH=214c7fc12e698df82b5494507771fe23939064b9
+MEDIALIBRARY_HASH=21e6a3a07d45eb58eab04d1ae6d3151b32c939fa
while [ $# -gt 0 ]; do
case $1 in
@@ -117,50 +117,42 @@ cd ${SRC_DIR}
# CONFIGURE #
#############
-cd ${MEDIALIBRARY_BUILD_DIR}
-
-if [ ! -d "build-android-$ANDROID_ABI/" ]; then
- mkdir "build-android-$ANDROID_ABI/";
-fi;
-cd "build-android-$ANDROID_ABI/";
-
if [ "$RELEASE" = "1" ]; then
- MEDIALIBRARY_MODE=--disable-debug
+ MEDIALIBRARY_MODE=release
+else
+ MEDIALIBRARY_MODE=debug
fi
-if [ ! -e ./config.h -o "$RELEASE" = "1" ]; then
- ../bootstrap
- ../configure \
- --host=$TARGET_TUPLE \
- --disable-shared \
- ${MEDIALIBRARY_MODE} \
- CFLAGS="${VLC_CFLAGS}" \
- CXXFLAGS="${VLC_CFLAGS}" \
- CC="${CROSS_CLANG}" \
- CXX="${CROSS_CLANG}++" \
- NM="${CROSS_TOOLS}nm" \
- STRIP="${CROSS_TOOLS}strip" \
- RANLIB="${CROSS_TOOLS}ranlib" \
+
+cd ${MEDIALIBRARY_BUILD_DIR}
+
+if [ ! -d "build-android-$ANDROID_ABI/" -o ! -f "build-android-$ANDROID_ABI/build.ninja" ]; then
PKG_CONFIG_LIBDIR="$SRC_DIR/vlc/build-android-${TARGET_TUPLE}/install/lib/pkgconfig" \
- PKG_CONFIG_PATH="$SRC_DIR/medialibrary/prefix/${TARGET_TUPLE}/lib/pkgconfig" \
- LIBJPEG_LIBS="-L$SRC_DIR/vlc/contrib/contrib-android-$TARGET_TUPLE/jpeg/.libs -ljpeg" \
- LIBJPEG_CFLAGS="-I$SRC_DIR/vlc/contrib/$TARGET_TUPLE/include/" \
- AR="${CROSS_TOOLS}ar"
- avlc_checkfail "medialibrary: autoconf failed"
+ PKG_CONFIG_PATH="$SRC_DIR/medialibrary/prefix/${TARGET_TUPLE}/lib/pkgconfig:$SRC_DIR/vlc/contrib/$TARGET_TUPLE/lib/pkgconfig/" \
+ meson --buildtype=${MEDIALIBRARY_MODE} \
+ -Ddefault_library=static \
+ --cross-file ${SRC_DIR}/buildsystem/crossfiles/${ANDROID_ABI}.crossfile \
+ -Dlibjpeg_prefix="$SRC_DIR/vlc/contrib/$TARGET_TUPLE/" \
+ -Dtests=disabled \
+ -Dforce_attachment_api=true \
+ build-android-${ANDROID_ABI}
fi
+avlc_checkfail "medialibrary: meson failed"
+
############
# BUILDING #
############
echo -e "\e[1m\e[32mBuilding medialibrary\e[0m"
-make $MAKEFLAGS
+cd "build-android-$ANDROID_ABI/";
+ninja
-avlc_checkfail "medialibrary: make failed"
+avlc_checkfail "medialibrary: build failed"
cd ${SRC_DIR}
MEDIALIBRARY_LDLIBS="$VLC_OUT_LDLIBS \
--L${MEDIALIBRARY_BUILD_DIR}/build-android-$ANDROID_ABI/.libs -lmedialibrary \
+-L${MEDIALIBRARY_BUILD_DIR}/build-android-$ANDROID_ABI/src/ -lmedialibrary \
-L$SRC_DIR/vlc/contrib/contrib-android-$TARGET_TUPLE/jpeg/.libs -ljpeg \
-L$MEDIALIBRARY_MODULE_DIR/$SQLITE_RELEASE/build-$ANDROID_ABI/.libs -lsqlite3 \
-L${NDK_LIB_DIR} -lc++abi ${NDK_LIB_UNWIND}"
diff --git a/medialibrary/jni/AndroidMediaLibrary.cpp b/medialibrary/jni/AndroidMediaLibrary.cpp
index d5df0304a..fc626164b 100644
--- a/medialibrary/jni/AndroidMediaLibrary.cpp
+++ b/medialibrary/jni/AndroidMediaLibrary.cpp
@@ -26,8 +26,9 @@ static void key_init(void)
pthread_key_create(&jni_env_key, jni_detach_thread);
}
-AndroidMediaLibrary::AndroidMediaLibrary(JavaVM *vm, fields *ref_fields, jobject thiz)
- : p_ml( NewMediaLibrary() ), p_fields ( ref_fields )
+AndroidMediaLibrary::AndroidMediaLibrary(JavaVM *vm, fields *ref_fields, jobject thiz, const char* dbPath, const char* mlFolder)
+ : p_ml( NewMediaLibrary( dbPath, mlFolder, false ) )
+ , p_fields ( ref_fields )
{
myVm = vm;
p_lister = std::make_shared<AndroidDeviceLister>();
@@ -47,10 +48,10 @@ AndroidMediaLibrary::~AndroidMediaLibrary()
}
medialibrary::InitializeResult
-AndroidMediaLibrary::initML(const std::string& dbPath, const std::string& thumbsPath)
+AndroidMediaLibrary::initML()
{
p_ml->registerDeviceLister(p_lister, "file://");
- return p_ml->initialize(dbPath, thumbsPath, this);
+ return p_ml->initialize(this);
}
void
diff --git a/medialibrary/jni/AndroidMediaLibrary.h b/medialibrary/jni/AndroidMediaLibrary.h
index 8fea6f373..d260bf194 100644
--- a/medialibrary/jni/AndroidMediaLibrary.h
+++ b/medialibrary/jni/AndroidMediaLibrary.h
@@ -27,10 +27,10 @@
class AndroidMediaLibrary : public medialibrary::IMediaLibraryCb
{
public:
- AndroidMediaLibrary(JavaVM *vm, fields *ref_fields, jobject thiz);
+ AndroidMediaLibrary(JavaVM *vm, fields *ref_fields, jobject thiz, const char* dbPath, const char* thumbsPath);
~AndroidMediaLibrary();
- medialibrary::InitializeResult initML(const std::string& dbPath, const std::string& thumbsPath);
+ medialibrary::InitializeResult initML();
void start();
bool isDeviceKnown(const std::string& uuid, const std::string& path, bool removable);
bool deleteRemovableDevices();
diff --git a/medialibrary/jni/medialibrary.cpp b/medialibrary/jni/medialibrary.cpp
index 43f0027d5..4520b6e92 100644
--- a/medialibrary/jni/medialibrary.cpp
+++ b/medialibrary/jni/medialibrary.cpp
@@ -30,11 +30,11 @@ MediaLibrary_setInstance(JNIEnv *env, jobject thiz, AndroidMediaLibrary *p_obj);
jint
init(JNIEnv* env, jobject thiz, jstring dbPath, jstring thumbsPath)
{
- AndroidMediaLibrary *aml = new AndroidMediaLibrary(myVm, &ml_fields, thiz);
- MediaLibrary_setInstance(env, thiz, aml);
const char *db_utfchars = env->GetStringUTFChars(dbPath, JNI_FALSE);
const char *thumbs_utfchars = env->GetStringUTFChars(thumbsPath, JNI_FALSE);
- medialibrary::InitializeResult initCode = aml->initML(db_utfchars, thumbs_utfchars);
+ AndroidMediaLibrary *aml = new AndroidMediaLibrary(myVm, &ml_fields, thiz, db_utfchars, thumbs_utfchars);
+ MediaLibrary_setInstance(env, thiz, aml);
+ medialibrary::InitializeResult initCode = aml->initML();
m_IsInitialized = initCode != medialibrary::InitializeResult::Failed;
env->ReleaseStringUTFChars(dbPath, db_utfchars);
env->ReleaseStringUTFChars(thumbsPath, thumbs_utfchars);
More information about the Android
mailing list