pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/audio/musicpd musicpd: Modernise config file.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/3df9d95b3d61
branches:  trunk
changeset: 405666:3df9d95b3d61
user:      nia <nia%pkgsrc.org@localhost>
date:      Wed Dec 04 11:00:23 2019 +0000

description:
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:

 audio/musicpd/INSTALL                                                  |  10 +
 audio/musicpd/Makefile                                                 |  61 ++++++++-
 audio/musicpd/distinfo                                                 |   3 +-
 audio/musicpd/files/mpd.conf                                           |  50 ++++---
 audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx |  45 +++++++
 5 files changed, 133 insertions(+), 36 deletions(-)

diffs (242 lines):

diff -r bd08201d515d -r 3df9d95b3d61 audio/musicpd/INSTALL
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/musicpd/INSTALL     Wed Dec 04 11:00:23 2019 +0000
@@ -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 -r bd08201d515d -r 3df9d95b3d61 audio/musicpd/Makefile
--- a/audio/musicpd/Makefile    Wed Dec 04 08:06:50 2019 +0000
+++ b/audio/musicpd/Makefile    Wed Dec 04 11:00:23 2019 +0000
@@ -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 @@
 
 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+=   -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 -r bd08201d515d -r 3df9d95b3d61 audio/musicpd/distinfo
--- a/audio/musicpd/distinfo    Wed Dec 04 08:06:50 2019 +0000
+++ b/audio/musicpd/distinfo    Wed Dec 04 11:00:23 2019 +0000
@@ -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 -r bd08201d515d -r 3df9d95b3d61 audio/musicpd/files/mpd.conf
--- a/audio/musicpd/files/mpd.conf      Wed Dec 04 08:06:50 2019 +0000
+++ b/audio/musicpd/files/mpd.conf      Wed Dec 04 11:00:23 2019 +0000
@@ -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"
+bind_to_address                "any"
 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"
+state_file             "@VARBASE@/lib/mpd/.mpdstate"
 
-max_playlist_length    "4096"
-bind_to_address                "any"
+database {
+       plugin          "simple"
+       path            "@VARBASE@/lib/mpd/db"
+}
 
 audio_output {
-       type            "oss"
-       name            "LibAO-OSS"
-       device          "@DEVOSSAUDIO@"
+       type            "ao"
+       name            "ao"
+       driver          "default"
 }
 
+# Also usable on NetBSD.
+#audio_output {
+#      type            "solaris"
+#      name            "sun1"
+#      device          "/dev/audio"
+#}
+
+user                   "@MPD_USER@"
+
 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"
 
-#user                  "mp3"
-
-# 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 -r bd08201d515d -r 3df9d95b3d61 audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/audio/musicpd/patches/patch-src_output_plugins_SolarisOutputPlugin.cxx    Wed Dec 04 11:00:23 2019 +0000
@@ -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 = {



Home | Main Index | Thread Index | Old Index