Update to mpd-0.18.10, now that a nasty race condition when using

GLib event loop has been fixed upstream.

It adds a dependency on gcc 4.8 because code was rewritten c++11-style.

Original diff for 0.18.9 by landry@.
Tested by landry@ and Bryan Linton.
OK landry@
This commit is contained in:
dcoppa 2014-05-06 10:49:23 +00:00
parent 2cf15e74b2
commit 8dc34205a0
9 changed files with 168 additions and 35 deletions

View File

@ -1,7 +1,7 @@
# $OpenBSD: Makefile,v 1.56 2013/11/05 07:08:52 dcoppa Exp $
# $OpenBSD: Makefile,v 1.57 2014/05/06 10:49:23 dcoppa Exp $
COMMENT = Music Player Daemon
DISTNAME = mpd-0.17.6
DISTNAME = mpd-0.18.10
CATEGORIES = audio
HOMEPAGE = http://www.musicpd.org/
MAINTAINER = David Coppa <dcoppa@openbsd.org>
@ -12,11 +12,13 @@ PERMIT_PACKAGE_CDROM = Yes
WANTLIB = FLAC ao audiofile c cdio cdio_cdda cdio_paranoia \
curl glib-2.0 gthread-2.0 id3tag m mad \
mikmod ogg pthread samplerate sndfile sndio \
stdc++ z
bz2 mpdclient opus z
MASTER_SITES = http://www.musicpd.org/download/mpd/0.17/
MASTER_SITES = http://www.musicpd.org/download/mpd/stable/
MODULES = devel/gettext
MODULES = devel/gettext gcc4
MODGCC4_ARCHS = i386 amd64 powerpc sparc64
MODGCC4_LANGS = c++
LIB_DEPENDS = devel/libaudiofile \
audio/libao \
@ -26,6 +28,8 @@ LIB_DEPENDS = devel/libaudiofile \
audio/libid3tag \
audio/libmad \
audio/libmikmod \
audio/opus \
audio/libmpdclient \
net/curl \
devel/glib2
@ -36,6 +40,7 @@ CONFIGURE_STYLE = gnu
CONFIGURE_ARGS += --bindir=${PREFIX}/sbin \
--disable-alsa \
--disable-ffmpeg \
--disable-fluidsynth \
--disable-gme \
--disable-inotify \
--disable-jack \
@ -44,11 +49,11 @@ CONFIGURE_ARGS += --bindir=${PREFIX}/sbin \
--disable-modplug \
--disable-mpg123 \
--disable-oss \
--disable-openal \
--disable-pulse \
--disable-roar \
--disable-sidplay \
--disable-soundcloud \
--disable-soup \
--disable-sqlite \
--disable-systemd-daemon \
--disable-twolame-encoder \
@ -81,7 +86,7 @@ LIB_DEPENDS += audio/tremor
WANTLIB += vorbisidec
.else
WANTLIB += theora vorbis vorbisfile vorbisenc speex mp3lame \
shout faad mp4ff mpcdec
shout faad mpcdec
LIB_DEPENDS += audio/libvorbis \
audio/speex \
audio/lame \
@ -93,7 +98,6 @@ CONFIGURE_ARGS += --enable-aac \
--enable-vorbis-encoder
.endif
post-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/examples/mpd
${INSTALL_DATA} ${WRKSRC}/doc/mpdconf.example \

View File

@ -1,2 +1,2 @@
SHA256 (mpd-0.17.6.tar.gz) = GngCYHDXN+eDamGruWPNI9VmQN8aaLqCPpAn23vChMs=
SIZE (mpd-0.17.6.tar.gz) = 763311
SHA256 (mpd-0.18.10.tar.gz) = ZoTtAYhbngbXPsIvZHPLCxfVmRa1ZrRqvjoc1Pnflsg=
SIZE (mpd-0.18.10.tar.gz) = 804169

View File

