1 TERMUX_PKG_HOMEPAGE=https://www.musicpd.org
2 TERMUX_PKG_DESCRIPTION="Music player daemon"
3 TERMUX_PKG_VERSION=0.20.18
5 TERMUX_PKG_SHA256=7bef591314a4e3336767314b469da0aa212a5fd2a29480eeff831fafaf9079c7
6 TERMUX_PKG_SRCURL=https://github.com/MusicPlayerDaemon/MPD/archive/v$TERMUX_PKG_VERSION.tar.gz
7 TERMUX_PKG_DEPENDS="libcurl, libid3tag, libopus, libevent, fftw, libpulseaudio, libmpdclient, boost, openal-soft, libvorbis, libsqlite, ffmpeg, libmp3lame, libbz2"
8 TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
20 TERMUX_PKG_BUILD_IN_SRC=yes
21 TERMUX_PKG_CONFFILES="$TERMUX_PREFIX/etc/mpd.conf"
23 termux_step_pre_configure() {
24 CXXFLAGS+=" -DTERMUX -UANDROID"
25 LDFLAGS+=" -llog -lOpenSLES"
26 NOCONFIGURE=1 ./autogen.sh
27 rm -f /data/data/com.termux/files/usr/etc/mpd.conf
30 termux_step_make_install () {
31 # Try to work around OpenSL ES library clashes:
32 # Linking against libOpenSLES causes indirect linkage against
33 # libskia.so, which links against the platform libjpeg.so and
34 # libpng.so, which are not compatible with the Termux ones.
36 # On Android N also liblzma seems to conflict.
38 cp -f $TERMUX_PREFIX/share/doc/mpd/mpdconf.example /data/data/com.termux/files/usr/etc/mpd.conf
39 mkdir -p $TERMUX_PREFIX/libexec
40 mkdir -p $TERMUX_PREFIX/var/mpd
41 mv $TERMUX_PREFIX/bin/mpd $TERMUX_PREFIX/libexec
42 local SYSTEM_LIBFOLDER=lib64
43 if [ $TERMUX_ARCH_BITS = 32 ]; then SYSTEM_LIBFOLDER=lib; fi
45 echo "#!/bin/sh" > $TERMUX_PREFIX/bin/mpd
46 cat $TERMUX_SCRIPTDIR/packages/mpd/mpd-script.sh >> $TERMUX_PREFIX/bin/mpd
47 # Work around issues on devices having ffmpeg libraries
48 # in a system vendor dir, reported by live_the_dream on #termux:
49 local FFMPEG_LIBS="" lib
50 # c++_shared needs to go first in every c++ app that uses audio directly.
51 for lib in c++_shared curl ssl event opus vorbis avcodec avfilter avformat avutil postproc swresample swscale sqlite3; do
52 if [ -n "$FFMPEG_LIBS" ]; then FFMPEG_LIBS+=":"; fi
53 FFMPEG_LIBS+="$TERMUX_PREFIX/lib/lib${lib}.so"
55 echo "export LD_PRELOAD=$FFMPEG_LIBS" >> $TERMUX_PREFIX/bin/mpd
56 chmod +x $TERMUX_PREFIX/bin/mpd
57 # /system/vendor/lib(64) needed for libqc-opt.so on
58 # a xperia z5 c, reported by BrainDamage on #termux:
59 echo "LD_LIBRARY_PATH=/system/$SYSTEM_LIBFOLDER:/system/vendor/$SYSTEM_LIBFOLDER:$TERMUX_PREFIX/lib exec $TERMUX_PREFIX/libexec/mpd \"\$@\"" >> $TERMUX_PREFIX/bin/mpd
62 termux_step_create_debscripts() {
63 echo "#!$TERMUX_PREFIX/bin/sh" > postinst
64 echo 'mkdir -p $HOME/.mpd/playlists' >> postinst