Mon Apr 7 16:10:37 2008 UTC ()
Add a moc-devel package for version 2.5.0alpha3.  This package uses
a getline() function taken from nbftp--bothering with gnulib was too
annoying.  It works for me on NetBSD-current, but please let me
know if there are any problems.

I've also extended the check for sched_get_priority_max(3)--both here
and in audio/moc--to look in librt prior to giving up.  This allows
moc to run with realtime priority on NetBSD-current; unfortunately,
presently this requires root perms.

Status:

Vendor Tag:	TNF
Release Tags:	pkgsrc-base


(bjs)
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/DESCR
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/PLIST
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/options.mk
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/distinfo
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/Makefile
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/patches/patch-aa
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/patches/patch-ab
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/patches/patch-ac
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/patches/patch-ad
diff -r0 -r1.1.1.1 pkgsrc/audio/moc-devel/files/getline.c

File Added: pkgsrc/audio/moc-devel/Attic/DESCR
MOC (music on console) is a console audio player for LINUX/UNIX
designed to be powerful and easy to use. Noteworthy features
include:

  * By default, files are decoded and played in a background
    process. This allows the user to quit the interface (e.g.,
    if one needs to close the xterm) without affecting
    playback. It also allows attaching multiple interfaces
    (e.g. in multiple xterms) to the same player.
  * Playback should be smooth even under high cpu or I/O load,
    due to the use of output buffering in a separate thread.
  * There are no sound gaps in between files, because the next
    file to be played is precached while playing the current
    file.

Note: To avoid conflicts with Qt's 'moc', the moc binary is
called 'mocp'.

File Added: pkgsrc/audio/moc-devel/Attic/PLIST
@comment $NetBSD: PLIST,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $
bin/mocp
${FLAC}lib/moc/decoder_plugins/libflac_decoder.la
lib/moc/decoder_plugins/libmp3_decoder.la
${VORBIS}lib/moc/decoder_plugins/libvorbis_decoder.la
${SNDFILE}lib/moc/decoder_plugins/libsndfile_formats_decoder.la
${SPEEX}lib/moc/decoder_plugins/libspeex_decoder.la
man/man1/mocp.1
share/doc/moc/README
share/doc/moc/THANKS
share/doc/moc/config.example
share/doc/moc/keymap.example
share/moc/themes/black_theme
share/moc/themes/darkdot_theme
share/moc/themes/example_theme
share/moc/themes/green_theme
share/moc/themes/moca_theme
share/moc/themes/nightly_theme
share/moc/themes/red_theme
share/moc/themes/transparent-background
share/moc/themes/yellow_red_theme
@dirrm share/moc/themes
@dirrm share/moc
@dirrm share/doc/moc
@dirrm lib/moc/decoder_plugins
@dirrm lib/moc

File Added: pkgsrc/audio/moc-devel/Attic/options.mk
# $NetBSD: options.mk,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $

PKG_OPTIONS_VAR=	PKG_OPTIONS.moc
PKG_SUPPORTED_OPTIONS=	sndfile flac vorbis speex curl samplerate
PKG_SUGGESTED_OPTIONS=	sndfile flac vorbis curl

.include "../../mk/bsd.options.mk"

.if !empty(PKG_OPTIONS:Msamplerate)
CONFIGURE_ARGS+=	--with-samplerate
PKG_OPTIONS+=		sndfile
.  include "../../audio/libsamplerate/buildlink3.mk"
.else
CONFIGURE_ARGS+=	--without-samplerate
.endif

.if !empty(PKG_OPTIONS:Msndfile) || !empty(PKG_OPTIONS:Msamplerate)
PLIST_SUBST+=		SNDFILE=
CONFIGURE_ARGS+=	--with-sndfile
.  include "../../audio/libsndfile/buildlink3.mk"
.else
PLIST_SUBST+=		SNDFILE='@comment '
CONFIGURE_ARGS+=	--without-sndfile
.endif

.if !empty(PKG_OPTIONS:Mflac)
PLIST_SUBST+=		FLAC=
CONFIGURE_ARGS+=	--with-flac
.  include "../../audio/flac/buildlink3.mk"
.else
PLIST_SUBST+=		FLAC='@comment '
CONFIGURE_ARGS+=	--without-flac
.endif

.if !empty(PKG_OPTIONS:Mvorbis)
PLIST_SUBST+=		VORBIS=
CONFIGURE_ARGS+=	--with-vorbis
.  include "../../audio/libvorbis/buildlink3.mk"
.else
PLIST_SUBST+=		VORBIS='@comment '
CONFIGURE_ARGS+=	--without-vorbis
.endif

.if !empty(PKG_OPTIONS:Mspeex)
PLIST_SUBST+=		SPEEX=
CONFIGURE_ARGS+=	--with-speex
.  include "../../audio/speex/buildlink3.mk"
.else
PLIST_SUBST+=		SPEEX='@comment '
CONFIGURE_ARGS+=	--without-speex
.endif

