summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authornia <nia@pkgsrc.org>2019-12-04 11:00:23 +0000
committernia <nia@pkgsrc.org>2019-12-04 11:00:23 +0000
commit2b13470aa0e9803d1f1f61b1e161e7707315eaa5 (patch)
treeffeae9253ae6fd8d467e4bcd7eeba87690b3c278 /audio
parent92707aea8c6e3c99b660aa5f52be6bb50963cea3 (diff)
downloadpkgsrc-2b13470aa0e9803d1f1f61b1e161e7707315eaa5.tar.gz
musicpd: Modernise config file.
- automatically run as unprivileged user. - set up directories in /var/lib/mpd. - allow 'solaris' audio output to be used on NetBSD. Bump PKGREVISION
Diffstat (limited to 'audio')
-rw-r--r--audio/musicpd/INSTALL10
-rw-r--r--audio/musicpd/Makefile61
-rw-r--r--audio/musicpd/distinfo3
-rw-r--r--audio/musicpd/files/mpd.conf52
-rw-r--r--audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx45
5 files changed, 134 insertions, 37 deletions
diff --git a/audio/musicpd/INSTALL b/audio/musicpd/INSTALL
new file mode 100644
index 00000000000..b3ef3651e48
--- /dev/null
+++ b/audio/musicpd/INSTALL
@@ -0,0 +1,10 @@
+# $NetBSD: INSTALL,v 1.1 2019/12/04 11:00:23 nia Exp $
+
+case ${STAGE} in
+POST-INSTALL)
+ ${TOUCH} @VARBASE@/lib/mpd/db
+ ${CHOWN} @MPD_USER@:@MPD_GROUP@ @VARBASE@/lib/mpd/db
+ ${TOUCH} @VARBASE@/lib/mpd/.mpdstate
+ ${CHOWN} @MPD_USER@:@MPD_GROUP@ @VARBASE@/lib/mpd/.mpdstate
+ ;;
+esac
diff --git a/audio/musicpd/Makefile b/audio/musicpd/Makefile
index 991948512f9..f9b855cb794 100644
--- a/audio/musicpd/Makefile
+++ b/audio/musicpd/Makefile
@@ -1,8 +1,8 @@
-# $NetBSD: Makefile,v 1.202 2019/11/23 08:45:45 mef Exp $
+# $NetBSD: Makefile,v 1.203 2019/12/04 11:00:23 nia Exp $
DISTNAME= mpd-0.21.16
PKGNAME= ${DISTNAME:S/mpd/musicpd/}
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= audio
MASTER_SITES= https://www.musicpd.org/download/mpd/0.21/
EXTRACT_SUFX= .tar.xz
@@ -16,6 +16,10 @@ CONFLICTS= mpd-[0-9]*
USE_TOOLS+= pkg-config
USE_LANGUAGES= c99 c++14
+
+# c++14
+GCC_REQD+= 6
+
MESON_ARGS+= -Ddocumentation=true
# worrying libraries with limited maintainance:
@@ -31,27 +35,62 @@ MESON_ARGS+= -Dnfs=disabled
MESON_ARGS+= -Diso9660=disabled
MESON_ARGS+= -Dsndio=disabled
-# c++14
-GCC_REQD+= 6
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS} == "NetBSD" || ${OPSYS} == "SunOS"
+MESON_ARGS+= -Dsolaris_output=enabled
+.endif
+
+MPD_USER?= mpd
+MPD_GROUP?= mpd
+PKG_GROUPS= ${MPD_GROUP}
+PKG_USERS= ${MPD_USER}:${MPD_GROUP}
+PKG_GROUPS_VARS= MPD_USER
+PKG_USERS_VARS= MPD_GROUP
.include "../../mk/oss.buildlink3.mk"
-LDFLAGS+= ${LIBOSSAUDIO}
-FILES_SUBST+= DEVOSSAUDIO=${DEVOSSAUDIO}
+.if ${OSS_TYPE} == "none"
+MESON_ARGS+= -Doss=disabled
+.else
+MESON_ARGS+= -Doss=enabled
+LDFLAGS+= ${LIBOSSAUDIO}
+SUBST_CLASSES+= oss
+SUBST_STAGE.oss= pre-configure
+SUBST_MESSAGE.oss= Correcting the path to the OSS device.
+SUBST_FILES.oss+= src/output/plugins/OssOutputPlugin.cxx
+SUBST_SED.oss+= -e "s,/dev/sound/dsp,${DEVOSSAUDIO},g"
+.endif
EGDIR= ${PREFIX}/share/examples/mpd
CONF_FILES= ${EGDIR}/mpd.conf ${PKG_SYSCONFDIR}/mpd.conf
RCD_SCRIPTS= mpd
+FILES_SUBST+= MPD_USER=${MPD_USER:Q}
+FILES_SUBST+= MPD_GROUP=${MPD_GROUP:Q}
+FILES_SUBST+= VARBASE=${VARBASE}
+
+BUILD_DEFS+= VARBASE
+
+OWN_DIRS_PERMS+= ${VARBASE}/lib/mpd \
+ ${MPD_USER} ${MPD_GROUP} 0755
+
+OWN_DIRS_PERMS+= ${VARBASE}/lib/mpd/music \
+ ${MPD_USER} ${MPD_GROUP} 0755
+
+OWN_DIRS_PERMS+= ${VARBASE}/lib/mpd/playlists \
+ ${MPD_USER} ${MPD_GROUP} 0755
+
CPPFLAGS.SunOS+= -std=gnu99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__
.include "options.mk"
-SUBST_CLASSES+= paths
-SUBST_STAGE.paths= pre-configure
-SUBST_FILES.paths= mpd.conf
-SUBST_MESSAGE.paths= Fixing path to sound device in example config.
-SUBST_VARS.paths+= DEVOSSAUDIO
+SUBST_CLASSES+= conf
+SUBST_STAGE.conf= pre-configure
+SUBST_FILES.conf= ${WRKSRC}/mpd.conf
+SUBST_MESSAGE.conf= Setting variables in the configuration file.
+SUBST_VARS.conf+= VARBASE
+SUBST_VARS.conf+= MPD_USER
SUBST_CLASSES+= sphinx
SUBST_STAGE.sphinx= pre-configure
diff --git a/audio/musicpd/distinfo b/audio/musicpd/distinfo
index a262df8d2c1..99ffd51dacc 100644
--- a/audio/musicpd/distinfo
+++ b/audio/musicpd/distinfo
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.105 2019/10/24 21:23:13 nia Exp $
+$NetBSD: distinfo,v 1.106 2019/12/04 11:00:23 nia Exp $
SHA1 (mpd-0.21.16.tar.xz) = 389023117eba5963a03222289f20f007b2afd3c0
RMD160 (mpd-0.21.16.tar.xz) = 457ef719afd9296c94321501fc10d5e44e2eae71
SHA512 (mpd-0.21.16.tar.xz) = bb7587acd03d675ae3127ab4e196d549170551ac643e5134baa2bccaf8d7c9bba6c9a9edec9bcb61a2ec3a6ce26f4d77190323ef0329033d0cd8c1f8964be05c
Size (mpd-0.21.16.tar.xz) = 673732 bytes
SHA1 (patch-src_net_IPv6Address.hxx) = c9e9a5676451e6834fcef359266d37fc15f079e6
+SHA1 (patch-src_output_plugins_SolarisOutputPlugin.cxx) = 1bf5284c52446100f6c01ac94d6e82a0685ab13a
diff --git a/audio/musicpd/files/mpd.conf b/audio/musicpd/files/mpd.conf
index 8f2e0a173f1..ba8fb0785f7 100644
--- a/audio/musicpd/files/mpd.conf
+++ b/audio/musicpd/files/mpd.conf
@@ -1,39 +1,41 @@
-# $NetBSD: mpd.conf,v 1.8 2019/07/15 13:47:14 nia Exp $
+# $NetBSD: mpd.conf,v 1.9 2019/12/04 11:00:23 nia Exp $
# required
-music_directory "/mp3"
-playlist_directory "/mp3"
-log_file "/var/log/mpd.log"
+music_directory "@VARBASE@/lib/mpd/music"
+playlist_directory "@VARBASE@/lib/mpd/playlists"
+
+log_file "@VARBASE@/log/mpd.log"
+# log_level can be "default", "secure", "verbose"
+log_level "default"
# optional
port "6600"
-max_connections "5"
-max_command_list_size "2048"
-max_output_buffer_size "2048"
-connection_timeout "60"
-db_file "/mp3/.mpddb"
-state_file "/mp3/.mpdstate"
-save_absolute_paths_in_playlists "no"
-
-max_playlist_length "4096"
bind_to_address "any"
+max_connections "5"
+state_file "@VARBASE@/lib/mpd/.mpdstate"
+
+database {
+ plugin "simple"
+ path "@VARBASE@/lib/mpd/db"
+}
audio_output {
- type "oss"
- name "LibAO-OSS"
- device "@DEVOSSAUDIO@"
+ type "ao"
+ name "ao"
+ driver "default"
}
-mixer_type "software"
-# mixer_control defaults to the master volume control. uncomment the
-# following line to have mpd's volume control modify the "PCM"
-# volume instead:
-# mixer_control "Pcm"
+# Also usable on NetBSD.
+#audio_output {
+# type "solaris"
+# name "sun1"
+# device "/dev/audio"
+#}
-#user "mp3"
+user "@MPD_USER@"
+
+mixer_type "software"
-# log_level can be "default", "secure", "verbose"
-log_level "default"
#password "password@read,add,control,admin"
#default_permissions "read,add,control,admin"
-#filesystem_charset "UTF-8"
+filesystem_charset "UTF-8"
diff --git a/audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx b/audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx
new file mode 100644
index 00000000000..8b6e2462d05
--- /dev/null
+++ b/audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx
@@ -0,0 +1,45 @@
+$NetBSD: patch-src_output_plugins_SolarisOutputPlugin.cxx,v 1.1 2019/12/04 11:00:23 nia Exp $
+
+Allow this plugin to be also used on NetBSD.
+
+--- src/output/plugins/SolarisOutputPlugin.cxx.orig 2019-10-16 09:58:36.000000000 +0000
++++ src/output/plugins/SolarisOutputPlugin.cxx
+@@ -22,22 +22,23 @@
+ #include "system/FileDescriptor.hxx"
+ #include "system/Error.hxx"
+
++#include <sys/ioctl.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <errno.h>
+
+-#ifdef __sun
++#if defined(__sun)
+ #include <sys/audio.h>
+ #include <sys/stropts.h>
++#elif defined(__NetBSD__)
++#include <sys/audioio.h>
+ #else
+
+ /* some fake declarations that allow build this plugin on systems
+ other than Solaris, just to see if it compiles */
+
+-#include <sys/ioctl.h>
+-
+ #ifndef I_FLUSH
+ #define I_FLUSH 0
+ #endif
+@@ -147,7 +148,11 @@ SolarisOutput::Play(const void *chunk, s
+ void
+ SolarisOutput::Cancel() noexcept
+ {
++#if defined(AUDIO_FLUSH)
++ ioctl(fd.Get(), AUDIO_FLUSH);
++#elif defined(I_FLUSH)
+ ioctl(fd.Get(), I_FLUSH);
++#endif
+ }
+
+ const struct AudioOutputPlugin solaris_output_plugin = {