diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d0d0c0..9bed8d1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -72,7 +72,7 @@ jobs: id: native-prefix-cache uses: actions/cache/restore@v4 with: - path: gh-cache/ + path: buildscripts/prefix/ key: native-prefix-${{ runner.os }}-${{ env.CACHE_IDENTIFIER }} restore-keys: | native-prefix-${{ runner.os }}- @@ -95,9 +95,11 @@ jobs: automake \ build-essential \ ccache \ + dos2unix \ gcc g++ \ cmake \ gettext \ + glslang-tools \ gperf \ libtool \ nasm \ @@ -105,6 +107,7 @@ jobs: pkg-config \ python3 \ python3-pip \ + spirv-tools \ unzip \ wget @@ -118,6 +121,15 @@ jobs: set -euxo pipefail cd buildscripts ./download.sh + + echo "Downloading latest Vulkan-Headers..." + if [ ! -d "deps/Vulkan-Headers" ]; then + git clone https://github.com/KhronosGroup/Vulkan-Headers.git deps/Vulkan-Headers + fi + + echo "Normalizing line endings for all scripts..." + cd .. + find . -type f \( -name '*.sh' -o -name 'gradlew' \) -exec dos2unix {} + - name: Save Android SDK cache if: steps.android-sdk-cache.outputs.cache-hit != 'true' @@ -130,7 +142,7 @@ jobs: if: steps.native-prefix-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: - path: gh-cache/ + path: buildscripts/prefix/ key: native-prefix-${{ runner.os }}-${{ env.CACHE_IDENTIFIER }} - name: Show ccache stats before build @@ -151,7 +163,14 @@ jobs: [ "$ENABLE_ARM_V9A" = "true" ] && arches+=(arm64-v9a) [ "$ENABLE_X86_ARCH" = "true" ] && arches+=(x86 x86_64) for arch in "${arches[@]}"; do + echo "Injecting Vulkan headers into prefix/$arch/include..." + mkdir -p "prefix/$arch/include" + cp -r deps/Vulkan-Headers/include/vulkan "prefix/$arch/include/" + cp -r deps/Vulkan-Headers/include/vk_video "prefix/$arch/include/" ./buildall.sh --arch "$arch" mpv + if [ "$arch" != "arm64-v9a" ]; then + ./buildall.sh --arch "$arch" python + fi done ./buildall.sh --clean mpv-android diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dc4e608..dde5761 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -123,7 +123,7 @@ jobs: id: native-prefix-cache uses: actions/cache/restore@v4 with: - path: gh-cache/ + path: buildscripts/prefix/ key: native-prefix-${{ runner.os }}-${{ env.CACHE_IDENTIFIER }} restore-keys: | native-prefix-${{ runner.os }}- @@ -147,8 +147,10 @@ jobs: build-essential \ ccache \ cmake \ + dos2unix \ gcc g++ \ gettext \ + glslang-tools \ gperf \ libtool \ nasm \ @@ -156,6 +158,7 @@ jobs: pkg-config \ python3 \ python3-pip \ + spirv-tools \ unzip \ wget @@ -169,6 +172,15 @@ jobs: set -euxo pipefail cd buildscripts ./download.sh + + echo "Downloading latest Vulkan-Headers..." + if [ ! -d "deps/Vulkan-Headers" ]; then + git clone https://github.com/KhronosGroup/Vulkan-Headers.git deps/Vulkan-Headers + fi + + echo "Normalizing line endings for all scripts..." + cd .. + find . -type f \( -name '*.sh' -o -name 'gradlew' \) -exec dos2unix {} + - name: Save Android SDK cache if: steps.android-sdk-cache.outputs.cache-hit != 'true' @@ -181,7 +193,7 @@ jobs: if: steps.native-prefix-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: - path: gh-cache/ + path: buildscripts/prefix/ key: native-prefix-${{ runner.os }}-${{ env.CACHE_IDENTIFIER }} - name: Show ccache stats before build @@ -202,7 +214,14 @@ jobs: [ "$ENABLE_ARM_V9A" = "true" ] && arches+=(arm64-v9a) [ "$ENABLE_X86_ARCH" = "true" ] && arches+=(x86 x86_64) for arch in "${arches[@]}"; do + echo "Injecting Vulkan headers into prefix/$arch/include..." + mkdir -p "prefix/$arch/include" + cp -r deps/Vulkan-Headers/include/vulkan "prefix/$arch/include/" + cp -r deps/Vulkan-Headers/include/vk_video "prefix/$arch/include/" ./buildall.sh --arch "$arch" mpv + if [ "$arch" != "arm64-v9a" ]; then + ./buildall.sh --arch "$arch" python + fi done ./buildall.sh --clean mpv-android diff --git a/app/build.gradle b/app/build.gradle index 9c2f1fb..96f9dc5 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,6 +22,12 @@ android { buildConfig = true } + sourceSets { + main { + jniLibs.srcDirs = ['src/main/libs'] + } + } + // https://youtrack.jetbrains.com/issue/KT-55947 compileOptions { sourceCompatibility JavaVersion.VERSION_17 diff --git a/app/src/main/java/is/xyz/mpv/AbiDetector.kt b/app/src/main/java/is/xyz/mpv/AbiDetector.kt index 9de1196..7c9e1ee 100644 --- a/app/src/main/java/is/xyz/mpv/AbiDetector.kt +++ b/app/src/main/java/is/xyz/mpv/AbiDetector.kt @@ -155,6 +155,14 @@ object AbiDetector { extractV9aLibraries(context, cacheDir) } + // Ensure the standard C++ library is loaded into memory first + // This prevents strict Android linker namespace issues when loading libplayer.so from an absolute path + try { + System.loadLibrary("c++_shared") + } catch (e: Throwable) { + Log.w(TAG, "c++_shared not found via loadLibrary, continuing anyway") + } + // Load in dependency order val loadOrder = arrayOf( "libavutil.so", @@ -181,7 +189,7 @@ object AbiDetector { } } true - } catch (e: Exception) { + } catch (e: Throwable) { Log.e(TAG, "Failed to load v9a libraries", e) false } @@ -196,10 +204,10 @@ object AbiDetector { val versionFile = File(cacheDir, "version.txt") if (!versionFile.exists()) return false - // Check version matches current app version + // Check version matches current app install time val cachedVersion = versionFile.readText().trim() val currentVersion = try { - context.packageManager.getPackageInfo(context.packageName, 0).versionName + context.packageManager.getPackageInfo(context.packageName, 0).lastUpdateTime.toString() } catch (e: Exception) { "" } return cachedVersion == currentVersion @@ -230,15 +238,16 @@ object AbiDetector { input.copyTo(output, bufferSize = 65536) } } - // Libraries must be executable + // Libraries must be executable and read-only for Android 14+ DCL rules outFile.setExecutable(true, false) outFile.setReadable(true, false) + outFile.setWritable(false, false) Log.d(TAG, "Extracted: $asset (${outFile.length()} bytes)") } // Write version marker val currentVersion = try { - context.packageManager.getPackageInfo(context.packageName, 0).versionName ?: "unknown" + context.packageManager.getPackageInfo(context.packageName, 0).lastUpdateTime.toString() } catch (e: Exception) { "unknown" } File(cacheDir, "version.txt").writeText(currentVersion) @@ -266,13 +275,18 @@ object AbiDetector { val features = featuresLine.substringAfter(":").trim().split("\\s+".toRegex()) val hasSve2 = features.any { it.equals("sve2", ignoreCase = true) } val hasI8mm = features.any { it.equals("i8mm", ignoreCase = true) } + val hasSve = features.any { it.equals("sve", ignoreCase = true) } + Log.d(TAG, "cpuinfo features: sve=$hasSve, sve2=$hasSve2, i8mm=$hasI8mm") if (hasSve2 || hasI8mm) { - Log.d(TAG, "cpuinfo features (v9a relevant): sve2=$hasSve2, i8mm=$hasI8mm") Log.d(TAG, "Full features: ${features.joinToString(" ")}") } - hasSve2 || hasI8mm + // CRITICAL: We MUST require SVE2 specifically. + // i8mm alone is an ARMv8.6 extension and does NOT guarantee SVE2 hardware. + // Our v9a libraries are compiled with -march=armv9-a+sve2, so loading them + // on a device without SVE2 silicon causes SIGILL crash. + hasSve2 } catch (e: Exception) { Log.w(TAG, "Failed to read /proc/cpuinfo", e) false diff --git a/app/src/main/java/is/xyz/mpv/BaseMPVView.kt b/app/src/main/java/is/xyz/mpv/BaseMPVView.kt index 5eeb8be..7d7e088 100644 --- a/app/src/main/java/is/xyz/mpv/BaseMPVView.kt +++ b/app/src/main/java/is/xyz/mpv/BaseMPVView.kt @@ -36,6 +36,14 @@ abstract class BaseMPVView(context: Context, attrs: AttributeSet) : SurfaceView( } catch (e: Exception) { Log.e(TAG, "Failed to set SSL_CERT_FILE", e) } + + // Adreno-optimized Vulkan defaults for vo=gpu-next + MPVLib.setOptionString("gpu-api", "vulkan") + MPVLib.setOptionString("vulkan-async-compute", "no") + MPVLib.setOptionString("vulkan-async-transfer", "no") + MPVLib.setOptionString("vulkan-queue-count", "1") + MPVLib.setOptionString("vd-lavc-film-grain", "gpu") + initOptions() MPVLib.init() @@ -74,7 +82,7 @@ abstract class BaseMPVView(context: Context, attrs: AttributeSet) : SurfaceView( this.filePath = filePath } - private var voInUse: String = "gpu" + private var voInUse: String = "gpu-next" /** * Sets the VO to use. diff --git a/app/src/main/java/is/xyz/mpv/MPVLib.kt b/app/src/main/java/is/xyz/mpv/MPVLib.kt index a55753c..58e3204 100644 --- a/app/src/main/java/is/xyz/mpv/MPVLib.kt +++ b/app/src/main/java/is/xyz/mpv/MPVLib.kt @@ -39,19 +39,10 @@ object MPVLib { Log.i(TAG, "Native libraries loaded — ABI: ${AbiDetector.detectOptimalAbi().displayName}") } - // Fallback for apps that don't call loadLibraries() with context - init { - try { - // Try standard loading — this works for v8a and when v9a isn't needed - val libs = arrayOf("mpv", "player") - for (lib in libs) { - System.loadLibrary(lib) - } - } catch (e: UnsatisfiedLinkError) { - // Libraries will be loaded by loadLibraries(context) instead - Log.d(TAG, "Deferred library loading — call MPVLib.loadLibraries(context) for v9a support") - } - } + // Note: Eager initialization via init {} was removed because it prematurely + // loads the v8a fallback libraries into memory. If v8a libraries are loaded first, + // Android's dlopen will ignore the absolute path v9a loading later and just reuse the v8a handle. + // Apps MUST call MPVLib.loadLibraries(context) during App.onCreate(). external fun create(appctx: Context) external fun init() diff --git a/app/src/main/jni/abi_detect.cpp b/app/src/main/jni/abi_detect.cpp index 3ad4567..5f2fa63 100644 --- a/app/src/main/jni/abi_detect.cpp +++ b/app/src/main/jni/abi_detect.cpp @@ -26,16 +26,17 @@ extern "C" { * This is the most reliable method on Linux/Android — directly queries the kernel * for CPU feature flags without parsing /proc/cpuinfo. * - * Returns true if the CPU supports SVE2 or I8MM (both are mandatory ARMv9 features). - * Compatible SoCs: Cortex-X3+, Cortex-A720+, Snapdragon 8 Gen 2+, Dimensity 9200+, Exynos 2400+ + * Returns true ONLY if the CPU supports SVE2. + * CRITICAL: i8mm alone is NOT sufficient — it's an ARMv8.6 extension that many + * non-SVE2 chips have. Our v9a libraries are compiled with -march=armv9-a+sve2, + * so they contain actual SVE2 instructions that SIGILL on non-SVE2 hardware. */ JNIEXPORT jboolean JNICALL Java_is_xyz_mpv_AbiDetector_nativeCheckSve2Support(JNIEnv*, jclass) { #ifdef __aarch64__ unsigned long hwcap2 = getauxval(AT_HWCAP2); - // SVE2 is the defining mandatory feature of ARMv9-A - // I8MM (Int8 Matrix Multiply) is also mandatory in ARMv9 - return (jboolean)((hwcap2 & HWCAP2_SVE2) || (hwcap2 & HWCAP2_I8MM)); + // Strictly require SVE2 — this is the only feature our v9a libs actually use + return (jboolean)((hwcap2 & HWCAP2_SVE2) != 0); #else return JNI_FALSE; #endif diff --git a/buildscripts/buildall.sh b/buildscripts/buildall.sh index c3c8ea0..5ee8e05 100755 --- a/buildscripts/buildall.sh +++ b/buildscripts/buildall.sh @@ -67,19 +67,25 @@ loadarch () { fi # Base linker flags — 16KB page size support for modern Android - export LDFLAGS="-Wl,-O1,--icf=safe -Wl,-z,max-page-size=16384" + export LDFLAGS="-Wl,-O1,--icf=safe -Wl,-z,max-page-size=16384 -Wl,--gc-sections" # === Architecture-specific optimization flags === if [ "$ARM_V9A" -eq 1 ]; then - # ARM v9a: SVE2 + enhanced NEON + crypto + I8MM - # Tuned for Cortex-X3/X4 (Snapdragon 8 Gen 2/3, Dimensity 9200/9300, Exynos 2400) - export CFLAGS="-march=armv9-a+sve2+sve2-bitperm+sme+sha3+sm4+lse+dotprod -mtune=cortex-x3 -O3 -flto=thin -ffast-math -fno-math-errno -fomit-frame-pointer" + # ARM v9a: SVE2 only. Devices where kernel exposes SVE2 (e.g. Pixel 9, Galaxy S24 Ultra). + # STRICTLY AVOID: +sve2-bitperm, +sha3, +sm4, +sme — these are OPTIONAL extensions + # that most SoCs (including Snapdragon 8 Gen 2/3, Dimensity 9200/9400) do NOT implement. + # Many OEMs also disable SVE2 entirely in the kernel (e.g. iQOO, Vivo, Xiaomi). + # Our AbiDetector.kt only loads these libs when /proc/cpuinfo actually lists "sve2". + export CFLAGS="-march=armv9-a+sve2+lse+dotprod -mtune=cortex-x3 -O2 -flto=thin -ffast-math -fno-math-errno -fomit-frame-pointer -fno-plt -fno-semantic-interposition -ffunction-sections -fdata-sections" export CXXFLAGS="$CFLAGS" export LDFLAGS="$LDFLAGS -flto=thin -fuse-ld=lld" elif [[ "$ndk_triple" == "aarch64"* ]]; then - # ARM v8a base: NEON + CRC + crypto, tuned for Cortex-A76 class cores - # This gives 8-10% boost over the default NDK flags - export CFLAGS="-march=armv8-a+crypto+crc -mtune=cortex-a76 -O3 -flto=thin -ffast-math -fno-math-errno -fomit-frame-pointer" + # ARM v8a base: NEON + CRC. This is the UNIVERSAL path for ALL arm64 Android devices. + # Must support everything from Snapdragon 835 (2017) to Snapdragon 8s Gen 3 (2024). + # NO +crypto/+sha3/+dotprod/+lse — old budget SoCs (Helio P22, Exynos 7885) lack them. + # -mtune=cortex-a75 targets the median 2024 device profile (better scheduling than a76 + # while generating compatible code for all armv8-a chips). + export CFLAGS="-march=armv8-a+simd+crc -mtune=cortex-a75 -O2 -flto=thin -ffast-math -fno-math-errno -fomit-frame-pointer -fno-plt -fno-semantic-interposition -ffunction-sections -fdata-sections" export CXXFLAGS="$CFLAGS" export LDFLAGS="$LDFLAGS -flto=thin -fuse-ld=lld" fi @@ -88,11 +94,29 @@ loadarch () { export RANLIB=llvm-ranlib } +to_meson_array () { + local flags=($1) + local result="" + for flag in "${flags[@]}"; do + if [ -n "$result" ]; then + result="$result, '$flag'" + else + result="'$flag'" + fi + done + echo "[$result]" +} + setup_prefix () { - if [ ! -d "$prefix_dir" ]; then - mkdir -p "$prefix_dir" - # enforce flat structure (/usr/local -> /) + mkdir -p "$prefix_dir" + # enforce flat structure (/usr/local -> /) + # Always re-create: cache restore may replace symlinks with real directories + if [ ! -L "$prefix_dir/usr" ]; then + rm -rf "$prefix_dir/usr" ln -s . "$prefix_dir/usr" + fi + if [ ! -L "$prefix_dir/local" ]; then + rm -rf "$prefix_dir/local" ln -s . "$prefix_dir/local" fi @@ -110,14 +134,24 @@ setup_prefix () { cpu_tune="cortex-x3" fi + # Convert CFLAGS and LDFLAGS into Meson-compatible array format + local c_args_meson=$(to_meson_array "$CFLAGS") + local cpp_args_meson=$(to_meson_array "$CXXFLAGS") + local link_args_meson=$(to_meson_array "$LDFLAGS") + # meson wants to be spoonfed this file, so create it ahead of time # also define: release build, static libs and no source downloads at runtime(!!!) cat >"$prefix_dir/crossfile.tmp" <"$prefix_dir"/lib/pkgconfig/shaderc_combined.pc <<"END" Name: shaderc_combined Description: Version: 2022.3-unknown -Libs: -L/usr/local/lib -lshaderc_combined +Libs: -L/usr/local/lib -lshaderc_combined -lc++ -lm +Cflags: -I/usr/local/include +END + +cat >"$prefix_dir"/lib/pkgconfig/shaderc.pc <<"END" +Name: shaderc +Description: +Version: 2022.3-unknown +Libs: -L/usr/local/lib -lshaderc_combined -lc++ -lm Cflags: -I/usr/local/include END -if [ -z "$(pkg-config --cflags shaderc_combined)" ]; then +if [ -z "$(pkg-config --cflags shaderc_combined)" ] || [ -z "$(pkg-config --cflags shaderc)" ]; then echo >&2 "shaderc pkg-config sanity check failed" exit 1 fi diff --git a/wsl-compile.sh b/wsl-compile.sh new file mode 100644 index 0000000..372c179 --- /dev/null +++ b/wsl-compile.sh @@ -0,0 +1,59 @@ +#!/bin/bash +set -e + +# WSL Compilation Script for MPV Android AAR +# This script compiles the optimized Vulkan/Adreno AAR library from WSL Ubuntu. + +echo "==========================================================" +echo " Vulkan-Optimized MPV Android AAR Compiler for WSL" +echo "==========================================================" + +# 1. Sanity Checks +if ! grep -qis "microsoft" /proc/version && ! grep -qis "wsl" /proc/version; then + echo "Warning: This script is designed to run inside WSL (Windows Subsystem for Linux)." + echo "It seems you are running this elsewhere. Let's proceed, but make sure you are on Ubuntu/Debian." + read -p "Press Enter to continue..." +fi + +echo "Step 1: Installing Ubuntu dependencies (requires sudo)..." +sudo apt-get update +sudo apt-get install -y \ + autoconf \ + pkg-config \ + libtool \ + ninja-build \ + unzip \ + wget \ + meson \ + python3 \ + nasm \ + git \ + openjdk-17-jdk \ + clang \ + build-essential + +# 2. Check Java Version +if ! javac -version &>/dev/null; then + echo "Error: JDK 17 is required but could not be found. Please ensure openjdk-17-jdk is installed and configured." + exit 1 +fi + +echo "Step 2: Checking out/downloading Android SDK and NDK dependencies..." +cd buildscripts +./download.sh + +echo "Step 3: Compiling dependencies for standard arm64-v8a..." +./buildall.sh --arch arm64 + +echo "Step 4: Compiling dependencies for optimized arm64-v9a (Snapdragon 8s Gen 3 / Adreno 735)..." +./buildall.sh --arch arm64-v9a + +echo "Step 5: Building final JNI wrappers and packaging AAR..." +./buildall.sh mpv-android + +echo "==========================================================" +echo " Build Completed Successfully!" +echo "==========================================================" +echo "Your optimized AAR file is located at:" +ls -lh ../app/build/outputs/aar/*.aar +echo "==========================================================" diff --git a/wsl-source.tar b/wsl-source.tar new file mode 100644 index 0000000..ae8bc8f Binary files /dev/null and b/wsl-source.tar differ diff --git a/wsl_build.sh b/wsl_build.sh new file mode 100644 index 0000000..a6492f3 --- /dev/null +++ b/wsl_build.sh @@ -0,0 +1,54 @@ +#!/bin/bash +set -e + +# Fast rsync to avoid 9p filesystem overhead for excluded heavy folders +echo "Step 1: Synchronizing source code to WSL home directory..." +mkdir -p /home/sagnik/mpvlibAndroid +rsync -a --delete \ + --exclude='.git' \ + --exclude='build' \ + --exclude='.gradle' \ + --exclude='app/build' \ + --exclude='buildscripts/prefix' \ + --exclude='buildscripts/deps' \ + --exclude='buildscripts/sdk' \ + --exclude='buildscripts/_build*' \ + --exclude='wsl-source.tar' \ + /mnt/c/Users/sagni/StudioProjects/mpvlibAndroid/ /home/sagnik/mpvlibAndroid/ + +cd /home/sagnik/mpvlibAndroid + +echo "Step 2: Cleaning any leftover build files just in case..." +rm -rf buildscripts/prefix buildscripts/deps buildscripts/sdk buildscripts/_build* app/build + +echo "Step 3: Downloading SDK, NDK, and dependencies..." +cd buildscripts +echo 2007 | sudo -S ./download.sh +echo 2007 | sudo -S chown -R $USER:$USER /home/sagnik/mpvlibAndroid + +echo "Downloading latest Vulkan-Headers..." +if [ ! -d "deps/Vulkan-Headers" ]; then + git clone https://github.com/KhronosGroup/Vulkan-Headers.git deps/Vulkan-Headers +fi + +echo "Step 4: Building arm64-v8a (base) - CLEAN BUILD..." +mkdir -p prefix/arm64/include +cp -r deps/Vulkan-Headers/include/vulkan prefix/arm64/include/ +cp -r deps/Vulkan-Headers/include/vk_video prefix/arm64/include/ +./buildall.sh --clean --arch arm64 mpv + +echo "Step 5: Building arm64-v9a (SVE2 optimized) - CLEAN BUILD..." +mkdir -p prefix/arm64-v9a/include +cp -r deps/Vulkan-Headers/include/vulkan prefix/arm64-v9a/include/ +cp -r deps/Vulkan-Headers/include/vk_video prefix/arm64-v9a/include/ +./buildall.sh --clean --arch arm64-v9a mpv + +echo "Step 6: Packaging final mpv-android AAR..." +./buildall.sh --clean mpv-android +cd .. + +echo "Step 7: Copying generated AARs back to Windows host..." +mkdir -p /mnt/c/Users/sagni/StudioProjects/mpvlibAndroid/app/build/outputs/aar/ +cp -r app/build/outputs/aar/* /mnt/c/Users/sagni/StudioProjects/mpvlibAndroid/app/build/outputs/aar/ + +echo "ALL DONE!" diff --git a/wsl_continue.sh b/wsl_continue.sh new file mode 100644 index 0000000..c5f02a5 --- /dev/null +++ b/wsl_continue.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +echo "Fixing permissions for downloaded deps..." +echo 2007 | sudo -S chown -R $USER:$USER /home/sagnik/mpvlibAndroid + +cd /home/sagnik/mpvlibAndroid/buildscripts + +echo "Step 4: Building arm64-v8a (base) - CLEAN BUILD..." +./buildall.sh --clean --arch arm64 + +echo "Step 5: Building arm64-v9a (SVE2 optimized) - CLEAN BUILD..." +./buildall.sh --clean --arch arm64-v9a + +echo "Step 6: Packaging final mpv-android AAR..." +./buildall.sh mpv-android +cd .. + +echo "Step 7: Copying generated AARs back to Windows host..." +mkdir -p /mnt/c/Users/sagni/StudioProjects/mpvlibAndroid/app/build/outputs/aar/ +cp -r app/build/outputs/aar/* /mnt/c/Users/sagni/StudioProjects/mpvlibAndroid/app/build/outputs/aar/ + +echo "ALL DONE!" diff --git a/wsl_final.sh b/wsl_final.sh new file mode 100644 index 0000000..492f625 --- /dev/null +++ b/wsl_final.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +cd /home/sagnik/mpvlibAndroid/buildscripts + +echo "Step 5: Building arm64-v9a (SVE2 optimized) - CLEAN BUILD..." +./buildall.sh --clean --arch arm64-v9a + +echo "Step 6: Packaging final mpv-android AAR..." +./buildall.sh mpv-android +cd .. + +echo "Step 7: Copying generated AARs back to Windows host..." +mkdir -p /mnt/c/Users/sagni/StudioProjects/mpvlibAndroid/app/build/outputs/aar/ +cp -r app/build/outputs/aar/* /mnt/c/Users/sagni/StudioProjects/mpvlibAndroid/app/build/outputs/aar/ + +echo "ALL DONE!" diff --git a/wsl_vulkan_headers.sh b/wsl_vulkan_headers.sh new file mode 100644 index 0000000..4301a58 --- /dev/null +++ b/wsl_vulkan_headers.sh @@ -0,0 +1,23 @@ +#!/bin/bash +set -e + +echo "Downloading latest Vulkan-Headers..." +cd /home/sagnik/mpvlibAndroid/buildscripts/deps +if [ ! -d "Vulkan-Headers" ]; then + git clone https://github.com/KhronosGroup/Vulkan-Headers.git +else + cd Vulkan-Headers + git pull + cd .. +fi + +echo "Installing Vulkan headers to prefix directories..." +for arch in arm64 arm64-v9a; do + mkdir -p /home/sagnik/mpvlibAndroid/buildscripts/prefix/$arch/include/ + cp -r Vulkan-Headers/include/vulkan /home/sagnik/mpvlibAndroid/buildscripts/prefix/$arch/include/ + cp -r Vulkan-Headers/include/vk_video /home/sagnik/mpvlibAndroid/buildscripts/prefix/$arch/include/ +done + +echo "Headers installed successfully! Resuming build..." +cd /home/sagnik/mpvlibAndroid +bash wsl_continue.sh