.if !empty(PKG_OPTIONS:Mcurl)
CONFIGURE_ARGS+=	--with-curl
.  include "../../www/curl/buildlink3.mk"
.else
CONFIGURE_ARGS+=	--without-curl
.endif

File Added: pkgsrc/audio/moc-devel/Attic/distinfo
$NetBSD: distinfo,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $

SHA1 (moc-2.5.0-alpha3.tar.bz2) = 59251b6239ad38f3f5ba8a1f73d1e90246765ab7
RMD160 (moc-2.5.0-alpha3.tar.bz2) = 7a603538e2080f3e182a543bc82100a09a56c2fe
Size (moc-2.5.0-alpha3.tar.bz2) = 489824 bytes
SHA1 (patch-aa) = ae4ec98da135617d5433308462a99271ed31bde3
SHA1 (patch-ab) = 750f9a75c368788cf7d6f55e2ef44d7e41d99aa4
SHA1 (patch-ac) = 6b42e7df0dc3dfeb0a7c5e5226a28b01d2fd27c7
SHA1 (patch-ad) = 5785a54e683f8c063e7b603e7cc07a33dd080590

File Added: pkgsrc/audio/moc-devel/Attic/Makefile
# $NetBSD: Makefile,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $

DISTNAME=		moc-2.5.0-alpha3
PKGNAME=		${DISTNAME:S/-alpha/./:moc%=moc-devel%}
CATEGORIES=		audio
MASTER_SITES=		ftp://ftp.daper.net/pub/soft/moc/unstable/
EXTRACT_SUFX=		.tar.bz2

MAINTAINER=		peter.schuller@infidyne.com
HOMEPAGE=		http://moc.daper.net/
COMMENT=		Curses based console audio player

PKG_DESTDIR_SUPPORT=	user-destdir

CONFLICTS=		moc-[0-9]*

GNU_CONFIGURE=		yes
USE_PKGLOCALEDIR=	yes
USE_LIBTOOL=		yes
USE_NCURSES=		yes
USE_TOOLS+=		pkg-config
#USE_TOOLS+=		autoconf automake

# We require ncurses because with curses arrow key navigation is buggy
CONFIGURE_ARGS+=	--with-ncurses

SUBST_CLASSES+=		oss
SUBST_STAGE.oss=	pre-configure
SUBST_FILES.oss=	config.example options.c
SUBST_SED.oss=		-e s,/dev/dsp,${DEVOSSAUDIO},g
SUBST_MESSAGE.oss=	Fixing hardcoded audio device.

.include "options.mk"
###
### This target is [currently] for regenerating configure to add the 
### sched_get_priority_max check of librt.
###
#pre-configure:
#	cd ${WRKSRC} && autoreconf -v -i
post-extract:
	${CP} ${FILESDIR}/getline.c ${WRKSRC}

.include "../../audio/libid3tag/buildlink3.mk"
.include "../../audio/libmad/buildlink3.mk"
.include "../../devel/gettext-lib/buildlink3.mk"
.include "../../devel/ncurses/buildlink3.mk"
.include "../../mk/oss.buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

File Added: pkgsrc/audio/moc-devel/patches/Attic/patch-aa
$NetBSD: patch-aa,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $

--- softmixer.c.orig	2008-04-06 19:57:33.000000000 -0400
+++ softmixer.c
@@ -35,6 +35,12 @@
 #include "common.h"
 #include "log.h"
 
+#ifndef getline
+#define NETBSD_GETLINE
+int     getline(FILE *, char *, size_t, const char **);
+#include "getline.c"
+#endif
+
 #define swap_32bit_endianess(i32) \
   ( ((i32&0x000000FF)<<24) | ((i32&0x0000FF00)<<8)| \
   ((i32&0x00FF0000)>>8) | ((i32&0xFF000000)>>24) ) 
@@ -147,7 +153,11 @@ void softmixer_read_config()
   int buffersize=-1, readbytes=-1;
   int tmp;
 
+#ifdef NETBSD_GETLINE
+  while((readbytes=getline(cf, linebuffer, (size_t)buffersize, (void *)NULL) > -1))
+#else
   while((readbytes=getline(&linebuffer, &buffersize, cf)>-1))
