chiark / gitweb /
pass: Add comment on why we depend on coreutils
[termux-packages] / packages / mpv / build.sh
1 TERMUX_PKG_HOMEPAGE=https://mpv.io/
2 TERMUX_PKG_DESCRIPTION="Command-line media player"
3 TERMUX_PKG_VERSION=0.26.0
4 TERMUX_PKG_SHA256=daf3ef358d5f260f2269f7caabce27f446c291457ec330077152127133b71b46
5 TERMUX_PKG_SRCURL=https://github.com/mpv-player/mpv/archive/v${TERMUX_PKG_VERSION}.tar.gz
6 TERMUX_PKG_FOLDERNAME=mpv-${TERMUX_PKG_VERSION}
7 TERMUX_PKG_DEPENDS="ffmpeg, openal-soft, libandroid-glob"
8 TERMUX_PKG_RM_AFTER_INSTALL="share/icons share/applications"
9
10 termux_step_pre_configure() {
11         LDFLAGS+=" -landroid-glob"
12 }
13
14 termux_step_make_install () {
15         cd $TERMUX_PKG_SRCDIR
16
17         ./bootstrap.py
18
19         ./waf configure \
20                 --prefix=$TERMUX_PREFIX \
21                 --disable-gl \
22                 --disable-jpeg \
23                 --disable-lcms2 \
24                 --disable-libass \
25                 --disable-lua \
26                 --disable-pulse \
27                 --enable-openal \
28                 --disable-caca \
29                 --disable-alsa \
30                 --disable-x11
31
32         ./waf install
33
34         # Use opensles audio out be default:
35         mkdir -p $TERMUX_PREFIX/etc/mpv
36         cp $TERMUX_PKG_BUILDER_DIR/mpv.conf $TERMUX_PREFIX/etc/mpv/mpv.conf
37
38         # Try to work around OpenSL ES library clashes:
39         # Linking against libOpenSLES causes indirect linkage against
40         # libskia.so, which links against the platform libjpeg.so and
41         # libpng.so, which are not compatible with the Termux ones.
42         #
43         # On Android N also liblzma seems to conflict.
44         mkdir -p $TERMUX_PREFIX/libexec
45         mv $TERMUX_PREFIX/bin/mpv $TERMUX_PREFIX/libexec
46
47         local SYSTEM_LIBFOLDER=lib64
48         if [ $TERMUX_ARCH_BITS = 32 ]; then SYSTEM_LIBFOLDER=lib; fi
49
50         echo "#!/bin/sh" > $TERMUX_PREFIX/bin/mpv
51
52         # Work around issues on devices having ffmpeg libraries
53         # in a system vendor dir, reported by live_the_dream on #termux:
54         local FFMPEG_LIBS="" lib
55         for lib in avcodec avfilter avformat avutil postproc swresample swscale; do
56                 if [ -n "$FFMPEG_LIBS" ]; then FFMPEG_LIBS+=":"; fi
57                 FFMPEG_LIBS+="$TERMUX_PREFIX/lib/lib${lib}.so"
58         done
59         echo "export LD_PRELOAD=$FFMPEG_LIBS" >> $TERMUX_PREFIX/bin/mpv
60
61         # /system/vendor/lib(64) needed for libqc-opt.so on
62         # a xperia z5 c, reported by BrainDamage on #termux:
63         echo "LD_LIBRARY_PATH=/system/$SYSTEM_LIBFOLDER:/system/vendor/$SYSTEM_LIBFOLDER:$TERMUX_PREFIX/lib $TERMUX_PREFIX/libexec/mpv \"\$@\"" >> $TERMUX_PREFIX/bin/mpv
64
65         chmod +x $TERMUX_PREFIX/bin/mpv
66 }