This commit is contained in:
Damontecres 2025-11-05 09:23:27 -05:00
parent 77c787b51f
commit 1ee834d42b
No known key found for this signature in database
37 changed files with 2322 additions and 18 deletions

22
scripts/mpv/scripts/dav1d.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash -e
. ../../include/path.sh
build=_build$ndk_suffix
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf $build
exit 0
else
exit 255
fi
unset CC CXX # meson wants these unset
meson setup $build --cross-file "$prefix_dir"/crossfile.txt \
-Denable_tests=false -Db_lto=true -Dstack_alignment=16
ninja -C $build -j$cores
DESTDIR="$prefix_dir" ninja -C $build install

48
scripts/mpv/scripts/ffmpeg.sh Executable file
View file

@ -0,0 +1,48 @@
#!/bin/bash -e
. ../../include/path.sh
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf _build$ndk_suffix
exit 0
else
exit 255
fi
mkdir -p _build$ndk_suffix
cd _build$ndk_suffix
cpu=armv7-a
[[ "$ndk_triple" == "aarch64"* ]] && cpu=armv8-a
[[ "$ndk_triple" == "x86_64"* ]] && cpu=generic
[[ "$ndk_triple" == "i686"* ]] && cpu="i686 --disable-asm"
cpuflags=
[[ "$ndk_triple" == "arm"* ]] && cpuflags="$cpuflags -mfpu=neon -mcpu=cortex-a8"
args=(
--target-os=android --enable-cross-compile
--cross-prefix=$ndk_triple- --cc=$CC --pkg-config=pkg-config --nm=llvm-nm
--arch=${ndk_triple%%-*} --cpu=$cpu
--extra-cflags="-I$prefix_dir/include $cpuflags" --extra-ldflags="-L$prefix_dir/lib"
--enable-{jni,mediacodec,mbedtls,libdav1d} --disable-vulkan
--disable-static --enable-shared --enable-{gpl,version3}
# disable unneeded parts
--disable-{stripping,doc,programs}
# to keep the build lean we disable some feature quite aggressively:
# - muxers, encoders: mpv-android does not have any way to use these
# - devices: no practical use on Android
--disable-{muxers,encoders,devices}
# useful to taking screenshots
--enable-encoder=mjpeg,png
# useful for the `dump-cache` command
--enable-muxer=mov,matroska,mpegts
)
../configure "${args[@]}"
make -j$cores
make DESTDIR="$prefix_dir" install

View file

@ -0,0 +1,21 @@
#!/bin/bash -e
. ../../include/path.sh
build=_build$ndk_suffix
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf $build
exit 0
else
exit 255
fi
unset CC CXX # meson wants these unset
meson setup $build --cross-file "$prefix_dir"/crossfile.txt
ninja -C $build -j$cores
DESTDIR="$prefix_dir" ninja -C $build install

22
scripts/mpv/scripts/fribidi.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash -e
. ../../include/path.sh
build=_build$ndk_suffix
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf $build
exit 0
else
exit 255
fi
unset CC CXX # meson wants these unset
meson setup $build --cross-file "$prefix_dir"/crossfile.txt \
-D{tests,docs}=false
ninja -C $build -j$cores
DESTDIR="$prefix_dir" ninja -C $build install

22
scripts/mpv/scripts/harfbuzz.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash -e
. ../../include/path.sh
build=_build$ndk_suffix
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf $build
exit 0
else
exit 255
fi
unset CC CXX # meson wants these unset
meson setup $build --cross-file "$prefix_dir"/crossfile.txt \
-Dtests=disabled -Ddocs=disabled
ninja -C $build -j$cores
DESTDIR="$prefix_dir" ninja -C $build install

25
scripts/mpv/scripts/libass.sh Executable file
View file

@ -0,0 +1,25 @@
#!/bin/bash -e
. ../../include/path.sh
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf _build$ndk_suffix
exit 0
else
exit 255
fi
[ -f configure ] || ./autogen.sh
mkdir -p _build$ndk_suffix
cd _build$ndk_suffix
../configure \
--host=$ndk_triple --with-pic \
--enable-static --disable-shared \
--enable-libunibreak --disable-require-system-font-provider
make -j$cores
make DESTDIR="$prefix_dir" install

View file

@ -0,0 +1,25 @@
#!/bin/bash -e
. ../../include/path.sh
build=_build$ndk_suffix
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf $build
exit 0
else
exit 255
fi
unset CC CXX
meson setup $build --cross-file "$prefix_dir"/crossfile.txt \
-Dvulkan=disabled -Ddemos=false
ninja -C $build -j$cores
DESTDIR="$prefix_dir" ninja -C $build install
# add missing library for static linking
# this isn't "-lstdc++" due to a meson bug: https://github.com/mesonbuild/meson/issues/11300
${SED:-sed} '/^Libs:/ s|$| -lc++|' "$prefix_dir/lib/pkgconfig/libplacebo.pc" -i

44
scripts/mpv/scripts/lua.sh Executable file
View file

@ -0,0 +1,44 @@
#!/bin/bash -e
. ../../include/path.sh
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
make clean
exit 0
else
exit 255
fi
# Building seperately from source tree is not supported, this means we are forced to always clean
$0 clean
mycflags=(
# ensures correct linking into libmpv.so
-fPIC
# bionic is missing decimal_point in localeconv [src/llex.c]
-Dgetlocaledecpoint\\\(\\\)=\\\(46\\\)
# force fallback as ftello/fseeko are not defined [src/liolib.c]
-Dlua_fseek
)
# LUA_T= and LUAC_T= to disable building lua & luac
# -Dgetlocaledecpoint()=('.') fixes bionic missing decimal_point in localeconv
make CC="$CC" AR="$AR rc" RANLIB="$RANLIB" \
MYCFLAGS="${mycflags[*]}" \
PLAT=linux LUA_T= LUAC_T= -j$cores
# TO_BIN=/dev/null disables installing lua & luac
make INSTALL=${INSTALL:-install} INSTALL_TOP="$prefix_dir" TO_BIN=/dev/null install
# make pc only generates a partial pkg-config file because ????
mkdir -p $prefix_dir/lib/pkgconfig
make pc >$prefix_dir/lib/pkgconfig/lua.pc
cat >>$prefix_dir/lib/pkgconfig/lua.pc <<'EOF'
Name: Lua
Description:
Version: ${version}
Libs: -L${libdir} -llua
Cflags: -I${includedir}
EOF

22
scripts/mpv/scripts/mbedtls.sh Executable file
View file

@ -0,0 +1,22 @@
#!/bin/bash -e
. ../../include/path.sh
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
make clean
exit 0
else
exit 255
fi
$0 clean # separate building not supported, always clean
if [[ "$ndk_triple" == "i686"* ]]; then
./scripts/config.py unset MBEDTLS_AESNI_C
else
./scripts/config.py set MBEDTLS_AESNI_C
fi
make -j$cores no_test
make DESTDIR="$prefix_dir" install

View file

@ -0,0 +1,77 @@
#!/bin/bash -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BUILD="$DIR/.."
MPV_ANDROID="$DIR/../.."
. $BUILD/include/path.sh
. $BUILD/include/depinfo.sh
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf $MPV_ANDROID/{app,.}/build $MPV_ANDROID/app/src/main/{libs,obj}
exit 0
else
exit 255
fi
[ -n "$ANDROID_SIGNING_KEY" ] && BUNDLE=1
nativeprefix () {
if [ -f $BUILD/prefix/$1/lib/libmpv.so ]; then
echo $BUILD/prefix/$1
else
echo >&2 "Warning: libmpv.so not found in native prefix for $1, support will be omitted"
fi
}
prefix32=$(nativeprefix "armv7l")
prefix64=$(nativeprefix "arm64")
prefix_x64=$(nativeprefix "x86_64")
prefix_x86=$(nativeprefix "x86")
if [[ -z "$prefix32" && -z "$prefix64" && -z "$prefix_x64" && -z "$prefix_x86" ]]; then
echo >&2 "Error: no mpv library detected."
exit 255
fi
PREFIX32=$prefix32 PREFIX64=$prefix64 PREFIX_X64=$prefix_x64 PREFIX_X86=$prefix_x86 \
ndk-build -C app/src/main -j$cores
targets=(assembleDebug)
if [ -z "$DONT_BUILD_RELEASE" ]; then
targets+=(assembleRelease)
[ -n "$BUNDLE" ] && targets+=(bundleRelease)
fi
./gradlew "${targets[@]}"
if [ -n "$ANDROID_SIGNING_KEY" ]; then
cd "${MPV_ANDROID}/app/build/outputs/apk"
apksigner=${ANDROID_HOME}/build-tools/${v_sdk_build_tools}/apksigner
for v in default api29; do
pushd $v
# sign the universal debug APK
"$apksigner" sign --ks "${ANDROID_SIGNING_KEY}" \
--in debug/app-$v-universal-debug.apk --out debug/app-$v-universal-debug-signed.apk
# but all of the release APKs
for apk in release/*-unsigned.apk; do
"$apksigner" sign --ks "${ANDROID_SIGNING_KEY}" \
--in $apk --out ${apk/-unsigned/-signed}
done
popd
done
# and the bundle
cd ../bundle
if [ -n "$BUNDLE" ]; then
if [ -z "$ANDROID_SIGNING_ALIAS" ]; then
echo >&2 "Error: ANDROID_SIGNING_ALIAS must be set to use jarsigner"
exit 1
fi
pushd defaultRelease
jarsigner -keystore "${ANDROID_SIGNING_KEY}" -signedjar \
app-default-release-signed.aab app-default-release.aab \
"${ANDROID_SIGNING_ALIAS}"
popd
fi
fi

30
scripts/mpv/scripts/mpv.sh Executable file
View file

@ -0,0 +1,30 @@
#!/bin/bash -e
. ../../include/path.sh
build=_build$ndk_suffix
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf $build
exit 0
else
exit 255
fi
unset CC CXX # meson wants these unset
meson setup $build --cross-file "$prefix_dir"/crossfile.txt \
--default-library shared \
-Diconv=disabled -Dlua=enabled \
-Dlibmpv=true -Dcplayer=false \
-Dmanpage-build=disabled
ninja -C $build -j$cores
if [ -f $build/libmpv.a ]; then
echo >&2 "Meson fucked up, forcing rebuild."
$0 clean
exec $0 build
fi
DESTDIR="$prefix_dir" ninja -C $build install

24
scripts/mpv/scripts/unibreak.sh Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash -e
. ../../include/path.sh
build=_build$ndk_suffix
if [ "$1" == "build" ]; then
true
elif [ "$1" == "clean" ]; then
rm -rf $build
exit 0
else
exit 255
fi
mkdir -p $build
cd $build
../configure \
--host=$ndk_triple --with-pic \
--enable-static --disable-shared
make -j$cores
make DESTDIR="$prefix_dir" install