Files
Velix-MPV-Core/scripts/build-mpv-ohos.sh
T

59 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
set -eu
. "$(dirname -- "$0")/setup-ohos-env.sh"
FFMPEG_PREFIX=${FFMPEG_PREFIX:-$PREFIX}
MPV_PREFIX=${MPV_PREFIX:-$PREFIX}
BUILD=${MPV_BUILD_ROOT:-$OHOS_BUILD_ROOT/build/mpv}
LOG=$OHOS_BUILD_ROOT/logs/mpv.log
mkdir -p "$OHOS_BUILD_ROOT/logs"
if test "$FFMPEG_PREFIX" = "$PREFIX"; then
test -f "$PREFIX/lib/libavcodec.a" || "$PROJECT_ROOT/scripts/build-ffmpeg-ohos.sh"
else
for library in libavcodec libavfilter libavformat libavutil libswresample libswscale; do
test -f "$FFMPEG_PREFIX/lib/$library.a" || {
printf 'Missing FFmpeg-Harmony archive: %s/lib/%s.a\n' "$FFMPEG_PREFIX" "$library" >&2
exit 1
}
done
test -f "$FFMPEG_PREFIX/include/libavcodec/avcodec.h" || {
printf 'Missing FFmpeg-Harmony headers: %s/include\n' "$FFMPEG_PREFIX" >&2
exit 1
}
PKG_CONFIG_EXTRA_LIBDIR="$FFMPEG_PREFIX/lib/pkgconfig:$FFMPEG_PREFIX/share/pkgconfig"
export PKG_CONFIG_EXTRA_LIBDIR
fi
test -f "$PREFIX/lib/libass.a" || "$PROJECT_ROOT/scripts/build-font-stack-ohos.sh"
test -f "$PREFIX/lib/libplacebo.a" || "$PROJECT_ROOT/scripts/build-libplacebo-ohos.sh"
if test -f "$BUILD/meson-private/coredata.dat"; then
setup_mode=--wipe
else
setup_mode=
fi
if ! meson setup "$BUILD" "$PROJECT_ROOT" $setup_mode \
--cross-file "$CROSS_FILE" --prefix "$MPV_PREFIX" --buildtype release \
-Ddefault_library=shared -Dauto_features=disabled \
-Dcplayer=false -Dlibmpv=true -Dtests=false -Dfuzzers=false \
-Dgpl=true -Dbuild-date=false -Dplain-gl=enabled -Dgl=enabled \
-Dzlib=enabled -Dvector=enabled -Dlua=disabled -Dharmony-audio=enabled \
-Dharmony-ohcodec=enabled -Dharmony-ohcodec-gl=disabled > "$LOG" 2>&1; then
tail -n 180 "$LOG" >&2
exit 1
fi
if ! meson compile -C "$BUILD" >> "$LOG" 2>&1; then
tail -n 220 "$LOG" >&2
exit 1
fi
meson install -C "$BUILD" >> "$LOG" 2>&1
LIBMPV=$BUILD/libmpv.so
test -f "$LIBMPV" || LIBMPV=$PREFIX/lib/libmpv.so
"$PROJECT_ROOT/scripts/verify-ohos-binary.sh" "$LIBMPV"
"$PROJECT_ROOT/scripts/verify-libmpv-symbols.sh" "$LIBMPV"
printf 'libmpv=%s\n' "$LIBMPV"