diff options
author | ryoon <ryoon> | 2013-01-06 00:59:46 +0000 |
---|---|---|
committer | ryoon <ryoon> | 2013-01-06 00:59:46 +0000 |
commit | 1c45cfd8169b4fa48513bdef0914d99923cc6024 (patch) | |
tree | 30070882fa4a7ebc3cbd04523f26641e67914892 /games/plib | |
parent | 7a45dc777b203afceaec1fb5f38d376b11f569d6 (diff) | |
download | pkgsrc-1c45cfd8169b4fa48513bdef0914d99923cc6024.tar.gz |
Fix build on OpenBSD/amd64 5.2.
The patches are taken from OpenBSD ports repository.
* Disable joystick on OpenBSD/!i386
* Use sndio on OpenBSD
Diffstat (limited to 'games/plib')
-rw-r--r-- | games/plib/distinfo | 10 | ||||
-rw-r--r-- | games/plib/patches/patch-aa | 30 | ||||
-rw-r--r-- | games/plib/patches/patch-ab | 145 | ||||
-rw-r--r-- | games/plib/patches/patch-ad | 39 | ||||
-rw-r--r-- | games/plib/patches/patch-ae | 33 |
5 files changed, 237 insertions, 20 deletions
diff --git a/games/plib/distinfo b/games/plib/distinfo index fb30e2cac97..02682cdc404 100644 --- a/games/plib/distinfo +++ b/games/plib/distinfo @@ -1,11 +1,11 @@ -$NetBSD: distinfo,v 1.12 2011/12/22 18:21:38 drochner Exp $ +$NetBSD: distinfo,v 1.13 2013/01/06 00:59:46 ryoon Exp $ SHA1 (plib-1.8.5.tar.gz) = c2cf7e3e1e58f7b63dae4bb21e4fa82c3e4d4cfc RMD160 (plib-1.8.5.tar.gz) = 55019bf3758ec2542804d8e3994f4bed5a188e60 Size (plib-1.8.5.tar.gz) = 779133 bytes -SHA1 (patch-aa) = 35cd38d57f15144d659a19458a2b1c00983fb4b2 -SHA1 (patch-ab) = 3976dcf78e8ba44d55d08e67ddf3fa7f23def91e -SHA1 (patch-ad) = 1ec59b079a662bfc9b5ea5fa03686292ac05659f -SHA1 (patch-ae) = ae69e86642c53ef32619d6411809f80ab973b208 +SHA1 (patch-aa) = 6a9e3badb63de5b9b100805fa7151ce5db8ced69 +SHA1 (patch-ab) = 1bb0950b08427f8bcef84ee2da1cfd231ca60385 +SHA1 (patch-ad) = bc79c088939d7dffdd2b63610c3cf9d494a92699 +SHA1 (patch-ae) = fe166e1b3b5d150d3d83bad49e2576d9ebaa0fb7 SHA1 (patch-af) = ea774a54a3cff4d43abae164bbcae745d4642aea SHA1 (patch-ag) = d715adee05f8e6973a5883f74573cc39bfd8d72e diff --git a/games/plib/patches/patch-aa b/games/plib/patches/patch-aa index 5aa747d9154..a58fef62565 100644 --- a/games/plib/patches/patch-aa +++ b/games/plib/patches/patch-aa @@ -1,7 +1,16 @@ -$NetBSD: patch-aa,v 1.7 2008/03/14 14:38:46 drochner Exp $ +$NetBSD: patch-aa,v 1.8 2013/01/06 00:59:47 ryoon Exp $ ---- src/sl/slPortability.h.orig 2008-03-11 03:06:24.000000000 +0100 +--- src/sl/slPortability.h.orig Tue Mar 11 02:06:24 2008 +++ src/sl/slPortability.h +@@ -51,7 +51,7 @@ + #include <limits.h> + #include <math.h> + +-#if (defined(UL_LINUX) || defined(UL_BSD)) && !defined(__NetBSD__) ++#if (defined(UL_LINUX) || defined(UL_BSD)) && !defined(__NetBSD__) && !defined(__OpenBSD__) + #define SL_USING_OSS_AUDIO 1 + #endif + @@ -59,7 +59,7 @@ # if defined(UL_LINUX) # include <linux/soundcard.h> @@ -11,12 +20,21 @@ $NetBSD: patch-aa,v 1.7 2008/03/14 14:38:46 drochner Exp $ # include <sys/soundcard.h> # else /* -@@ -75,7 +75,7 @@ +@@ -75,9 +75,14 @@ #endif #ifdef UL_BSD -#ifndef __FreeBSD__ -+#if !defined(__FreeBSD__) && !defined(__DragonFly__) - # include <sys/audioio.h> - #endif +-# include <sys/audioio.h> +-#endif ++# if defined(__OpenBSD__) ++# define SL_USING_SNDIO ++# include <sndio.h> ++# else ++# if !defined(__FreeBSD__) || !defined(__DragonFly__) ++# include <sys/audioio.h> ++# endif ++# endif #endif + + /* Tom */ diff --git a/games/plib/patches/patch-ab b/games/plib/patches/patch-ab index 0f3bb7db003..91a30cef7a8 100644 --- a/games/plib/patches/patch-ab +++ b/games/plib/patches/patch-ab @@ -1,13 +1,152 @@ -$NetBSD: patch-ab,v 1.7 2007/09/16 09:25:03 joerg Exp $ +$NetBSD: patch-ab,v 1.8 2013/01/06 00:59:47 ryoon Exp $ ---- src/sl/slDSP.cxx.orig 2007-09-16 08:55:07.000000000 +0000 +--- src/sl/slDSP.cxx.orig Tue Mar 11 02:06:24 2008 +++ src/sl/slDSP.cxx @@ -413,7 +413,7 @@ void slDSP::stop () /* NetBSD/OpenBSD 2.3 this should be very close to SUN Audio */ /* ------------------------------------------------------------ */ -#elif (defined(UL_BSD) && !defined(__FreeBSD__)) || defined(UL_SOLARIS) -+#elif (defined(UL_BSD) && !defined(__FreeBSD__) &&!defined(__DragonFly__)) || defined(UL_SOLARIS) ++#elif (defined(UL_BSD) && !defined(SL_USING_SNDIO) && !defined(__FreeBSD__) && !defined(__DragonFly__)) || defined(UL_SOLARIS) void slDSP::open ( const char *device, int _rate, int _stereo, int _bps ) { +@@ -1082,4 +1082,138 @@ float slDSP::secondsUsed () + + #endif + ++#if defined(SL_USING_SNDIO) + ++#include <poll.h> ++ ++static long long realpos, playpos; ++ ++void ++movecb(void *v, int delta) ++{ ++ realpos += delta; ++} ++ ++void ++slDSP::open(const char *device, int _rate, int _stereo, int _bps ) ++{ ++ error = SL_FALSE; ++ ++ if (!strncmp(device, "default", FILENAME_MAX)) ++ hdl = sio_open(NULL, SIO_PLAY, 0); ++ else ++ hdl = sio_open(device, SIO_PLAY, 0); ++ if (hdl == NULL) { ++ error = SL_TRUE; ++ fprintf(stderr, "slDSP: open\n"); ++ return; ++ } ++ ++ sio_initpar(&par); ++ par.pchan = _stereo ? 2 : 1; ++ par.bits = _bps; ++ par.rate = _rate; ++ par.appbufsz = 4096; ++ ++ realpos = playpos = 0; ++ sio_onmove(hdl, movecb, NULL); ++ ++ if (!sio_setpar(hdl, &par) || !sio_getpar(hdl, &par) || ++ !sio_start(hdl)) { ++ fprintf(stderr, "slDSP: sndio params\n"); ++ error = SL_TRUE; ++ return; ++ } ++ ++ bps = par.bits; ++ rate = par.rate; ++ stereo = par.pchan == 2 ? SL_TRUE : SL_FALSE; ++} ++ ++void ++slDSP::close() ++{ ++ if (hdl != NULL) ++ sio_close(hdl); ++ hdl = NULL; ++} ++ ++int ++slDSP::getDriverBufferSize() ++{ ++ if (error) ++ return 0; ++ ++ return par.round * par.bps * par.pchan; ++} ++ ++void ++slDSP::getBufferInfo() ++{ ++ struct pollfd pfd; ++ nfds_t nfd; ++ ++ if (error) ++ return; ++ ++ /* updates counters */ ++ nfd = sio_pollfd(hdl, &pfd, POLLOUT); ++ poll(&pfd, nfd, 0); ++ sio_revents(hdl, &pfd); ++} ++ ++void ++slDSP::write(void *buffer, size_t length) ++{ ++ int ret, todo, pos; ++ ++ if (error || (int)length <= 0) ++ return; ++ ++ pos = 0; ++ todo = length; ++ while (todo > 0) { ++ ret = sio_write(hdl, (char *)buffer + pos, todo); ++ pos += ret; ++ todo -= ret; ++ } ++ playpos += length / par.bps / par.pchan; ++} ++ ++float ++slDSP::secondsRemaining() ++{ ++ if (error) ++ return 0.0f; ++ ++ getBufferInfo(); ++ ++ /* wtf? tuxkart won't play sounds if less ??? */ ++ return 0.1f; ++ return((float)(par.appbufsz - (playpos - realpos)) / par.rate); ++} ++ ++float ++slDSP::secondsUsed() ++{ ++ if (error) ++ return 0.0f ; ++ ++ getBufferInfo(); ++ ++ if (realpos > playpos) ++ return 0.0f; ++ ++ return((float)(playpos - realpos) / par.rate); ++} ++ ++void ++slDSP::sync() ++{ ++} ++ ++void slDSP::stop() ++{ ++} ++ ++#endif diff --git a/games/plib/patches/patch-ad b/games/plib/patches/patch-ad index 8c6eec5d62c..932a38512a6 100644 --- a/games/plib/patches/patch-ad +++ b/games/plib/patches/patch-ad @@ -1,8 +1,14 @@ -$NetBSD: patch-ad,v 1.6 2007/07/12 19:48:42 drochner Exp $ +$NetBSD: patch-ad,v 1.7 2013/01/06 00:59:47 ryoon Exp $ ---- src/js/jsBSD.cxx.orig 2007-03-22 23:35:44.000000000 +0100 +--- src/js/jsBSD.cxx.orig Tue Mar 11 02:06:21 2008 +++ src/js/jsBSD.cxx -@@ -52,11 +52,8 @@ +@@ -49,16 +49,13 @@ + #include <sys/ioctl.h> + #if defined(__FreeBSD__) + # include <sys/joystick.h> +-#else ++#elif (defined(__OpenBSD__) && defined(__i386__)) || defined(__NetBSD__) || defined(__DragonFly__) + # include <machine/joystick.h> // For analog joysticks #endif #ifdef HAVE_USB_JS #if defined(__NetBSD__) @@ -15,3 +21,30 @@ $NetBSD: patch-ad,v 1.6 2007/07/12 19:48:42 drochner Exp $ #elif defined(__FreeBSD__) extern "C" { # if __FreeBSD_version < 500000 +@@ -85,7 +82,9 @@ struct os_specific_s { + int fd; + int is_analog; + // The following structure members are specific to analog joysticks ++#if (defined(__OpenBSD__) && defined(__i386__)) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) + struct joystick ajs; ++#endif + #ifdef HAVE_USB_JS + // The following structure members are specific to USB joysticks + struct hid_item *hids; +@@ -437,7 +436,7 @@ void jsJoystick::rawRead ( int *buttons, float *axes ) + + return ; + } +- ++#if (defined(__OpenBSD__) && defined(__i386__)) || defined(__NetBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) + if ( os->is_analog ) + { + int status = ::read ( os->fd, &os->ajs, sizeof(os->ajs) ); +@@ -462,6 +461,7 @@ void jsJoystick::rawRead ( int *buttons, float *axes ) + + return; + } ++#endif + + #ifdef HAVE_USB_JS + while ((len = ::read(os->fd, os->hid_data_buf, os->hid_dlen)) == os->hid_dlen) diff --git a/games/plib/patches/patch-ae b/games/plib/patches/patch-ae index 642b4a91424..04e834055d8 100644 --- a/games/plib/patches/patch-ae +++ b/games/plib/patches/patch-ae @@ -1,8 +1,8 @@ -$NetBSD: patch-ae,v 1.3 2007/07/12 19:48:42 drochner Exp $ +$NetBSD: patch-ae,v 1.4 2013/01/06 00:59:47 ryoon Exp $ ---- src/sl/sl.h.orig 2007-03-22 23:38:18.000000000 +0100 +--- src/sl/sl.h.orig Tue Mar 11 02:06:24 2008 +++ src/sl/sl.h -@@ -26,6 +26,7 @@ +@@ -26,12 +26,15 @@ #define __SL_H__ 1 #include <stdio.h> @@ -10,3 +10,30 @@ $NetBSD: patch-ae,v 1.3 2007/07/12 19:48:42 drochner Exp $ #include "slPortability.h" #ifdef SL_USING_OSS_AUDIO + #define SLDSP_DEFAULT_DEVICE "/dev/dsp" + #elif defined(UL_WIN32) + #define SLDSP_DEFAULT_DEVICE "dsp" ++#elif defined(SL_USING_SNDIO) ++#define SLDSP_DEFAULT_DEVICE "default" + #elif defined(UL_BSD) + #define SLDSP_DEFAULT_DEVICE "/dev/audio" + #elif defined(UL_IRIX) +@@ -78,6 +81,9 @@ class slDSP (private) + + #if defined(SL_USING_OSS_AUDIO) + audio_buf_info buff_info ; ++#elif defined(SL_USING_SNDIO) ++ struct sio_hdl *hdl; ++ struct sio_par par; + #elif defined(UL_BSD) + audio_info_t ainfo; // ioctl structure + audio_offset_t audio_offset; // offset in audiostream +@@ -120,7 +126,7 @@ class slDSP (private) + #endif + + +-#if !defined(UL_WIN32) && !defined(UL_MACINTOSH) && !defined(UL_MAC_OSX) ++#if !defined(UL_WIN32) && !defined(UL_MACINTOSH) && !defined(UL_MAC_OSX) && !defined(SL_USING_SNDIO) + int ioctl ( int cmd, int param = 0 ) + { + if ( error ) return param ; |