@ -1,7 +1,7 @@
$OpenBSD: patch-Makefile_in,v 1.8 2012/10/05 08:29:39 dcoppa Exp $
--- Makefile.in.orig Sun Sep 30 12:23:42 2012
+++ Makefile.in Tue Oct 2 14:31:28 2012
@@ -2433,7 +2433,7 @@ SPARSE_SRC = $(addprefix $(top_srcdir)/,$(filter %.c,$
$OpenBSD: patch-Makefile_in,v 1.9 2014/05/06 10:49:23 dcoppa Exp $
--- Makefile.in.orig Tue Feb 18 18:39:35 2014
+++ Makefile.in Tue Mar 18 22:19:40 2014
@@ -3209,7 +3209,7 @@ SPARSE_SRC = $(addprefix $(top_srcdir)/,$(filter %.c,$
# Documentation
#
man_MANS = doc/mpd.1 doc/mpd.conf.5

View File

@ -1,19 +1,19 @@
$OpenBSD: patch-configure,v 1.19 2013/09/19 15:02:16 dcoppa Exp $
$OpenBSD: patch-configure,v 1.20 2014/05/06 10:49:23 dcoppa Exp $
Don't reset CPPFLAGS...stupid configure.
--- configure.orig Sun Aug 4 14:22:05 2013
+++ configure Thu Sep 19 16:58:31 2013
@@ -9862,7 +9862,7 @@ if test x$enable_aac = xyes; then
--- configure.orig Thu Mar 6 13:12:27 2014
+++ configure Fri Apr 18 15:27:27 2014
@@ -10326,7 +10326,7 @@ if test x$enable_aac = xyes; then
oldcppflags=$CPPFLAGS
CFLAGS="$CFLAGS $FAAD_CFLAGS -I."
CFLAGS="$CFLAGS $FAAD_CFLAGS"
LIBS="$LIBS $FAAD_LIBS"
- CPPFLAGS=$CFLAGS
+ CPPFLAGS="$CPPFLAGS $CFLAGS"
ac_fn_c_check_header_mongrel "$LINENO" "faad.h" "ac_cv_header_faad_h" "$ac_includes_default"
if test "x$ac_cv_header_faad_h" = xyes; then :
@@ -10126,7 +10126,7 @@ if test x$enable_aac = xyes; then
@@ -10452,7 +10452,7 @@ if test x$enable_aac = xyes; then
oldcppflags=$CPPFLAGS
CFLAGS="$CFLAGS $FAAD_CFLAGS -Werror"
LIBS="$LIBS $FAAD_LIBS"
@ -22,12 +22,3 @@ Don't reset CPPFLAGS...stupid configure.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for broken libfaad headers" >&5
$as_echo_n "checking for broken libfaad headers... " >&6; }
@@ -10172,7 +10172,7 @@ if test x$enable_aac = xyes; then
oldcppflags=$CPPFLAGS
CFLAGS="$CFLAGS $FAAD_CFLAGS"
LIBS="$LIBS $FAAD_LIBS $MP4FF_LIBS"
- CPPFLAGS=$CFLAGS
+ CPPFLAGS="$CPPFLAGS $CFLAGS"
ac_fn_c_check_header_mongrel "$LINENO" "mp4ff.h" "ac_cv_header_mp4ff_h" "$ac_includes_default"
if test "x$ac_cv_header_mp4ff_h" = xyes; then :

View File

@ -1,6 +1,6 @@
$OpenBSD: patch-doc_mpdconf_example,v 1.11 2013/09/19 15:02:16 dcoppa Exp $
--- doc/mpdconf.example.orig Thu Aug 1 09:15:41 2013
+++ doc/mpdconf.example Thu Sep 19 16:58:31 2013
$OpenBSD: patch-doc_mpdconf_example,v 1.12 2014/05/06 10:49:23 dcoppa Exp $
--- doc/mpdconf.example.orig Wed Dec 11 20:51:53 2013
+++ doc/mpdconf.example Tue Mar 18 22:19:40 2014
@@ -10,14 +10,14 @@
# be disabled and audio files will only be accepted over ipc socket (using
# file:// protocol) or streaming files over an accepted protocol.
@ -69,7 +69,7 @@ $OpenBSD: patch-doc_mpdconf_example,v 1.11 2013/09/19 15:02:16 dcoppa Exp $
# This setting is the TCP port that is desired for the daemon to get assigned
# to.
#
@@ -320,6 +322,14 @@ input {
@@ -324,6 +326,14 @@ input {
# name "My Null Output"
# mixer_type "none" # optional
#}
@ -82,5 +82,5 @@ $OpenBSD: patch-doc_mpdconf_example,v 1.11 2013/09/19 15:02:16 dcoppa Exp $
+ mixer_type "software"
+}
#
# This setting will change all decoded audio to be converted to the specified
# format before being passed to the audio outputs. By default, this setting is
# If MPD has been compiled with libsamplerate support, this setting specifies
# the sample rate converter to use. Possible values can be found in the

View File

@ -0,0 +1,24 @@
$OpenBSD: patch-src_decoder_OggUtil_cxx,v 1.1 2014/05/06 10:49:23 dcoppa Exp $
commit 70bd35abe2ab774b70e37822f0200fcd4ebcd6c6
Author: Max Kellermann <max@duempel.org>
Date: Tue Apr 29 11:56:05 2014 +0200
decoder/OggUtil: allow skipping up to 32 kB after seek
Fixes missing song length on high-latency Opus files.
According to tests with 320 kbit/s opus files with 60ms packets, we
need to skip up to 29 kB.
--- src/decoder/OggUtil.cxx.orig Tue May 6 12:27:40 2014
+++ src/decoder/OggUtil.cxx Tue May 6 12:28:15 2014
@@ -81,7 +81,7 @@ bool
OggExpectPageSeek(ogg_sync_state &oy, ogg_page &page,
Decoder *decoder, InputStream &input_stream)
{
- size_t remaining_skipped = 16384;
+ size_t remaining_skipped = 32768;
while (true) {
int r = ogg_sync_pageseek(&oy, &page);

View File

@ -0,0 +1,66 @@
$OpenBSD: patch-src_event_DeferredMonitor_cxx,v 1.1 2014/05/06 10:49:23 dcoppa Exp $
commit 0efb67b51e0d9d34c65bbdbd9df567a8a991cc4c
Author: Max Kellermann <max@duempel.org>
Date: Sat Apr 26 22:11:23 2014 +0200
DeferredMonitor: fix race condition when using GLib event loop
Turns out the lock-free code using atomics was not thread-safe. The
given callback could be invoked by GLib before the source_id attribute
was assigned. This commit changes the DeferredMonitor class to use
a Mutex to block the event loop until source_id is assigned. This
bug does not exist in the 0.19 branch because it does not use the
GLib main loop anymore.
--- src/event/DeferredMonitor.cxx.orig Wed Dec 11 20:51:53 2013
+++ src/event/DeferredMonitor.cxx Tue Apr 29 11:32:48 2014
@@ -27,9 +27,11 @@ DeferredMonitor::Cancel()
#ifdef USE_EPOLL
pending = false;
#else
- const auto id = source_id.exchange(0);
- if (id != 0)
- g_source_remove(id);
+ const ScopeLock protect(mutex);
+ if (source_id != 0) {
+ g_source_remove(source_id);
+ source_id = 0;
+ }
#endif
}
@@ -40,10 +42,9 @@ DeferredMonitor::Schedule()
if (!pending.exchange(true))
fd.Write();
#else
- const unsigned id = loop.AddIdle(Callback, this);
- const auto old_id = source_id.exchange(id);
- if (old_id != 0)
- g_source_remove(old_id);
+ const ScopeLock protect(mutex);
+ if (source_id == 0)
+ source_id = loop.AddIdle(Callback, this);
#endif
}
@@ -65,9 +66,16 @@ DeferredMonitor::OnSocketReady(unsigned)
void
DeferredMonitor::Run()
{
- const auto id = source_id.exchange(0);
- if (id != 0)
- RunDeferred();
+ {
+ const ScopeLock protect(mutex);
+ if (source_id == 0)
+ /* cancelled */
+ return;
+
+ source_id = 0;
+ }
+
+ RunDeferred();
}
gboolean

View File

@ -0,0 +1,36 @@
$OpenBSD: patch-src_event_DeferredMonitor_hxx,v 1.1 2014/05/06 10:49:23 dcoppa Exp $
commit 0efb67b51e0d9d34c65bbdbd9df567a8a991cc4c
Author: Max Kellermann <max@duempel.org>
Date: Sat Apr 26 22:11:23 2014 +0200
DeferredMonitor: fix race condition when using GLib event loop
Turns out the lock-free code using atomics was not thread-safe. The
given callback could be invoked by GLib before the source_id attribute
was assigned. This commit changes the DeferredMonitor class to use
a Mutex to block the event loop until source_id is assigned. This
bug does not exist in the 0.19 branch because it does not use the
GLib main loop anymore.
--- src/event/DeferredMonitor.hxx.orig Wed Dec 11 20:51:53 2013
+++ src/event/DeferredMonitor.hxx Tue Apr 29 11:32:48 2014
@@ -27,6 +27,7 @@
#include "SocketMonitor.hxx"
#include "WakeFD.hxx"
#else
+#include "thread/Mutex.hxx"
#include <glib.h>
#endif
@@ -48,7 +49,9 @@ class DeferredMonitor
#else
EventLoop &loop;
- std::atomic<guint> source_id;
+ Mutex mutex;
+
+ guint source_id;
#endif
public:

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-src_system_ByteOrder_hxx,v 1.1 2014/05/06 10:49:23 dcoppa Exp $
--- src/system/ByteOrder.hxx.orig Tue Mar 18 23:12:51 2014
+++ src/system/ByteOrder.hxx Tue Mar 18 22:57:46 2014
@@ -42,7 +42,7 @@
# define IS_BIG_ENDIAN true
#else
/* generic compile-time check */
-# include <endian.h>
+# include <sys/endian.h>
# if __BYTE_ORDER == __LITTLE_ENDIAN
# define IS_LITTLE_ENDIAN true
# define IS_BIG_ENDIAN false