changeset 924:9c2079a14085

audio/mpd: initial import, closes #1597
author David Demelier <markand@malikania.fr>
date Tue, 27 Aug 2019 20:50:00 +0200
parents ea26d8ed5066
children 995cdea813e9
files Docs/uids.md audio/mpd/mpd audio/mpd/mpd-post.sh audio/mpd/mpd.sh audio/mpd/mpd.sha1
diffstat 5 files changed, 549 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Docs/uids.md	Tue Aug 27 20:45:00 2019 +0200
+++ b/Docs/uids.md	Tue Aug 27 20:50:00 2019 +0200
@@ -16,3 +16,4 @@
 |                | pulse-rt (103)     | audio/pulseaudio |
 |                | pulse-access (104) | audio/pulseaudio |
 | wesnothd (105) | wesnothd (105)     | games/wesnoth    |
+| mpd (106)      | mpd (106)          | audio/mpd        |
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/mpd/mpd	Tue Aug 27 20:50:00 2019 +0200
@@ -0,0 +1,78 @@
+#!/bin/sh
+#
+# /etc/rc.d/mpd -- run control script for mpd
+#
+# Copyright (c) 2019 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+if [ -f /etc/rc.conf ]; then
+	. /etc/rc.conf
+fi
+
+: ${MPD_CMD:=/bin/mpd}
+: ${MPD_ARGS:=}
+: ${MPD_PID:=/var/run/mpd/mpd.pid}
+
+mpd_start()
+{
+	if [ -s $MPD_PID ]; then
+		echo "mpd is already running with pid: $(cat $MPD_PID)"
+	else
+		echo "Starting mpd: $MPD_CMD $MPD_ARGS"
+		$MPD_CMD $MPD_ARGS
+	fi
+}
+
+mpd_status()
+{
+	if [ -s $MPD_PID ]; then
+		echo "mpd is running with pid: $(cat $MPD_PID)"
+	else
+		echo "mpd is not running"
+	fi
+}
+
+mpd_stop()
+{
+	if [ -s $MPD_PID ]; then
+		echo "Stopping mpd."
+		$MPD_CMD --kill
+	fi
+}
+
+mpd_restart()
+{
+	mpd_stop
+	sleep 3
+	mpd_start
+}
+
+case $1 in
+start)
+	mpd_start
+	;;
+status)
+	mpd_status
+	;;
+stop)
+	mpd_stop
+	;;
+restart)
+	mpd_restart
+	;;
+*)
+	echo "usage: $(basename $0) restart|start|status|stop"
+	;;
+esac
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/mpd/mpd-post.sh	Tue Aug 27 20:50:00 2019 +0200
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+if [ "$1" = "post-install" ]; then
+	mkdir -p /var/run/mpd
+	chown mpd:mpd /var/run/mpd
+fi
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/mpd/mpd.sh	Tue Aug 27 20:50:00 2019 +0200
@@ -0,0 +1,448 @@
+#!/bin/sh
+#
+# Copyright (c) 2019 David Demelier <markand@malikania.fr>
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+
+#
+# TODO: add those options:
+#
+# ADPLUG
+# CHROMAPRINT
+# GME
+# MODPLUG
+# MPCDEC
+# NFS
+# SAMBA
+# SHINE
+# SIDPLAY
+# TREMOR
+# UDISKS
+# UPNP
+# WAVPACK
+# WILDMIDI
+# YAML (yajl)
+# ZZIP
+#
+
+PKGNAME=mpd
+PKGVERSION=0.21.14
+PKGREVISION=1
+PKGLICENSE="GPLv20"
+PKGSUMMARY="daemon for playing music of various formats"
+PKGDOWNLOAD="https://www.musicpd.org/download/mpd/${PKGVERSION%.*}/$PKGNAME-$PKGVERSION.tar.xz"
+PKGDEPENDS="meson:build"
+PKGOPTIONS="AAC
+            ALSA
+            AO
+            AUDIOFILE
+            BZIP2
+            CD
+            CURL
+            DBUS
+            FFMPEG
+            FLAC
+            FLUIDSYNTH
+            ICU
+            ID3
+            IPV6
+            JACK
+            MIKMOD
+            MMS
+            MP2
+            MP3
+            OPENAL
+            OPUS
+            OSS
+            PULSEAUDIO
+            REGEX
+            SAMPLERATE
+            SHOUT
+            SNDFILE
+            SOXR
+            SQLITE
+            SYSLOG
+            VORBIS
+            WEBDAV
+            XML
+            ZLIB"
+PKGPROTECT="etc/mpd.conf etc/rc.d/mpd"
+PKGUIDS="mpd:106"
+PKGGIDS="mpd:106"
+
+: ${CC:=clang}
+: ${CFLAGS:=-O2}
+: ${CXX:=clang++}
+: ${CXXFLAGS:=-O2}
+: ${LDFLAGS:=}
+: ${AAC:=yes}
+: ${ALSA:=yes}
+: ${AO:=yes}
+: ${AUDIOFILE:=yes}
+: ${BZIP2:=yes}
+: ${CD:=cdio cdio-paranoia}
+: ${CURL:=yes}
+: ${DBUS:=yes}
+: ${FFMPEG:=yes}
+: ${FLAC:=yes}
+: ${FLUIDSYNTH:=yes}
+: ${ICU:=yes}
+: ${ID3:=yes}
+: ${IPV6:=yes}
+: ${JACK:=yes}
+: ${MIKMOD:=yes}
+: ${MMS:=yes}
+: ${MP2:=yes}
+: ${MP3:=lame mad mpg123}
+: ${OPENAL:=yes}
+: ${OPUS:=yes}
+: ${OSS:=yes}
+: ${PULSEAUDIO:=yes}
+: ${REGEX:=yes}
+: ${SAMPLERATE:=yes}
+: ${SHOUT:=yes}
+: ${SNDFILE:=yes}
+: ${SOXR:=yes}
+: ${SQLITE:=yes}
+: ${SYSLOG:=yes}
+: ${VORBIS:=yes}
+: ${WEBDAV:=yes}        # Note: requires XML and CURL.
+: ${XML:=yes}           # Note: XML support through expat dependency.
+: ${ZLIB:=yes}
+
+if [ "$AAC" = "yes" ]; then
+	PKGDEPENDS="faad2 $PKGDEPENDS"
+	with_aac="-D faad=enabled"
+else
+	with_aac="-D faad=disabled"
+fi
+
+if [ "$ALSA" = "yes" ]; then
+	PKGDEPENDS="alsa-lib $PKGDEPENDS"
+	with_alsa="-D alsa=enabled"
+else
+	with_alsa="-D alsa=disabled"
+fi
+
+if [ "$AO" = "yes" ]; then
+	PKGDEPENDS="libao $PKGDEPENDS"
+	with_ao="-D ao=enabled"
+else
+	with_ao="-D ao=disabled"
+fi
+
+if [ "$AUDIOFILE" = "yes" ]; then
+	PKGDEPENDS="audiofile $PKGDEPENDS"
+	with_audiofile="-D audiofile=enabled"
+else
+	with_audiofile="-D audiofile=disabled"
+fi
+
+if [ "$BZIP2" = "yes" ]; then
+	PKGDEPENDS="bzip2 $PKGDEPENDS"
+	with_bzip2="-D bzip2=enabled"
+else
+	with_bzip2="-D bzip2=disabled"
+fi
+
+if [ -z "${CD##*cdio*}" ]; then
+	PKGDEPENDS="libcdio $PKGDEPENDS"
+	with_cdio="-D iso9660=enabled"
+else
+	with_cdio="-D iso9660=disabled"
+fi
+
+if [ -z "${CD##*cdio-paranoia*}" ]; then
+	PKGDEPENDS="libcdio-paranoia $PKGDEPENDS"
+	with_cdio_paranoia="-D cdio_paranoia=enabled"
+else
+	with_cdio_paranoia="-D cdio_paranoia=disabled"
+fi
+
+if [ "$CURL" = "yes" ]; then
+	PKGDEPENDS="curl $PKGDEPENDS"
+	with_curl="-D curl=enabled"
+else
+	with_curl="-D curl=disabled"
+fi
+
+if [ "$DBUS" = "yes" ]; then
+	PKGDEPENDS="dbus $PKGDEPENDS"
+	with_dbus="-D dbus=enabled"
+else
+	with_dbus="-D dbus=disabled"
+fi
+
+if [ "$FFMPEG" = "yes" ]; then
+	PKGDEPENDS="ffmpeg $PKGDEPENDS"
+	with_ffmpeg="-D ffmpeg=enabled"
+else
+	with_ffmpeg="-D ffmpeg=disabled"
+fi
+
+if [ "$FLAC" = "yes" ]; then
+	PKGDEPENDS="flac $PKGDEPENDS"
+	with_flac="-D flac=enabled"
+else
+	with_flac="-D flac=disabled"
+fi
+
+if [ "$FLUIDSYNTH" = "yes" ]; then
+	PKGDEPENDS="fluidsynth $PKGDEPENDS"
+	with_fluidsynth="-D fluidsynth=enabled"
+else
+	with_fluidsynth="-D fluidsynth=disabled"
+fi
+
+if [ "$ICU" = "yes" ]; then
+	PKGDEPENDS="icu $PKGDEPENDS"
+	with_icu="-D icu=enabled"
+else
+	with_icu="-D icu=disabled"
+fi
+
+if [ "$ID3" = "yes" ]; then
+	PKGDEPENDS="libid3tag $PKGDEPENDS"
+	with_id3="-D id3=enabled"
+else
+	with_id3="-D id3=disabled"
+fi
+
+if [ "$IPV6" = "yes" ]; then
+	with_ipv6="-D ipv6=enabled"
+else
+	with_ipv6="-D ipv6=disabled"
+fi
+
+if [ "$JACK" = "yes" ]; then
+	PKGDEPENDS="jack2 $PKGDEPENDS"
+	with_jack="-D jack=enabled"
+else
+	with_jack="-D jack=disabled"
+fi
+
+if [ "$MIKMOD" = "yes" ]; then
+	PKGDEPENDS="libmikmod $PKGDEPENDS"
+	with_mikmod="-D mikmod=enabled"
+else
+	with_mikmod="-D mikmod=disabled"
+fi
+
+if [ "$MMS" = "yes" ]; then
+	PKGDEPENDS="libmms $PKGDEPENDS"
+	with_mms="-D mms=enabled"
+else
+	with_mms="-D mms=disabled"
+fi
+
+if [ "$MP2" = "yes" ]; then
+	PKGDEPENDS="twolame $PKGDEPENDS"
+	with_mp2="-D twolame=enabled"
+else
+	with_mp2="-D twolame=disabled"
+fi
+
+if [ -z "${MP3##*mad*}" ]; then
+	PKGDEPENDS="libmad $PKGDEPENDS"
+	with_mad="-D mad=enabled"
+else
+	with_mad="-D mad=disabled"
+fi
+
+if [ -z "${MP3##*lame*}" ]; then
+	PKGDEPENDS="lame $PKGDEPENDS"
+	with_lame="-D lame=enabled"
+else
+	with_lame="-D lame=disabled"
+fi
+
+if [ -z "${MP3##*mpg123*}" ]; then
+	PKGDEPENDS="mpg123 $PKGDEPENDS"
+	with_mpg123="-D mpg123=enabled"
+else
+	with_mpg123="-D mpg123=disabled"
+fi
+
+if [ "$OPENAL" = "yes" ]; then
+	PKGDEPENDS="openal-soft $PKGDEPENDS"
+	with_openal="-D openal=enabled"
+else
+	with_openal="-D openal=disabled"
+fi
+
+if [ "$OPUS" = "yes" ]; then
+	PKGDEPENDS="opus $PKGDEPENDS"
+	with_opus="-D opus=enabled"
+else
+	with_opus="-D opus=disabled"
+fi
+
+if [ "$OSS" = "yes" ]; then
+	with_oss="-D oss=enabled"
+else
+	with_oss="-D oss=disabled"
+fi
+
+if [ "$PULSEAUDIO" = "yes" ]; then
+	PKGDEPENDS="pulseaudio $PKGDEPENDS"
+	with_pulseaudio="-D pulse=enabled"
+else
+	with_pulseaudio="-D pulse=disabled"
+fi
+
+if [ "$REGEX" = "yes" ]; then
+	PKGDEPENDS="pcre $PKGDEPENDS"
+	with_regex="-D pcre=enabled"
+else
+	with_regex="-D pcre=disabled"
+fi
+
+if [ "$SAMPLERATE" = "yes" ]; then
+	PKGDEPENDS="libsamplerate $PKGDEPENDS"
+	with_samplerate="-D libsamplerate=enabled"
+else
+	with_samplerate="-D libsamplerate=disabled"
+fi
+
+if [ "$SHOUT" = "yes" ]; then
+	PKGDEPENDS="libshout $PKGDEPENDS"
+	with_shout="-D shout=enabled"
+else
+	with_shout="-D shout=disabled"
+fi
+
+if [ "$SNDFILE" = "yes" ]; then
+	PKGDEPENDS="libsndfile $PKGDEPENDS"
+	with_sndfile="-D sndfile=enabled"
+else
+	with_sndfile="-D snfile=disabled"
+fi
+
+if [ "$SOXR" = "yes" ]; then
+	PKGDEPENDS="soxr $PKGDEPENDS"
+	with_soxr="-D soxr=enabled"
+else
+	with_soxr="-D soxr=disabled"
+fi
+
+if [ "$SQLITE" = "yes" ]; then
+	PKGDEPENDS="sqlite $PKGDEPENDS"
+	with_sqlite="-D sqlite=enabled"
+else
+	with_sqlite="-D sqlite=disabled"
+fi
+
+if [ "$SYSLOG" = "yes" ]; then
+	with_syslog="-D syslog=enabled"
+else
+	with_syslog="-D syslog=disabled"
+fi
+
+if [ "$VORBIS" = "yes" ]; then
+	PKGDEPENDS="libvorbis $PKGDEPENDS"
+	with_vorbis="-D vorbis=enabled"
+else
+	with_vorbis="-D vorbis=disabled"
+fi
+
+if [ "$WEBDAV" = "yes" ]; then
+	with_webdav="-D webdav=enabled"
+else
+	with_webdav="-D webdav=disabled"
+fi
+
+if [ "$XML" = "yes" ]; then
+	PKGDEPENDS="expat $PKGDEPENDS"
+	with_xml="-D expat=enabled"
+else
+	with_xml="-D expat=disabled"
+fi
+
+if [ "$ZLIB" = "yes" ]; then
+	PKGDEPENDS="zlib $PKGDEPENDS"
+	with_zlib="-D zlib=enabled"
+else
+	with_zlib="-D zlib=disabled"
+fi
+
+build()
+{
+	rm -rf $PKGNAME-$PKGVERSION
+	tar xvf $PKGNAME-$PKGVERSION.tar.xz
+	cd $PKGNAME-$PKGVERSION
+
+	CC="$CC" \
+	CFLAGS="$CFLAGS" \
+	CXX="$CXX" \
+	CXXFLAGS="$CXXFLAGS" \
+	LDFLAGS="$LDFLAGS" \
+	meson . build \
+		--prefix / \
+		--buildtype release \
+		--default-library shared \
+		-D systemd=disabled \
+		$with_aac \
+		$with_alsa \
+		$with_ao \
+		$with_audiofile \
+		$with_bzip2 \
+		$with_cdio \
+		$wiht_cdio_paranoia \
+		$with_curl \
+		$with_dbus \
+		$with_ffmpeg \
+		$with_flac \
+		$with_fluidsynth \
+		$with_icu \
+		$with_id3 \
+		$with_ipv6 \
+		$with_jack \
+		$with_lame \
+		$with_mad \
+		$with_mikmod \
+		$with_mms \
+		$with_mp2 \
+		$with_mpg123 \
+		$with_openal \
+		$with_opus \
+		$with_oss \
+		$with_pulseaudio \
+		$with_regex \
+		$with_samplerate \
+		$with_shout \
+		$with_sndfile \
+		$with_soxr \
+		$with_sqlite \
+		$with_syslog \
+		$with_vorbis \
+		$with_webdav \
+		$with_xml \
+		$with_zlib
+	ninja -C build
+	DESTDIR=$DESTDIR ninja -C build install
+
+	# Not installed by default.
+	install -Dm644 doc/mpdconf.example $DESTDIR/etc/mpd.conf
+	install -Dm644 doc/mpd.1 $DESTDIR/share/man/man1/mpd.1
+	install -Dm644 doc/mpd.conf.5 $DESTDIR/share/man/man5/mpd.conf.5
+	install -Dm644 ../mpd $DESTDIR/etc/rc.d/mpd
+
+	# Customize the default config with our pid, uid and gid.
+	sed -i -e 's|^#pid_file.*|pid_file "/var/run/mpd/mpd.pid"|' $DESTDIR/etc/mpd.conf
+	sed -i -e 's|^#user.*|user "mpd"|' $DESTDIR/etc/mpd.conf
+	sed -i -e 's|^#group.*|group "mpd"|' $DESTDIR/etc/mpd.conf
+
+	cd ..
+	rm -rf $PKGNAME-$PKGVERSION
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/mpd/mpd.sha1	Tue Aug 27 20:50:00 2019 +0200
@@ -0,0 +1,1 @@
+caa1751703db5f8df5598dea601a3e490bd16b3b  mpd-0.21.14.tar.xz