NetBSD Problem Report #45599

From www@NetBSD.org  Fri Nov 11 11:31:17 2011
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 9292163C90F
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 11 Nov 2011 11:31:17 +0000 (UTC)
Message-Id: <20111111113116.6197F63BEB2@www.NetBSD.org>
Date: Fri, 11 Nov 2011 11:31:16 +0000 (UTC)
From: noud4@home.nl
Reply-To: noud4@home.nl
To: gnats-bugs@NetBSD.org
Subject: esound bin/esddsp for NetBSD (Pidgin Festival)
X-Send-Pr-Version: www-1.0

>Number:         45599
>Category:       pkg
>Synopsis:       esound bin/esddsp for NetBSD (Pidgin Festival)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 11 11:35:00 +0000 2011
>Closed-Date:    Wed Jan 22 11:00:24 +0000 2020
>Last-Modified:  Wed Jan 22 11:00:24 +0000 2020
>Originator:     B.ICT A.P. deBROUWER Jr.
>Release:        NetBSD/i386 5.99.56
>Organization:
-none-
>Environment:
NetBSD 10.0.2.17 5.99.56 NetBSD 5.99.56 (MONOLITHIC_UGEN) #18: Mon Nov  7 16:37:44 UTC 2011  root@10.0.2.17:/obj-src/obj/sys/arch/i386/compile/MONOLITHIC_UGEN i38
>Description:
In Gnome use Pidgin and add wip/pidgin-festival.
In Pidgin sound ESD and
mv /usr/pkg/bin/esd /usr/pkg/bin/esd.orig
ln -s /usr/pkg/bin/esdcompat /usr/pkg/bin/esd
and maybe
gconftool-2 -g /system/gstreamer/0.10/default/audiosink
gconftool-2 -g /system/gstreamer/0.10/default/audiosrc
to get EsounD in PulseAudio.

Now discover we don't build bin/esddsp.
>How-To-Repeat:
see description.
>Fix:
So can we alter audio/esound patch-ac and add a patch-ba and bb.

Kinda like patch-ba to configure,
telling your platform (NetBSD) supports esddsp:

$NetBSD$

--- configure.orig	2011-11-10 20:16:31.000000000 +0000
+++ configure	2011-11-10 20:16:55.000000000 +0000
@@ -23066,7 +23066,7 @@
 { echo "$as_me:$LINENO: checking if your platform supports esddsp" >&5
 echo $ECHO_N "checking if your platform supports esddsp... $ECHO_C" >&6; }
 case "$host_os" in
-  linux* | freebsd* | kfreebsd*-gnu | bsdi4* )
+  linux* | freebsd* | kfreebsd*-gnu | netbsd* | bsdi4* )
     dsp_ok=yes
     ;;
 esac

An extension to patch-ac (patching ./esddsp.c),
conform audio/art/patches/patch-ab (patching artsc/artsdsp.c):

$NetBSD$

--- esddsp.c.orig	2008-11-18 20:35:19.000000000 +0000
+++ esddsp.c	2011-11-10 22:12:26.000000000 +0000
@@ -68,8 +68,9 @@
 #define REAL_LIBC ((void *) -1L)
 #endif

-#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__bsdi__)
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__bsdi__)
 typedef unsigned long request_t;
+typedef off_t off64_t;
 #else
 typedef int request_t;
 #endif
@@ -104,6 +105,11 @@
 #define OSS_VOL_TO_ESD_RIGHT(vol) 				\
     (ESD_VOLUME_BASE * ((vol >> 8) & 0xff) / OSS_VOLUME_BASE)

+#ifdef __NetBSD__
+typedef int (*orig_ioctl_ptr)(int fd, request_t request, ...);
+static orig_ioctl_ptr orig_ioctl;
+#endif
+
 static void
 get_volume (int *left, int *right)
 {
@@ -135,6 +141,9 @@
   pthread_mutex_lock(&mutex);
   if (!ident)
     {
+#if defined(__NetBSD__)
+      void *handle;
+#endif
       const char *str;

       str = getenv ("ESDDSP_NAME");
@@ -145,6 +154,12 @@
       str = getenv("ESDDSP_MMAP");
       mmapemu = str && !strcmp(str,"1");

+#if defined(__NetBSD__)
+ 	handle = dlopen(NULL, DL_LAZY);
+	orig_ioctl = (orig_ioctl_ptr)dlsym(handle,"ioctl");
+ 	(void) dlclose(handle);
+#endif
+
       if (getenv ("ESDDSP_MIXER"))
 	{
 	  use_mixer = 1;
@@ -621,9 +636,14 @@
 }

 int
+#ifdef __NetBSD__
+_oss_ioctl (int fd, request_t request, void *argp)
+#else
 ioctl (int fd, request_t request, ...)
+#endif
 {
   static int (*func) (int, request_t, void *) = NULL;
+#if !defined(__NetBSD__)
   va_list args;
   void *argp;

@@ -632,6 +652,7 @@
   va_start (args, request);
   argp = va_arg (args, void *);
   va_end (args);
+#endif

   if (fd == sndfd)
     return dspctl (fd, request, argp);
@@ -639,7 +660,11 @@
     if(use_mixer)
       return mixctl (fd, request, argp);
   } else { /* (fd != sndfd && fd != mixfd) */
+#ifdef __NetBSD__
+        return orig_ioctl (fd, request, argp); 
+#else
         return (*func) (fd, request, argp); 
+#endif
       }
   return 0;
 }

And a small patch-bb to get bin/esddsp going:

$NetBSD$

--- esddsp.in.orig	2008-11-18 17:33:39.000000000 +0000
+++ esddsp.in	2011-11-11 11:03:01.000000000 +0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/ksh
 # esddsp - wrapper script to allow *some* binary only programs to use esd

 # default values for script variables
@@ -107,7 +107,7 @@
 exec_prefix=@exec_prefix@

 LD_PRELOAD="libesddsp.so.@ESD_MAJOR_VERSION@ libesd.so.@ESD_MAJOR_VERSION@ $LD_PRELOAD"
-export LD_PRELOAD
+#export LD_PRELOAD

 # invoke the program with the args given
 exec "$@"

Add PLIST.NetBSD

@comment $NetBSD$
bin/esddsp
lib/libesddsp.la
man/man1/esddsp.1

Bump PKGREVISION, make mps and
now we have Pidgin working w/
wip/pidgin-festival plugin and some, not all, voices.
(And yes, i'm still puzzled why i have to outcomment LD_PRELOAD.)

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: nia@NetBSD.org
State-Changed-When: Wed, 22 Jan 2020 11:00:24 +0000
State-Changed-Why:
esd is no more



>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.