[Android] buildsystem: generate the meson cross file for the medialibrary
Steve Lhomme
git at videolan.org
Tue Jun 24 10:32:39 UTC 2025
vlc-android | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu Jun 19 13:35:33 2025 +0200| [9c07335884a2c9937669df2c9df2f89f7fe462f5] | committer: Steve Lhomme
buildsystem: generate the meson cross file for the medialibrary
So we don't have to edit them whenever we change the NDK.
> https://code.videolan.org/videolan/vlc-android/commit/9c07335884a2c9937669df2c9df2f89f7fe462f5
---
buildsystem/compile-medialibrary.sh | 36 +++++++++++++++++++++-
buildsystem/crossfiles/arm64-v8a-ndk21.crossfile | 17 ----------
buildsystem/crossfiles/arm64-v8a-ndk27.crossfile | 17 ----------
buildsystem/crossfiles/armeabi-v7a-ndk21.crossfile | 17 ----------
buildsystem/crossfiles/armeabi-v7a-ndk27.crossfile | 17 ----------
buildsystem/crossfiles/x86-ndk21.crossfile | 14 ---------
buildsystem/crossfiles/x86-ndk27.crossfile | 14 ---------
buildsystem/crossfiles/x86_64-ndk21.crossfile | 16 ----------
buildsystem/crossfiles/x86_64-ndk27.crossfile | 16 ----------
9 files changed, 35 insertions(+), 129 deletions(-)
diff --git a/buildsystem/compile-medialibrary.sh b/buildsystem/compile-medialibrary.sh
index a5f50e5833..2fdf7b5a82 100755
--- a/buildsystem/compile-medialibrary.sh
+++ b/buildsystem/compile-medialibrary.sh
@@ -144,6 +144,40 @@ if [ "$RELEASE" = "1" ]; then
avlc_checkfail "Release builds must use tags"
fi
+if [ "$ANDROID_ABI" = "armeabi-v7a" ]; then
+ MESON_CPU="arm"
+elif [ "$ANDROID_ABI" = "arm64-v8a" ]; then
+ MESON_CPU="aarch64"
+elif [ "$ANDROID_ABI" = "x86" ]; then
+ MESON_CPU="i686"
+elif [ "$ANDROID_ABI" = "x86_64" ]; then
+ MESON_CPU="x86_64"
+else
+ diagnostic "Invalid arch specified: '$ANDROID_ABI'."
+ diagnostic "Try --help for more information"
+ exit 1
+fi
+
+echo "generate meson ${ANDROID_ABI}-${ANDROID_API} crossfile"
+exec 3>crossfile-${ANDROID_ABI}-android-${ANDROID_API}.meson || return $?
+
+printf '[binaries]\n' >&3
+printf 'c = '"'"'%s'"'"'\n' "${CLANG_PREFIX}${ANDROID_API}-clang" >&3
+printf 'cpp = '"'"'%s'"'"'\n' "${CLANG_PREFIX}${ANDROID_API}-clang++" >&3
+printf 'ar = '"'"'llvm-ar'"'"'\n' >&3
+printf 'strip = '"'"'llvm-strip'"'"'\n' >&3
+printf 'pkgconfig = '"'"'pkg-config'"'"'\n' >&3
+
+printf '\n[host_machine]\n' >&3
+printf 'system = '"'"'android'"'"'\n' >&3
+printf 'endian = '"'"'little'"'"'\n' >&3
+if [ "${MESON_CPU}" = "i686" ]; then
+ printf 'cpu_family = '"'"'%s'"'"'\n' "x86" >&3
+else
+ printf 'cpu_family = '"'"'%s'"'"'\n' "${MESON_CPU}" >&3
+fi
+printf 'cpu = '"'"'%s'"'"'\n' "${MESON_CPU}" >&3
+
if [ ! -d "build-android-$ANDROID_ABI/" ] || [ ! -f "build-android-$ANDROID_ABI/build.ninja" ]; then
PKG_CONFIG_LIBDIR="$LIBVLCJNI_SRC_DIR/vlc/build-android-${TARGET_TUPLE}/install/lib/pkgconfig" \
PKG_CONFIG_PATH="${MEDIALIBRARY_PREFIX}/lib/pkgconfig:$LIBVLCJNI_SRC_DIR/vlc/contrib/$TARGET_TUPLE/lib/pkgconfig/" \
@@ -152,7 +186,7 @@ if [ ! -d "build-android-$ANDROID_ABI/" ] || [ ! -f "build-android-$ANDROID_ABI/
-Doptimization=${MEDIALIBRARY_OPTIMIZATION} \
-Db_ndebug=${MEDIALIBRARY_NDEBUG} \
-Ddefault_library=static \
- --cross-file ${SRC_DIR}/buildsystem/crossfiles/${ANDROID_ABI}-ndk${REL}.crossfile \
+ --cross-file crossfile-${ANDROID_ABI}-android-${ANDROID_API}.meson \
-Dlibjpeg_prefix="$LIBVLCJNI_SRC_DIR/vlc/contrib/$TARGET_TUPLE/" \
-Dtests=disabled \
-Dforce_attachment_api=true \
diff --git a/buildsystem/crossfiles/arm64-v8a-ndk21.crossfile b/buildsystem/crossfiles/arm64-v8a-ndk21.crossfile
deleted file mode 100644
index eafacaa673..0000000000
--- a/buildsystem/crossfiles/arm64-v8a-ndk21.crossfile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Automatically generated by contrib makefile
-
-[binaries]
-c = 'aarch64-linux-android21-clang'
-cpp = 'aarch64-linux-android21-clang++'
-ar = 'aarch64-linux-android-ar'
-strip = 'aarch64-linux-android-strip'
-pkgconfig = 'pkg-config'
-
-[properties]
-needs_exe_wrapper = true
-
-[host_machine]
-system = 'android'
-cpu_family = 'aarch64'
-endian = 'little'
-cpu = 'aarch64'
diff --git a/buildsystem/crossfiles/arm64-v8a-ndk27.crossfile b/buildsystem/crossfiles/arm64-v8a-ndk27.crossfile
deleted file mode 100644
index 149c9166c5..0000000000
--- a/buildsystem/crossfiles/arm64-v8a-ndk27.crossfile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Automatically generated by contrib makefile
-
-[binaries]
-c = 'aarch64-linux-android21-clang'
-cpp = 'aarch64-linux-android21-clang++'
-ar = 'llvm-ar'
-strip = 'llvm-strip'
-pkgconfig = 'pkg-config'
-
-[properties]
-needs_exe_wrapper = true
-
-[host_machine]
-system = 'android'
-cpu_family = 'aarch64'
-endian = 'little'
-cpu = 'aarch64'
diff --git a/buildsystem/crossfiles/armeabi-v7a-ndk21.crossfile b/buildsystem/crossfiles/armeabi-v7a-ndk21.crossfile
deleted file mode 100644
index 910b42c545..0000000000
--- a/buildsystem/crossfiles/armeabi-v7a-ndk21.crossfile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Automatically generated by contrib makefile
-
-[binaries]
-c = 'armv7a-linux-androideabi17-clang'
-cpp = 'armv7a-linux-androideabi17-clang++'
-ar = 'arm-linux-androideabi-ar'
-strip = 'arm-linux-androideabi-strip'
-pkgconfig = 'pkg-config'
-
-[properties]
-needs_exe_wrapper = true
-
-[host_machine]
-system = 'android'
-cpu_family = 'arm'
-endian = 'little'
-cpu = 'arm'
diff --git a/buildsystem/crossfiles/armeabi-v7a-ndk27.crossfile b/buildsystem/crossfiles/armeabi-v7a-ndk27.crossfile
deleted file mode 100644
index 1de0018ee0..0000000000
--- a/buildsystem/crossfiles/armeabi-v7a-ndk27.crossfile
+++ /dev/null
@@ -1,17 +0,0 @@
-# Automatically generated by contrib makefile
-
-[binaries]
-c = 'armv7a-linux-androideabi21-clang'
-cpp = 'armv7a-linux-androideabi21-clang++'
-ar = 'llvm-ar'
-strip = 'llvm-strip'
-pkgconfig = 'pkg-config'
-
-[properties]
-needs_exe_wrapper = true
-
-[host_machine]
-system = 'android'
-cpu_family = 'arm'
-endian = 'little'
-cpu = 'arm'
diff --git a/buildsystem/crossfiles/x86-ndk21.crossfile b/buildsystem/crossfiles/x86-ndk21.crossfile
deleted file mode 100644
index 53c9a28dca..0000000000
--- a/buildsystem/crossfiles/x86-ndk21.crossfile
+++ /dev/null
@@ -1,14 +0,0 @@
-# Automatically generated by contrib makefile
-
-[binaries]
-c = 'i686-linux-android17-clang'
-cpp = 'i686-linux-android17-clang++'
-ar = 'i686-linux-android-ar'
-strip = 'i686-linux-android-strip'
-pkgconfig = 'pkg-config'
-
-[host_machine]
-system = 'android'
-cpu_family = 'x86'
-endian = 'little'
-cpu = 'i686'
diff --git a/buildsystem/crossfiles/x86-ndk27.crossfile b/buildsystem/crossfiles/x86-ndk27.crossfile
deleted file mode 100644
index 0b2cbfcfe1..0000000000
--- a/buildsystem/crossfiles/x86-ndk27.crossfile
+++ /dev/null
@@ -1,14 +0,0 @@
-# Automatically generated by contrib makefile
-
-[binaries]
-c = 'i686-linux-android21-clang'
-cpp = 'i686-linux-android21-clang++'
-ar = 'llvm-ar'
-strip = 'llvm-strip'
-pkgconfig = 'pkg-config'
-
-[host_machine]
-system = 'android'
-cpu_family = 'x86'
-endian = 'little'
-cpu = 'i686'
diff --git a/buildsystem/crossfiles/x86_64-ndk21.crossfile b/buildsystem/crossfiles/x86_64-ndk21.crossfile
deleted file mode 100644
index 5c958c90d4..0000000000
--- a/buildsystem/crossfiles/x86_64-ndk21.crossfile
+++ /dev/null
@@ -1,16 +0,0 @@
-# Automatically generated by contrib makefile
-
-[binaries]
-c = 'x86_64-linux-android21-clang'
-cpp = 'x86_64-linux-android21-clang++'
-ar = 'x86_64-linux-android-ar'
-strip = 'x86_64-linux-android-strip'
-pkgconfig = 'pkg-config'
-
-[properties]
-
-[host_machine]
-system = 'android'
-cpu_family = 'x86_64'
-endian = 'little'
-cpu = 'x86_64'
diff --git a/buildsystem/crossfiles/x86_64-ndk27.crossfile b/buildsystem/crossfiles/x86_64-ndk27.crossfile
deleted file mode 100644
index 24cbc037a6..0000000000
--- a/buildsystem/crossfiles/x86_64-ndk27.crossfile
+++ /dev/null
@@ -1,16 +0,0 @@
-# Automatically generated by contrib makefile
-
-[binaries]
-c = 'x86_64-linux-android21-clang'
-cpp = 'x86_64-linux-android21-clang++'
-ar = 'llvm-ar'
-strip = 'llvm-strip'
-pkgconfig = 'pkg-config'
-
-[properties]
-
-[host_machine]
-system = 'android'
-cpu_family = 'x86_64'
-endian = 'little'
-cpu = 'x86_64'
More information about the Android
mailing list