+#endif
   {
     if(
       strncasecmp

File Added: pkgsrc/audio/moc-devel/patches/Attic/patch-ab
$NetBSD: patch-ab,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $

--- configure.in.orig	2008-02-25 17:37:30.000000000 -0500
+++ configure.in
@@ -49,7 +49,10 @@ AC_CHECK_HEADERS([fcntl.h string.h strin
 		 AC_MSG_ERROR([Can't find required header files.]))
 AC_CHECK_HEADERS([sys/select.h inttypes.h limits.h stdint.h])
 
-AC_CHECK_FUNCS([sched_get_priority_max])
+AC_CHECK_FUNCS([sched_get_priority_max], ,
+	       [AC_CHECK_LIB([rt], 
+		[sched_get_priority_max], 
+		[EXTRA_LIBS="$EXTRA_LIBS -lrt"])])
 
 dnl langinfo
 AC_CHECK_HEADERS([langinfo.h])

File Added: pkgsrc/audio/moc-devel/patches/Attic/patch-ac
$NetBSD: patch-ac,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $

--- Makefile.am.orig	2007-12-15 02:38:57.000000000 -0500
+++ Makefile.am
@@ -1,4 +1,5 @@
 SUBDIRS = themes decoder_plugins
+ACLOCAL_AMFLAGS = -I m4
 AM_CPPFLAGS = -DSYSTEM_THEMES_DIR=\"$(pkgdatadir)/themes\" \
 	      -DPLUGIN_DIR=\"$(plugindir)/$(DECODER_PLUGIN_DIR)\"
 

File Added: pkgsrc/audio/moc-devel/patches/Attic/patch-ad
$NetBSD: patch-ad,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $

--- configure.orig	2008-02-25 17:38:19.000000000 -0500
+++ configure
@@ -22895,6 +22895,72 @@ if test `eval echo '${'$as_ac_var'}'` = 
 #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
 _ACEOF
 
+else
+  { echo "$as_me:$LINENO: checking for sched_get_priority_max in -lrt" >&5
+echo $ECHO_N "checking for sched_get_priority_max in -lrt... $ECHO_C" >&6; }
+if test "${ac_cv_lib_rt_sched_get_priority_max+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lrt  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any GCC internal prototype to avoid an error.
+   Use char because int might match the return type of a GCC
+   builtin and then its argument prototype would still apply.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+char sched_get_priority_max ();
+int
+main ()
+{
+return sched_get_priority_max ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+  *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+  (eval "$ac_link") 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && {
+	 test -z "$ac_c_werror_flag" ||
+	 test ! -s conftest.err
+       } && test -s conftest$ac_exeext &&
+       $as_test_x conftest$ac_exeext; then
+  ac_cv_lib_rt_sched_get_priority_max=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+	ac_cv_lib_rt_sched_get_priority_max=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_rt_sched_get_priority_max" >&5
+echo "${ECHO_T}$ac_cv_lib_rt_sched_get_priority_max" >&6; }
+if test $ac_cv_lib_rt_sched_get_priority_max = yes; then
+  EXTRA_LIBS="$EXTRA_LIBS -lrt"
+fi
+
 fi
 done
 

File Added: pkgsrc/audio/moc-devel/files/Attic/getline.c
/* 	$NetBSD: getline.c,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $ */
/*	$NetBSD: getline.c,v 1.1.1.1 2008/04/07 16:10:37 bjs Exp $	*/

/*-
 * Copyright (c) 1997-2007 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Luke Mewburn.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
 * NASA Ames Research Center.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the NetBSD
 *	Foundation, Inc. and its contributors.
 * 4. Neither the name of The NetBSD Foundation nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include <stdio.h>

/* Read a line from the FILE stream into buf/buflen using fgets(), so up
 * to buflen-1 chars will be read and the result will be NUL terminated.
 * If the line has a trailing newline it will be removed.
 * If the line is too long, excess characters will be read until
 * newline/EOF/error.
 * If EOF/error occurs or a too-long line is encountered and errormsg
 * isn't NULL, it will be changed to a description of the problem.
 * (The EOF message has a leading \n for cosmetic purposes).
 * Returns:
 *	>=0	length of line (excluding trailing newline) if all ok
 *	-1	error occurred
 *	-2	EOF encountered
 *	-3	line was too long
 */
int
getline(FILE *stream, char *buf, size_t buflen, const char **errormsg)
{
	int	rv, ch;
	size_t	len;

	if (fgets(buf, buflen, stream) == NULL) {
		if (feof(stream)) {	/* EOF */
			rv = -2;
			if (errormsg)
				*errormsg = "\nEOF received";
		} else  {		/* error */
			rv = -1;
			if (errormsg)
				*errormsg = "Error encountered";
		}
		clearerr(stream);
		return rv;
	}
	len = strlen(buf);
	if (buf[len-1] == '\n') {	/* clear any trailing newline */
		buf[--len] = '\0';
	} else if (len == buflen-1) {	/* line too long */
		while ((ch = getchar()) != '\n' && ch != EOF)
			continue;
		if (errormsg)
			*errormsg = "Input line is too long";
		clearerr(stream);
		return -3;
	}
	if (errormsg)
		*errormsg = NULL;
	return len;
}