Subject: pkg/9066:
To: None <gnats-bugs@gnats.netbsd.org>
From: Richard Rauch <rkr@rkr.kcnet.com>
List: netbsd-bugs
Date: 12/28/1999 05:42:49
>Number:         9066
>Category:       pkg
>Synopsis:       
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager (NetBSD software packages system bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Dec 28 05:42:00 1999
>Last-Modified:
>Originator:     Richard Rauch
>Organization:
(n/a)
>Release:        NetBSD/i386 1.4.1, xdoom-1.10
>Environment:
System: NetBSD rkr.kcnet.com 1.4.1 NetBSD 1.4.1 (olibGENERIC) #3: Tue Nov 30 01:09:25 CST 1999 root@rkr.kcnet.com:/usr/src/sys/arch/i386/compile/olibGENERIC i386


>Description:
	The current package tries to use /dev/dsp (a LINUXism, I suppose).  It
	does not exist on a stock NetBSD system, so XDoom fails to run on a stock
	system.
>How-To-Repeat:
	Attempt to build/play XDoom on any [i386?] NetBSD system which doesn't have
	a /dev/dsp.
	$ ls /dev/dsp
	ls: /dev/dsp: No such file or directory
	$ cd /usr/pkgsrc/games/xdoom
	$ make install
	$ xdoom
>Fix:
	A workaround is probably to just create a /dev/dsp that is identical with
	either /dev/sound0 or /dev/audio0.

	A slightly better fix is to modify XDoom to look in the right spot in the
	first place.  A patch follows, to be applied AFTER XDoom is patched for
	NetBSD.  (Well, technically, a diff follows; I'm not sure if it can be
	directly applied as a patch...)  For convenience, I stuck the old version
	into an RCS ,v file, modified, and then used ``rcsdiff -c ...'' to generate
	the diff.  Have a hoopy day.


rcsdiff -c linux.c
===================================================================
RCS file: RCS/linux.c,v
retrieving revision 1.1
diff -c -r1.1 linux.c
*** linux.c     1999/12/28 11:55:26     1.1
--- linux.c     1999/12/28 12:06:00
***************
*** 48,53 ****
--- 48,55 ----
  
  #include "soundsrv.h"
  
+ #define SOUND_DEV "/dev/sound0"
+ 
  int   audio_fd;
  
  void
***************
*** 62,68 ****
      rc = ioctl(fd, command, arg);  
      if (rc < 0)
      {
!       fprintf(stderr, "ioctl(dsp,%d,arg) failed\n", command);
        fprintf(stderr, "errno=%d\n", errno);
        exit(-1);
      }
--- 64,70 ----
      rc = ioctl(fd, command, arg);  
      if (rc < 0)
      {
!       fprintf(stderr, "ioctl(" SOUND_DEV ",%d,arg) failed\n", command);
        fprintf(stderr, "errno=%d\n", errno);
        exit(-1);
      }
***************
*** 80,88 ****
  
      int i;
                  
!     audio_fd = open("/dev/dsp", O_WRONLY);
      if (audio_fd<0)
!         fprintf(stderr, "Could not open /dev/dsp\n");
           
                       
      i = 11 | (2<<16);                                           
--- 82,90 ----
  
      int i;
                  
!     audio_fd = open(SOUND_DEV, O_WRONLY);
      if (audio_fd<0)
!         fprintf(stderr, "Could not open " SOUND_DEV "\n");
           
                       
      i = 11 | (2<<16);                                           
>Audit-Trail:
>Unformatted: