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

Bug#690993: unblock: libmikmod/3.1.12-4.1



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

Please consider:
	unblock libmikmod/3.1.12-4.1

libmikmod (3.1.12-4.1) unstable; urgency=low

  * Non-maintainer upload (acknowledged by maintainer).
  * Apply patches from Hans de Goede and Pantelis Koukousoulas to enable
    the ESD driver, so we can interoperate with PulseAudio (Closes: #385844)
  * Recommend pulseaudio-esound-compat | oss-compat because if we don't have
    one of those, the fallback path is to write output to ./music.raw, which
    is unlikely to be what you want!

 -- Simon McVittie <smcv@debian.org>  Fri, 19 Oct 2012 22:05:18 +0100
diffstat for libmikmod-3.1.12 libmikmod-3.1.12

 changelog                                          |   11 
 control                                            |    4 
 patches/0011-Disable-ALSA-by-default.patch         |   31 ++
 patches/0011-Disable-ESD-and-ALSA-by-default.patch |   38 ---
 patches/0012-fix-ESD.patch                         |  259 +++++++++++++++++++++
 patches/0013-fix-building-of-ESD.patch             |  133 ++++++++++
 patches/series                                     |    4 
 rules                                              |    2 
 8 files changed, 440 insertions(+), 42 deletions(-)

diff -Nru libmikmod-3.1.12/debian/changelog libmikmod-3.1.12/debian/changelog
--- libmikmod-3.1.12/debian/changelog	2012-04-05 17:31:57.000000000 +0100
+++ libmikmod-3.1.12/debian/changelog	2012-10-19 22:06:31.000000000 +0100
@@ -1,3 +1,14 @@
+libmikmod (3.1.12-4.1) unstable; urgency=low
+
+  * Non-maintainer upload (acknowledged by maintainer).
+  * Apply patches from Hans de Goede and Pantelis Koukousoulas to enable
+    the ESD driver, so we can interoperate with PulseAudio (Closes: #385844)
+  * Recommend pulseaudio-esound-compat | oss-compat because if we don't have
+    one of those, the fallback path is to write output to ./music.raw, which
+    is unlikely to be what you want!
+
+ -- Simon McVittie <smcv@debian.org>  Fri, 19 Oct 2012 22:05:18 +0100
+
 libmikmod (3.1.12-4) unstable; urgency=low
 
   * Drop the dependency on oss-compat. Programs that use libmikmod should
diff -Nru libmikmod-3.1.12/debian/control libmikmod-3.1.12/debian/control
--- libmikmod-3.1.12/debian/control	2012-04-05 17:28:36.000000000 +0100
+++ libmikmod-3.1.12/debian/control	2012-10-19 22:04:43.000000000 +0100
@@ -2,7 +2,7 @@
 Section: libs
 Priority: optional
 Maintainer: Gergely Nagy <algernon@madhouse-project.org>
-Build-Depends: debhelper (>= 9~), dh-autoreconf, texinfo
+Build-Depends: debhelper (>= 9~), dh-autoreconf, texinfo, libesd0-dev
 Standards-Version: 3.9.3
 Homepage: http://mikmod.raphnet.net/
 Vcs-Git: git://git.madhouse-project.org/debian/libmikmod.git
@@ -32,7 +32,7 @@
 Multi-Arch: same
 Pre-Depends: ${misc:Pre-Depends}
 Depends: ${shlibs:Depends}, ${misc:Depends}
-Suggests: oss-compat
+Recommends: pulseaudio-esound-compat | oss-compat
 Description: Portable sound library
  This library is capable of playing samples as well as module
  files and was originally written by Jean-Paul Mikkers (MikMak) for DOS. It has
diff -Nru libmikmod-3.1.12/debian/patches/0011-Disable-ALSA-by-default.patch libmikmod-3.1.12/debian/patches/0011-Disable-ALSA-by-default.patch
--- libmikmod-3.1.12/debian/patches/0011-Disable-ALSA-by-default.patch	1970-01-01 01:00:00.000000000 +0100
+++ libmikmod-3.1.12/debian/patches/0011-Disable-ALSA-by-default.patch	2012-10-19 09:11:45.000000000 +0100
@@ -0,0 +1,31 @@
+From: Pantelis Koukousoulas <pktoss@gmail.com>
+Date: Sun, 9 Sep 2012 11:54:09 +0300
+Subject: Disable ALSA by default
+
+Based on a patch from Gergely Nagy who writes:
+
+> The configure script is broken in many, many ways, so it's best to
+> just disable ESD and ALSA in the beginning..
+
+but reduced to just disabling ALSA, since we want to use the ESD protocol
+to talk to PulseAudio's ESD emulation.
+
+[commit message added -smcv]
+Reviewed-by: Simon McVittie <smcv@debian.org>
+---
+ configure.in |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.in b/configure.in
+index 3f8b6b6..2a6a86c 100644
+--- a/configure.in
++++ b/configure.in
+@@ -22,7 +22,7 @@ AM_MAINTAINER_MODE
+ 
+ libmikmod_driver_af=yes
+ libmikmod_driver_aix=no
+-libmikmod_driver_alsa=yes
++libmikmod_driver_alsa=no
+ libmikmod_driver_esd=yes
+ libmikmod_driver_hp=no
+ libmikmod_driver_oss=yes
diff -Nru libmikmod-3.1.12/debian/patches/0011-Disable-ESD-and-ALSA-by-default.patch libmikmod-3.1.12/debian/patches/0011-Disable-ESD-and-ALSA-by-default.patch
--- libmikmod-3.1.12/debian/patches/0011-Disable-ESD-and-ALSA-by-default.patch	2012-02-09 09:16:09.000000000 +0000
+++ libmikmod-3.1.12/debian/patches/0011-Disable-ESD-and-ALSA-by-default.patch	1970-01-01 01:00:00.000000000 +0100
@@ -1,38 +0,0 @@
-From: Gergely Nagy <algernon@madhouse-project.org>
-Date: Sat, 29 Oct 2011 17:19:05 +0200
-Subject: Disable ESD and ALSA by default.
-
-The configure script is broken in many, many ways, so it's best to
-just disable ESD and ALSA in the beginning..
-
-Also disable AM_PATH_ESD, because we're not going to build with it
-anyway.
----
- configure.in |    6 +++---
- 1 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/configure.in b/configure.in
-index 3f8b6b6..0d70250 100644
---- a/configure.in
-+++ b/configure.in
-@@ -22,8 +22,8 @@ AM_MAINTAINER_MODE
- 
- libmikmod_driver_af=yes
- libmikmod_driver_aix=no
--libmikmod_driver_alsa=yes
--libmikmod_driver_esd=yes
-+libmikmod_driver_alsa=no
-+libmikmod_driver_esd=no
- libmikmod_driver_hp=no
- libmikmod_driver_oss=yes
- libmikmod_driver_sam9407=yes
-@@ -271,7 +271,7 @@ fi
- if test $libmikmod_driver_esd = yes
- then
- 	libmikmod_driver_esd=no
--	AM_PATH_ESD(0.2.6,libmikmod_driver_esd=yes)
-+	dnl AM_PATH_ESD(0.2.6,libmikmod_driver_esd=yes)
- # We also need to know if esd is compiled with alsa support
- 	if test $libmikmod_driver_esd = yes
- 	then
--- 
diff -Nru libmikmod-3.1.12/debian/patches/0012-fix-ESD.patch libmikmod-3.1.12/debian/patches/0012-fix-ESD.patch
--- libmikmod-3.1.12/debian/patches/0012-fix-ESD.patch	1970-01-01 01:00:00.000000000 +0100
+++ libmikmod-3.1.12/debian/patches/0012-fix-ESD.patch	2012-10-19 09:11:45.000000000 +0100
@@ -0,0 +1,259 @@
+From: Pantelis Koukousoulas <pktoss@gmail.com>
+Date: Sun, 9 Sep 2012 11:54:09 +0300
+Subject: fix ESD
+
+This patch comes from Fedora and was written by Hans de Goede.
+I 've only slightly adapted it for debian.
+---
+ drivers/drv_esd.c |  164 +++++++++++++++++++++++++++++++++++++++++++----------
+ 1 file changed, 133 insertions(+), 31 deletions(-)
+
+diff --git a/drivers/drv_esd.c b/drivers/drv_esd.c
+index 5fee86c..601a2e9 100644
+--- a/drivers/drv_esd.c
++++ b/drivers/drv_esd.c
+@@ -81,7 +81,6 @@ static void* libesd=NULL;
+ 
+ static	int sndfd=-1;
+ static	esd_format_t format;
+-static	SBYTE *audiobuffer=NULL;
+ static	CHAR *espeaker=NULL;
+ 
+ #ifdef MIKMOD_DYNAMIC
+@@ -124,23 +123,89 @@ static void ESD_Unlink(void)
+ }
+ #endif
+ 
++/* A simple chunk fifo buffer, as we cannot query to ask how much free space
++   there is with esd, we keep a fifo filled and try to write the entire fifo
++   non blocking, stopping when we get -EAGAIN */
++
++#define AUDIO_BUF_SIZE (ESD_BUF_SIZE * 4)
++
++static SBYTE audiobuffer[AUDIO_BUF_SIZE];
++static int audiobuffer_start, audiobuffer_end, audiobuffer_empty;
++
++static void audiobuffer_init(void)
++{
++	audiobuffer_empty = 1;
++	audiobuffer_start = audiobuffer_end = 0;
++}
++
++/* Get a free chunk of the fifo, the caller is expected to use all of it, so
++   all of it gets marked filled */
++static SBYTE *audiobuffer_get_free_chunk(int *size)
++{
++	int end = audiobuffer_end;
++
++	if (audiobuffer_empty)
++	{
++		audiobuffer_empty = 0;
++		*size = AUDIO_BUF_SIZE;
++	}
++	else if (audiobuffer_end > audiobuffer_start)
++	{
++		*size = AUDIO_BUF_SIZE - audiobuffer_end;
++		audiobuffer_end = 0;
++	}
++	else
++	{
++		*size = audiobuffer_start - audiobuffer_end;
++		audiobuffer_end = audiobuffer_start;
++	}
++
++	return audiobuffer + end;
++}
++
++/* Get a filled chunk from the fifo, the caller must call audiobuffer_mark_free
++   to tell the fifo how much of the chunk it has consumed */
++static SBYTE *audiobuffer_get_filled_chunk(int *size)
++{
++	if (audiobuffer_empty)
++	{
++		*size = 0;
++	}
++	else if (audiobuffer_end > audiobuffer_start)
++	{
++		*size = audiobuffer_end - audiobuffer_start;
++	}
++	else
++	{
++		*size = AUDIO_BUF_SIZE - audiobuffer_start;
++	}
++
++	return audiobuffer + audiobuffer_start;
++}
++
++/* Tell the fifo to mark size bytes as free starting from the current head of
++   the fifo */
++static void audiobuffer_mark_free(int size)
++{
++	audiobuffer_start = (audiobuffer_start + size) % AUDIO_BUF_SIZE;
++	if (audiobuffer_start == audiobuffer_end)
++	{
++		audiobuffer_empty = 1;
++		audiobuffer_start = audiobuffer_end = 0;
++	}
++}
++
++
+ /* I hope to have this function integrated into libesd someday...*/
+ static ssize_t esd_writebuf(int fd,const void *buffer,size_t count)
+ {
+-	ssize_t start=0;
+-
+-	while (start<count) {
+-		ssize_t res;
+-
+-		res=write(fd,(char*)buffer+start,count-start);
+-		if (res<0) {
+-			/* connection lost */
+-			if (errno==EPIPE)
+-				return -1-start;
+-		} else
+-			start+=res;
+-	}
+-	return start;
++	ssize_t res;
++
++	res = write(fd, (char*)buffer, count);
++	if (res < 0 && errno == EAGAIN)
++		return 0;
++
++	return res;
+ }
+ 
+ static void ESD_CommandLine(CHAR *cmdline)
+@@ -193,13 +258,14 @@ static BOOL ESD_Init_internal(void)
+ 			_mm_errno=MMERR_OPENING_AUDIO;
+ 			return 1;
+ 		}
++		fcntl(sndfd, F_SETFL, fcntl(sndfd, F_GETFL) | O_NONBLOCK);
+ 	} else {
+ 		_mm_errno=MMERR_OUT_OF_MEMORY;
+ 		return 1;
+ 	}
+ 
+-	if (!(audiobuffer=(SBYTE*)_mm_malloc(ESD_BUF_SIZE*sizeof(char))))
+-		return 1;
++	/* Initialize the audiobuffer */
++	audiobuffer_init();
+ 
+ 	return VC_Init();
+ }
+@@ -218,7 +284,6 @@ static BOOL ESD_Init(void)
+ static void ESD_Exit_internal(void)
+ {
+ 	VC_Exit();
+-	_mm_free(audiobuffer);
+ 	if (sndfd>=0) {
+ 		esd_closestream(sndfd);
+ 		sndfd=-1;
+@@ -234,18 +299,49 @@ static void ESD_Exit(void)
+ #endif
+ }
+ 
+-static void ESD_Update_internal(int count)
++typedef ULONG (*VC_WriteBytesFunc)(SBYTE*, ULONG);
++
++static void ESD_Update_internal(VC_WriteBytesFunc WriteBytes)
+ {
+ 	static time_t losttime;
+ 
+ 	if (sndfd>=0) {
+-		if (esd_writebuf(sndfd,audiobuffer,count)<0) {
+-			/* if we lost our connection with esd, clean up and work as the
+-			   nosound driver until we can reconnect */
+-			esd_closestream(sndfd);
+-			sndfd=-1;
+-			signal(SIGPIPE,SIG_DFL);
+-			losttime=time(NULL);
++		SBYTE *chunk;
++		int size;
++		ssize_t written;
++
++		/* Fill fifo */
++		chunk = audiobuffer_get_free_chunk(&size);
++		while (size)
++		{
++			WriteBytes(chunk, size);
++			chunk = audiobuffer_get_free_chunk(&size);
++		}
++
++		/* And write untill fifo empty, or we would block */
++		chunk = audiobuffer_get_filled_chunk(&size);
++		while (size)
++		{
++			written = esd_writebuf(sndfd, chunk, size);
++			if (written < 0)
++			{
++				/* if we lost our connection with esd, clean up
++				   and work as the nosound driver until we can
++				   reconnect */
++				esd_closestream(sndfd);
++				sndfd = -1;
++				signal(SIGPIPE, SIG_DFL);
++				losttime = time(NULL);
++				break;
++			}
++
++			/* Stop if the buffer is full */
++			if (written == 0)
++				break;
++
++			audiobuffer_mark_free(written);
++
++			chunk = audiobuffer_get_filled_chunk(&size);
+ 		}
+ 	} else {
+ 		/* an alarm would be better, but then the library user could not use
+@@ -255,8 +351,11 @@ static void ESD_Update_internal(int count)
+ 			/* Attempt to reconnect every 5 seconds */
+ 			if (!(SETENV))
+ 				if ((sndfd=esd_playstream(format,md_mixfreq,espeaker,"libmikmod"))>=0) {
+-					VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE);
+-					esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
++					/* reconnected, clear fifo (contains old sound) and recurse
++					   to play sound */
++					audiobuffer_init();
++					fcntl(sndfd, F_SETFL, fcntl(sndfd, F_GETFL) | O_NONBLOCK);
++					ESD_Update_internal(WriteBytes);
+ 				}
+ 		}
+ 	}
+@@ -264,22 +363,24 @@ static void ESD_Update_internal(int count)
+ 
+ static void ESD_Update(void)
+ {
+-	ESD_Update_internal(VC_WriteBytes(audiobuffer,ESD_BUF_SIZE));
++	ESD_Update_internal(VC_WriteBytes);
+ }
+ 
+ static void ESD_Pause(void)
+ {
+-	ESD_Update_internal(VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE));
++	ESD_Update_internal(VC_SilenceBytes);
+ }
+ 
+ static BOOL ESD_PlayStart(void)
+ {
+ 	if (sndfd<0)
+-		if (!(SETENV))
++		if (!(SETENV)) {
+ 			if ((sndfd=esd_playstream(format,md_mixfreq,espeaker,"libmikmod"))<0) {
+ 				_mm_errno=MMERR_OPENING_AUDIO;
+ 				return 1;
+ 			}
++			fcntl(sndfd, F_SETFL, fcntl(sndfd, F_GETFL) | O_NONBLOCK);
++		}
+ 	/* since the default behaviour of SIGPIPE on most Unices is to kill the
+ 	   program, we'll prefer handle EPIPE ourselves should the esd die - recent
+ 	   esdlib use a do-nothing handler, which prevents us from receiving EPIPE,
+@@ -289,6 +390,7 @@ static BOOL ESD_PlayStart(void)
+ 	/* silence buffers */
+ 	VC_SilenceBytes(audiobuffer,ESD_BUF_SIZE);
+ 	esd_writebuf(sndfd,audiobuffer,ESD_BUF_SIZE);
++	audiobuffer_init();
+ 
+ 	return VC_PlayStart();
+ }
diff -Nru libmikmod-3.1.12/debian/patches/0013-fix-building-of-ESD.patch libmikmod-3.1.12/debian/patches/0013-fix-building-of-ESD.patch
--- libmikmod-3.1.12/debian/patches/0013-fix-building-of-ESD.patch	1970-01-01 01:00:00.000000000 +0100
+++ libmikmod-3.1.12/debian/patches/0013-fix-building-of-ESD.patch	2012-10-19 09:11:45.000000000 +0100
@@ -0,0 +1,133 @@
+From: Pantelis Koukousoulas <pktoss@gmail.com>
+Date: Sun, 9 Sep 2012 11:54:09 +0300
+Subject: fix building of ESD
+
+---
+ configure.in |   86 ++++------------------------------------------------------
+ 1 file changed, 6 insertions(+), 80 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index 2a6a86c..26c74e7 100644
+--- a/configure.in
++++ b/configure.in
+@@ -62,15 +62,6 @@ else
+   libmikmod_driver_alsa=no
+ fi])
+ 
+-AC_ARG_ENABLE(esd,
+-[  --enable-esd            include Enlightened sound daemon driver [guessed]],
+-[if test "$enableval" = "yes"
+-then
+-  libmikmod_driver_esd=yes
+-else
+-  libmikmod_driver_esd=no
+-fi])
+-
+ AC_ARG_ENABLE(oss,
+ [  --enable-oss            include OSS driver [guessed]],
+ [if test "$enableval" = "yes"
+@@ -266,27 +257,6 @@ else
+ 	libmikmod_driver_alsa=no
+ fi
+ 
+-# esd
+-# ---
+-if test $libmikmod_driver_esd = yes
+-then
+-	libmikmod_driver_esd=no
+-	AM_PATH_ESD(0.2.6,libmikmod_driver_esd=yes)
+-# We also need to know if esd is compiled with alsa support
+-	if test $libmikmod_driver_esd = yes
+-	then
+-		AC_CACHE_CHECK([if esd requires alsa],libmikmod_cv_esd_needs_alsa,
+-		if (esd-config --libs 2>&1 |grep asound >/dev/null) 2>/dev/null
+-		then
+-			libmikmod_cv_esd_needs_alsa=yes
+-		else
+-			libmikmod_cv_esd_needs_alsa=no
+-		fi)
+-	else
+-		libmikmod_cv_esd_needs_alsa=no
+-	fi
+-fi
+-
+ # sgi audio - IRIX only
+ # ---------------------
+ case `uname` in
+@@ -456,23 +426,6 @@ then
+ 	fi
+ fi
+ 
+-if test $libmikmod_driver_esd = yes
+-then
+-	libmikmod_driverlist="$libmikmod_driverlist esd"
+-	AC_DEFINE(DRV_ESD)
+-	CFLAGS="$CFLAGS $ESD_CFLAGS"
+-
+-	# Under Solaris and perhaps other systems, we have to forward esd
+-	# dependencies to libmikmod's dependency list.
+-	# However, no need to keep libraries we won't require (libossaudio on BSD
+-	# systems, libaudiofile, libasound on Linux)
+-	if test $libmikmod_dynload != no
+-	then
+-		ESD_LIBS="`echo $ESD_LIBS|sed -e 's/-lesd//'|sed -e 's/-lasound//'|sed -e 's/-laudiofile//'|sed -e 's/-lossaudio//'`"
+-	fi
+-	LIBRARY_LIB="$ESD_LIBS $LIBRARY_LIB"
+-fi
+-
+ if test $libmikmod_driver_hp = yes
+ then
+ 	libmikmod_driverlist="hp $libmikmod_driverlist"
+@@ -508,6 +461,12 @@ then
+ 	fi
+ fi
+ 
++if test $libmikmod_driver_esd = yes
++then
++	libmikmod_driverlist="esd $libmikmod_driverlist"
++	AC_DEFINE(DRV_ESD)
++fi
++
+ if test $libmikmod_driver_sam9407 = yes
+ then
+ 	libmikmod_driverlist="sam9407 $libmikmod_driverlist"
+@@ -545,39 +504,6 @@ fi
+ if test $libmikmod_dynload != no
+ then
+ 	AC_DEFINE(MIKMOD_DYNAMIC)
+-	if test "`uname`" = "Linux" && \
+-	   test $libmikmod_cv_esd_needs_alsa = yes && \
+-	   test $libmikmod_driver_esd = yes
+-	then
+-		# @#!$ libmikmod_dynloading esd requires us to define and make visible
+-		# extra symbols (at least for 0.2.6 to 0.2.8)
+-		AC_CACHE_CHECK([if libmikmod_dynloading esd causes problems],
+-		libmikmod_cv_esd_broken,
+-		libmikmod_oldlibs=$LIBS
+-		LIBS="$LIBS $ESD_LIBS"
+-		AC_TRY_LINK([
+-#include <esd.h>
+-extern void *handle;],
+-		[void *p = handle;],
+-		libmikmod_cv_esd_broken=no,libmikmod_cv_esd_broken=yes)
+-		LIBS=$libmikmod_oldlibs)
+-		if test $libmikmod_cv_esd_broken = yes
+-		then
+-			AC_DEFINE(MIKMOD_DYNAMIC_ESD_NEEDS_ALSA)
+-			LIB_LDADD="$LIB_LDADD -rdynamic"
+-			echo "
+-*** This means your version of EsounD defines some public symbols,
+-*** which should have been defined static or weak. The compiled
+-*** libmikmod will try to take care of the problem, but you'll have to
+-*** use the '-rdynamic' option when linking an application which uses
+-*** libmikmod with gcc. If you use another compiler, or -rdynamic is not
+-*** available on your platform, you might not be able to use libmikmod's
+-*** EsounD driver.
+-*** In this case, consider recompiling libmikmod specifying
+-*** '--disable-dl' in the configure script options.
+-" >&2
+-		fi
+-	fi
+ 
+ 	LIBRARY_LIB="$libmikmod_dllib $LIBRARY_LIB"
+ 	if test $libmikmod_dynload = sun
diff -Nru libmikmod-3.1.12/debian/patches/series libmikmod-3.1.12/debian/patches/series
--- libmikmod-3.1.12/debian/patches/series	2012-02-09 09:16:09.000000000 +0000
+++ libmikmod-3.1.12/debian/patches/series	2012-10-19 09:11:45.000000000 +0100
@@ -8,4 +8,6 @@
 0008-Fix-libmikmod-Makefile.in.patch
 0009-libmikmod-Makefile.in-Respect-CPPFLAGS-and-LDFLAGS.patch
 0010-libmikmod-config-manual-page-fix.patch
-0011-Disable-ESD-and-ALSA-by-default.patch
+0011-Disable-ALSA-by-default.patch
+0012-fix-ESD.patch
+0013-fix-building-of-ESD.patch
diff -Nru libmikmod-3.1.12/debian/rules libmikmod-3.1.12/debian/rules
--- libmikmod-3.1.12/debian/rules	2012-02-09 09:12:53.000000000 +0000
+++ libmikmod-3.1.12/debian/rules	2012-10-19 09:13:38.000000000 +0100
@@ -6,7 +6,7 @@
 	dh_auto_configure -- \
 		--enable-threads \
 		--disable-alsa \
-		--disable-esd \
+		--enable-esd \
 		$(shell dpkg-buildflags --export=configure)
 
 override_dh_installinfo:

Reply to: