SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

79
devel/sdl/Makefile Normal file
View file

@ -0,0 +1,79 @@
COMMENT= cross-platform multimedia library
VERSION= 1.2.15
DISTNAME= SDL-${VERSION}
PKGNAME= ${DISTNAME:L}
REVISION= 12
CATEGORIES= devel
MAINTAINER= Thomas Frohwein <thfr@openbsd.org>
MASTER_SITES= ${HOMEPAGE}release/
SHARED_LIBS= SDL 8.0
HOMEPAGE= https://www.libsdl.org/
# LGPLv2.1+
PERMIT_PACKAGE= Yes
WANTLIB= iconv m pthread sndio usbhid
LIB_DEPENDS= converters/libiconv
AUTOCONF_VERSION= 2.61
BUILD_DEPENDS+= ${MODGNU_AUTOCONF_DEPENDS}
.if ${MACHINE_ARCH} == "i386"
BUILD_DEPENDS+= devel/nasm
.endif
FLAVORS= aa no_x11
FLAVOR?=
USE_GMAKE= Yes
SEPARATE_BUILD= Yes
CONFIGURE_STYLE= gnu
MODGNU_CONFIG_GUESS_DIRS= ${WRKSRC} ${WRKSRC}/test
CONFIGURE_ARGS+= --disable-alsa \
--disable-arts \
--disable-esd \
--disable-oss \
--disable-pulseaudio
CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" \
LDFLAGS="-L${LOCALBASE}/lib"
# in case devel/usb is installed, don't pick it up.
CONFIGURE_ENV+= ac_cv_lib_usb_hid_init=no \
ac_cv_header_usb_h=no
.if ${FLAVOR:Maa}
WANTLIB+= aa
LIB_DEPENDS+= graphics/aalib
CONFIGURE_ARGS+= --enable-video-aalib
.endif
.if ${FLAVOR:Mno_x11}
CONFIGURE_ARGS+= --without-x \
--disable-video-x11
.else
#
# X11/Xext/Xrender/Xrandr are dlopen'd by SDL
#
WANTLIB+= X11 Xau Xdmcp Xext Xrandr Xrender xcb
.endif
NO_TEST= Yes
# The assembly code contains AltiVec instructions, whose support is not
# properly detected at runtime. Fix SIGILLs on macppc G3s, while keeping
# it for powerpc64.
.if ${MACHINE_ARCH} == "powerpc"
CONFIGURE_ARGS+= --enable-altivec=no
.endif
pre-configure:
@mkdir -p ${WRKSRC}/src/audio/sndio
@cp ${FILESDIR}/SDL_sndioaudio.{c,h} ${WRKSRC}/src/audio/sndio
@cd ${WRKSRC} && AUTOCONF_VERSION=${AUTOCONF_VERSION} PATH=${PORTPATH} \
./autogen.sh
.include <bsd.port.mk>

2
devel/sdl/distinfo Normal file
View file

@ -0,0 +1,2 @@
SHA256 (SDL-1.2.15.tar.gz) = 1tMWp5Pl40gVXw3ZO5eXmJM/uYqh7evMEIgp1kdKrQA=
SIZE (SDL-1.2.15.tar.gz) = 3920622

View file

@ -0,0 +1,243 @@
/*
* Copyright (c) 2008 Jacob Meuser <jakemsr@sdf.lonestar.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "SDL_config.h"
/* Allow access to a raw mixing buffer */
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <unistd.h>
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "../SDL_audiomem.h"
#include "../SDL_audio_c.h"
#include "../SDL_audiodev_c.h"
#include "SDL_sndioaudio.h"
/* The tag name used by sndio audio */
#define SNDIO_DRIVER_NAME "sndio"
/* Audio driver functions */
static int SNDIO_OpenAudio(_THIS, SDL_AudioSpec *spec);
static void SNDIO_WaitAudio(_THIS);
static void SNDIO_PlayAudio(_THIS);
static Uint8 *SNDIO_GetAudioBuf(_THIS);
static void SNDIO_CloseAudio(_THIS);
/* Audio driver bootstrap functions */
static int Audio_Available(void)
{
struct sio_hdl *this_hdl;
int available = 0;
if ( (this_hdl = sio_open(SIO_DEVANY, SIO_PLAY, 0)) != NULL ) {
sio_close(this_hdl);
available = 1;
}
return available;
}
static void Audio_DeleteDevice(SDL_AudioDevice *device)
{
SDL_free(device->hidden);
SDL_free(device);
}
static SDL_AudioDevice *Audio_CreateDevice(int devindex)
{
SDL_AudioDevice *this;
/* Initialize all variables that we clean on shutdown */
this = (SDL_AudioDevice *)SDL_malloc(sizeof(SDL_AudioDevice));
if ( this ) {
SDL_memset(this, 0, (sizeof *this));
this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden));
}
if ( (this == NULL) || (this->hidden == NULL) ) {
SDL_OutOfMemory();
if ( this ) {
SDL_free(this);
}
return(0);
}
SDL_memset(this->hidden, 0, (sizeof *this->hidden));
/* Set the function pointers */
this->OpenAudio = SNDIO_OpenAudio;
this->WaitAudio = SNDIO_WaitAudio;
this->PlayAudio = SNDIO_PlayAudio;
this->GetAudioBuf = SNDIO_GetAudioBuf;
this->CloseAudio = SNDIO_CloseAudio;
this->free = Audio_DeleteDevice;
hdl = NULL;
return this;
}
AudioBootStrap SNDIO_bootstrap = {
SNDIO_DRIVER_NAME, "sndio",
Audio_Available, Audio_CreateDevice
};
/* This function waits until it is possible to write a full sound buffer */
static void SNDIO_WaitAudio(_THIS)
{
/* nothing, we're using the blocking api */
}
static void SNDIO_PlayAudio(_THIS)
{
int written;
/* Write the audio data */
written = sio_write(hdl, mixbuf, mixlen);
/* If we couldn't write, assume fatal error for now */
if ( written == 0 ) {
this->enabled = 0;
}
#ifdef DEBUG_AUDIO
fprintf(stderr, "Wrote %d bytes of audio data\n", written);
#endif
}
static Uint8 *SNDIO_GetAudioBuf(_THIS)
{
return(mixbuf);
}
static void SNDIO_CloseAudio(_THIS)
{
if ( mixbuf != NULL ) {
SDL_FreeAudioMem(mixbuf);
mixbuf = NULL;
}
if ( hdl != NULL ) {
sio_close(hdl);
hdl = NULL;
}
}
static int SNDIO_OpenAudio(_THIS, SDL_AudioSpec *spec)
{
struct sio_par par;
mixbuf = NULL;
if ((hdl = sio_open(NULL, SIO_PLAY, 0)) == NULL) {
SDL_SetError("sio_open() failed");
return(-1);
}
sio_initpar(&par);
switch (spec->format) {
case AUDIO_S16LSB:
par.bits = 16;
par.sig = 1;
par.le = 1;
break;
case AUDIO_S16MSB:
par.bits = 16;
par.sig = 1;
par.le = 0;
break;
case AUDIO_S8:
par.bits = 8;
par.sig = 1;
break;
case AUDIO_U16LSB:
par.bits = 16;
par.sig = 0;
par.le = 1;
break;
case AUDIO_U16MSB:
par.bits = 16;
par.sig = 0;
par.le = 0;
break;
case AUDIO_U8:
par.bits = 8;
par.sig = 0;
break;
default:
SDL_SetError("SNDIO unknown format");
return(-1);
}
par.rate = spec->freq;
par.pchan = spec->channels;
par.round = spec->samples;
par.appbufsz = par.round * 2;
if (sio_setpar(hdl, &par) == 0) {
SDL_SetError("sio_setpar() failed");
return(-1);
}
if (sio_getpar(hdl, &par) == 0) {
SDL_SetError("sio_getpar() failed");
return(-1);
}
if (par.bits == 16) {
if (par.sig && par.le) {
spec->format = AUDIO_S16LSB;
} else if (par.sig && !par.le) {
spec->format = AUDIO_S16MSB;
} else if (!par.sig && par.le) {
spec->format = AUDIO_U16LSB;
} else
spec->format = AUDIO_U16MSB;
} else if (par.bits == 8) {
spec->format = par.sig ? AUDIO_S8 : AUDIO_U8;
} else {
SDL_SetError("SNDIO couldn't configure a suitable format");
return(-1);
}
spec->freq = par.rate;
spec->channels = par.pchan;
spec->samples = par.round;
SDL_CalculateAudioSpec(spec);
/* Allocate mixing buffer */
mixlen = spec->size;
mixbuf = (Uint8 *)SDL_AllocAudioMem(mixlen);
if ( mixbuf == NULL ) {
return(-1);
}
SDL_memset(mixbuf, spec->silence, spec->size);
if ( sio_start(hdl) == 0 ) {
SDL_SetError("sio_start() failed");
return(-1);
}
/* We're ready to rock and roll. :-) */
return(0);
}

View file

@ -0,0 +1,50 @@
/*
* Copyright (c) 2008 Jacob Meuser <jakemsr@sdf.lonestar.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "SDL_config.h"
#ifndef _SDL_sndioaudio_h
#define _SDL_sndioaudio_h
#include <sndio.h>
#include "../SDL_sysaudio.h"
/* Hidden "this" pointer for the video functions */
#define _THIS SDL_AudioDevice *this
struct SDL_PrivateAudioData {
/* The stream descriptor for the audio device */
struct sio_hdl *hdl;
/* The parent process id, to detect when application quits */
pid_t parent;
/* Raw mixing buffer */
Uint8 *mixbuf;
int mixlen;
};
/* Old variable names */
#define stream (this->hidden->stream)
#define parent (this->hidden->parent)
#define mixbuf (this->hidden->mixbuf)
#define mixlen (this->hidden->mixlen)
#define hdl (this->hidden->hdl)
#endif /* _SDL_sndioaudio_h */

View file

@ -0,0 +1,11 @@
--- Makefile.in.orig Thu Jan 19 01:30:05 2012
+++ Makefile.in Wed Feb 22 13:39:54 2012
@@ -49,7 +49,7 @@ LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@
-LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
+LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)
all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET)

View file

@ -0,0 +1,88 @@
--- configure.in.orig Thu Jan 19 01:30:05 2012
+++ configure.in Thu Dec 5 14:41:54 2013
@@ -486,6 +486,35 @@ AC_HELP_STRING([--enable-esd-shared], [dynamically loa
fi
}
+dnl Find Sndio
+CheckSndio()
+{
+ AC_ARG_ENABLE(sndio,
+AC_HELP_STRING([--enable-sndio], [support the sndio audio API [[default=yes]]]),
+ , enable_sndioaudio=yes)
+ if test x$enable_audio = xyes -a x$enable_sndioaudio = xyes; then
+ AC_CHECK_HEADER(sndio.h, have_sndio_hdr=yes)
+ AC_CHECK_LIB(sndio, sio_open, have_sndio_lib=yes)
+
+ AC_MSG_CHECKING(for sndio support)
+ have_sndio=no
+
+ if test x$have_sndio_hdr = xyes -a x$have_sndio_lib = xyes; then
+ have_sndio=yes
+ SNDIO_LIBS="-lsndio"
+ fi
+
+ AC_MSG_RESULT($have_sndio)
+
+ if test x$have_sndio = xyes; then
+ AC_DEFINE(SDL_AUDIO_DRIVER_SNDIO)
+ SOURCES="$SOURCES $srcdir/src/audio/sndio/*.c"
+ EXTRA_LDFLAGS="$EXTRA_LDFLAGS $SNDIO_LIBS"
+ have_audio=yes
+ fi
+ fi
+}
+
dnl Find PulseAudio
CheckPulseAudio()
{
@@ -860,8 +889,8 @@ CheckVisibilityHidden()
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS $visibility_CFLAGS -Werror"
AC_TRY_COMPILE([
- #if !defined(__GNUC__) || __GNUC__ < 4
- #error SDL only uses visibility attributes in GCC 4 or newer
+ #if !defined(__GNUC__) || __GNUC__ < 3
+ #error SDL only uses visibility attributes in GCC 3 or newer
#endif
],[
],[
@@ -1005,6 +1034,12 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically loa
x11_lib='libX11.so'
x11ext_lib='libXext.so'
;;
+ *-*-openbsd*)
+ x11_lib='libX11.so'
+ x11ext_lib='libXext.so'
+ xrender_lib='libXrender.so'
+ xrandr_lib='libXrandr.so'
+ ;;
*)
x11_lib=[`find_lib "libX11.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
x11ext_lib=[`find_lib "libXext.so.*" "$X_LIBS -L/usr/X11/$base_libdir -L/usr/X11R6/$base_libdir" | sed 's/.*\/\(.*\)/\1/; q'`]
@@ -1034,7 +1069,7 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically loa
fi
if test x$x11_symbols_private != xyes && \
test x$enable_x11_shared = xyes; then
- AC_MSG_WARN([You must have gcc4 (-fvisibility=hidden) for dynamic X11 loading])
+ AC_MSG_WARN([You must have gcc3 (-fvisibility=hidden) for dynamic X11 loading])
enable_x11_shared=no
fi
@@ -2358,6 +2393,7 @@ case "$host" in
CheckALSA
CheckARTSC
CheckESD
+ CheckSndio
CheckPulseAudio
CheckNAS
CheckX11
@@ -2390,7 +2426,7 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/audio/sun/*.c"
have_audio=yes
;;
- netbsd|openbsd)
+ netbsd)
AC_DEFINE(SDL_AUDIO_DRIVER_BSD)
SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c"
have_audio=yes

View file

@ -0,0 +1,10 @@
--- include/SDL_config.h.in.orig Thu Jan 19 01:30:05 2012
+++ include/SDL_config.h.in Wed Feb 22 13:39:54 2012
@@ -184,6 +184,7 @@
#undef SDL_AUDIO_DRIVER_QNXNTO
#undef SDL_AUDIO_DRIVER_SNDMGR
#undef SDL_AUDIO_DRIVER_SUNAUDIO
+#undef SDL_AUDIO_DRIVER_SNDIO
#undef SDL_AUDIO_DRIVER_WAVEOUT
/* Enable various cdrom drivers */

View file

@ -0,0 +1,28 @@
Index: include/SDL_opengl.h
--- include/SDL_opengl.h.orig
+++ include/SDL_opengl.h
@@ -35,7 +35,12 @@
#endif
#ifndef NO_SDL_GLEXT
#define __glext_h_ /* Don't let gl.h include glext.h */
+#define __gl_glext_h_ /* Don't let gl.h include glext.h */
+#ifndef GL_ARB_shader_objects
+#define GL_ARB_shader_objects 0
+#define undef_GL_ARB
#endif
+#endif
#if defined(__MACOSX__)
#include <OpenGL/gl.h> /* Header File For The OpenGL Library */
#include <OpenGL/glu.h> /* Header File For The GLU Library */
@@ -48,6 +53,11 @@
#endif
#ifndef NO_SDL_GLEXT
#undef __glext_h_
+#undef __gl_glext_h_
+#ifdef undef_GL_ARB
+#undef GL_ARB_shader_objects
+#undef undef_GL_ARB
+#endif
#endif
/** @name GLext.h

View file

@ -0,0 +1,11 @@
--- include/begin_code.h.orig Tue Jan 15 19:09:01 2013
+++ include/begin_code.h Tue Jan 15 19:09:45 2013
@@ -77,7 +77,7 @@
# define DECLSPEC
# endif
# else
-# if defined(__GNUC__) && __GNUC__ >= 4
+# if defined(__GNUC__) && __GNUC__ >= 3
# define DECLSPEC __attribute__ ((visibility("default")))
# else
# define DECLSPEC

View file

@ -0,0 +1,15 @@
--- sdl-config.in.orig Sun Dec 30 20:48:39 2007
+++ sdl-config.in Tue Mar 18 20:33:17 2008
@@ -42,10 +42,10 @@ while test $# -gt 0; do
echo @SDL_VERSION@
;;
--cflags)
- echo -I@includedir@/SDL @SDL_CFLAGS@
+ echo -I@includedir@ -I@includedir@/SDL @SDL_CFLAGS@ @X_CFLAGS@
;;
@ENABLE_SHARED_TRUE@ --libs)
-@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@
+@ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@ @X_LIBS@
@ENABLE_SHARED_TRUE@ ;;
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@ --static-libs)
@ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@ --libs|--static-libs)

View file

@ -0,0 +1,11 @@
--- sdl.pc.in.orig Mon Oct 12 19:07:20 2009
+++ sdl.pc.in Sat Nov 7 13:30:12 2009
@@ -10,6 +10,5 @@ Description: Simple DirectMedia Layer is a cross-platf
Version: @SDL_VERSION@
Requires:
Conflicts:
-Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@
-Libs.private: @SDL_STATIC_LIBS@
-Cflags: -I${includedir}/SDL @SDL_CFLAGS@
+Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @X_LIBS@
+Cflags: -I${includedir}/SDL @SDL_CFLAGS@ @X_CFLAGS@

View file

@ -0,0 +1,18 @@
--- src/audio/SDL_audio.c.orig Thu Jan 19 01:30:06 2012
+++ src/audio/SDL_audio.c Wed Feb 22 13:41:58 2012
@@ -36,11 +36,15 @@
/* Available audio drivers */
static AudioBootStrap *bootstrap[] = {
+
#if SDL_AUDIO_DRIVER_PULSE
&PULSE_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_ALSA
&ALSA_bootstrap,
+#endif
+#if SDL_AUDIO_DRIVER_SNDIO
+ &SNDIO_bootstrap,
#endif
#if SDL_AUDIO_DRIVER_BSD
&BSD_AUDIO_bootstrap,

View file

@ -0,0 +1,12 @@
--- src/audio/SDL_sysaudio.h.orig Thu Jan 19 01:30:06 2012
+++ src/audio/SDL_sysaudio.h Wed Feb 22 13:39:54 2012
@@ -105,6 +105,9 @@ typedef struct AudioBootStrap {
#if SDL_AUDIO_DRIVER_BSD
extern AudioBootStrap BSD_AUDIO_bootstrap;
#endif
+#if SDL_AUDIO_DRIVER_SNDIO
+extern AudioBootStrap SNDIO_bootstrap;
+#endif
#if SDL_AUDIO_DRIVER_PULSE
extern AudioBootStrap PULSE_bootstrap;
#endif

View file

@ -0,0 +1,37 @@
--- src/cpuinfo/SDL_cpuinfo.c.orig Thu Jan 19 01:30:06 2012
+++ src/cpuinfo/SDL_cpuinfo.c Fri Feb 24 16:08:00 2012
@@ -28,6 +28,10 @@
#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
#include <sys/sysctl.h> /* For AltiVec check */
+#elif defined(__OpenBSD__) && defined(__powerpc__)
+#include <sys/param.h>
+#include <sys/sysctl.h> /* For AltiVec check */
+#include <machine/cpu.h>
#elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
#include <signal.h>
#include <setjmp.h>
@@ -42,7 +46,7 @@
#define CPU_HAS_SSE2 0x00000080
#define CPU_HAS_ALTIVEC 0x00000100
-#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__
+#if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__
/* This is the brute force way of detecting instruction sets...
the idea is borrowed from the libmpeg2 library - thanks!
*/
@@ -359,8 +363,12 @@ static __inline__ int CPU_haveSSE2(void)
static __inline__ int CPU_haveAltiVec(void)
{
volatile int altivec = 0;
-#if defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))
- int selectors[2] = { CTL_HW, HW_VECTORUNIT };
+#if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
+# ifdef __OpenBSD__
+ int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
+# else
+ int selectors[2] = { CTL_HW, HW_VECTORUNIT };
+# endif
int hasVectorUnit = 0;
size_t length = sizeof(hasVectorUnit);
int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);

View file

@ -0,0 +1,24 @@
It is easy to exhaust uhid devices in this day and age.
use ujoy(4) device nodes
Index: src/joystick/bsd/SDL_sysjoystick.c
--- src/joystick/bsd/SDL_sysjoystick.c.orig
+++ src/joystick/bsd/SDL_sysjoystick.c
@@ -77,7 +77,7 @@
#include "../SDL_sysjoystick.h"
#include "../SDL_joystick_c.h"
-#define MAX_UHID_JOYS 4
+#define MAX_UHID_JOYS 16
#define MAX_JOY_JOYS 2
#define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
@@ -170,7 +170,7 @@ SDL_SYS_JoystickInit(void)
for (i = 0; i < MAX_UHID_JOYS; i++) {
SDL_Joystick nj;
- SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i);
+ SDL_snprintf(s, SDL_arraysize(s), "/dev/ujoy/%d", i);
nj.index = SDL_numjoysticks;
joynames[nj.index] = strdup(s);

View file

@ -0,0 +1,22 @@
Fixed bug 1426 - SDL_SemWaitTimeout returns -1 and sets error instead of
SDL_MUTEX_TIMEDOUT on time out
--- src/thread/pthread/SDL_syssem.c.orig Fri Mar 2 04:42:50 2012
+++ src/thread/pthread/SDL_syssem.c Fri Mar 2 04:44:23 2012
@@ -144,8 +144,14 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout)
retval = sem_timedwait(&sem->sem, &ts_timeout);
while (retval == -1 && errno == EINTR);
- if (retval == -1)
- SDL_SetError(strerror(errno));
+ if (retval == -1) {
+ if (errno == ETIMEDOUT) {
+ retval = SDL_MUTEX_TIMEDOUT;
+ }
+ else {
+ SDL_SetError(strerror(errno));
+ }
+ }
#else
end = SDL_GetTicks() + timeout;
while ((retval = SDL_SemTryWait(sem)) == SDL_MUTEX_TIMEDOUT) {

View file

@ -0,0 +1,59 @@
- Fixed bug 1424 - Handling of alpha channel in Altivec accelerated blit functions
- Use fast path for RGB 565 -> 32-bit XRGB 8888
--- src/video/SDL_blit_N.c.orig Thu Jan 19 01:30:06 2012
+++ src/video/SDL_blit_N.c Thu Oct 25 21:57:48 2012
@@ -689,6 +689,8 @@ static void ConvertAltivec32to32_noprefetch(SDL_BlitIn
while ((UNALIGNED_PTR(dst)) && (width)) {
bits = *(src++);
RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
+ if(!srcfmt->Amask)
+ a = srcfmt->alpha;
*(dst++) = MAKE8888(dstfmt, r, g, b, a);
width--;
}
@@ -716,6 +718,8 @@ static void ConvertAltivec32to32_noprefetch(SDL_BlitIn
while (extrawidth) {
bits = *(src++); /* max 7 pixels, don't bother with prefetch. */
RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
+ if(!srcfmt->Amask)
+ a = srcfmt->alpha;
*(dst++) = MAKE8888(dstfmt, r, g, b, a);
extrawidth--;
}
@@ -769,6 +773,8 @@ static void ConvertAltivec32to32_prefetch(SDL_BlitInfo
vec_dstst(dst+scalar_dst_lead, DST_CTRL(2,32,1024), DST_CHAN_DEST);
bits = *(src++);
RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
+ if(!srcfmt->Amask)
+ a = srcfmt->alpha;
*(dst++) = MAKE8888(dstfmt, r, g, b, a);
width--;
}
@@ -798,6 +804,8 @@ static void ConvertAltivec32to32_prefetch(SDL_BlitInfo
while (extrawidth) {
bits = *(src++); /* max 7 pixels, don't bother with prefetch. */
RGBA_FROM_8888(bits, srcfmt, r, g, b, a);
+ if(!srcfmt->Amask)
+ a = srcfmt->alpha;
*(dst++) = MAKE8888(dstfmt, r, g, b, a);
extrawidth--;
}
@@ -2299,13 +2307,13 @@ static const struct blit_table normal_blit_2[] = {
2, NULL, Blit_RGB555_32Altivec, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
#endif
{ 0x0000F800,0x000007E0,0x0000001F, 4, 0x00FF0000,0x0000FF00,0x000000FF,
- 0, NULL, Blit_RGB565_ARGB8888, SET_ALPHA },
+ 0, NULL, Blit_RGB565_ARGB8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
{ 0x0000F800,0x000007E0,0x0000001F, 4, 0x000000FF,0x0000FF00,0x00FF0000,
- 0, NULL, Blit_RGB565_ABGR8888, SET_ALPHA },
+ 0, NULL, Blit_RGB565_ABGR8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
{ 0x0000F800,0x000007E0,0x0000001F, 4, 0xFF000000,0x00FF0000,0x0000FF00,
- 0, NULL, Blit_RGB565_RGBA8888, SET_ALPHA },
+ 0, NULL, Blit_RGB565_RGBA8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
{ 0x0000F800,0x000007E0,0x0000001F, 4, 0x0000FF00,0x00FF0000,0xFF000000,
- 0, NULL, Blit_RGB565_BGRA8888, SET_ALPHA },
+ 0, NULL, Blit_RGB565_BGRA8888, NO_ALPHA | COPY_ALPHA | SET_ALPHA },
/* Default for 16-bit RGB source, used if no other blitter matches */
{ 0,0,0, 0, 0,0,0, 0, NULL, BlitNtoN, 0 }

View file

@ -0,0 +1,28 @@
Fixed bug 1390 - X11_KeyToUnicode
--- src/video/x11/SDL_x11events.c.orig Wed Feb 22 19:31:47 2012
+++ src/video/x11/SDL_x11events.c Wed Feb 22 19:33:27 2012
@@ -1246,14 +1246,23 @@ static void get_modifier_masks(Display *display)
* sequences (dead accents, compose key sequences) will not work since the
* state has been irrevocably lost.
*/
+extern DECLSPEC Uint16 SDLCALL X11_KeyToUnicode(SDLKey, SDLMod);
+
Uint16 X11_KeyToUnicode(SDLKey keysym, SDLMod modifiers)
{
+ static int warning = 0;
struct SDL_VideoDevice *this = current_video;
char keybuf[32];
int i;
KeySym xsym = 0;
XKeyEvent xkey;
Uint16 unicode;
+
+ if ( warning ) {
+ warning = 0;
+ fprintf(stderr, "WARNING: Application is using X11_KeyToUnicode().\n");
+ fprintf(stderr, "This is not an official SDL function, please report this as a bug.\n");
+ }
if ( !this || !SDL_Display ) {
return 0;

View file

@ -0,0 +1,11 @@
--- src/video/x11/SDL_x11gl.c.orig Thu Jan 19 01:30:06 2012
+++ src/video/x11/SDL_x11gl.c Wed Feb 22 13:39:54 2012
@@ -34,7 +34,7 @@
#elif defined(__QNXNTO__)
#define DEFAULT_OPENGL "libGL.so.3"
#elif defined(__OpenBSD__)
-#define DEFAULT_OPENGL "libGL.so.4.0"
+#define DEFAULT_OPENGL "libGL.so"
#else
#define DEFAULT_OPENGL "libGL.so.1"
#endif

View file

@ -0,0 +1,11 @@
--- src/video/x11/SDL_x11sym.h.orig Tue Apr 30 00:39:44 2013
+++ src/video/x11/SDL_x11sym.h Tue Apr 30 00:40:30 2013
@@ -165,7 +165,7 @@ SDL_X11_SYM(Bool,XShmQueryExtension,(Display* a),(a),r
*/
#ifdef LONG64
SDL_X11_MODULE(IO_32BIT)
-SDL_X11_SYM(int,_XData32,(Display *dpy,register long *data,unsigned len),(dpy,data,len),return)
+SDL_X11_SYM(int,_XData32,(Display *dpy,register const long *data,unsigned len),(dpy,data,len),return)
SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),)
#endif

View file

@ -0,0 +1,29 @@
Fixed bug 1427 - integer passed to XChangeProperty() causes crash
--- src/video/x11/SDL_x11video.c.orig Wed Feb 22 19:34:11 2012
+++ src/video/x11/SDL_x11video.c Wed Feb 22 19:36:25 2012
@@ -418,16 +418,21 @@ static void create_aux_windows(_THIS)
}
{
- pid_t pid = getpid();
+ union align_pid {
+ pid_t pid;
+ long dummy;
+ } a_pid;
char hostname[256];
- if (pid > 0 && gethostname(hostname, sizeof(hostname)) > -1) {
+ a_pid.pid = getpid();
+
+ if (a_pid.pid > 0 && gethostname(hostname, sizeof(hostname)) > -1) {
Atom _NET_WM_PID = XInternAtom(SDL_Display, "_NET_WM_PID", False);
Atom WM_CLIENT_MACHINE = XInternAtom(SDL_Display, "WM_CLIENT_MACHINE", False);
hostname[sizeof(hostname)-1] = '\0';
XChangeProperty(SDL_Display, WMwindow, _NET_WM_PID, XA_CARDINAL, 32,
- PropModeReplace, (unsigned char *)&pid, 1);
+ PropModeReplace, (unsigned char *)&a_pid.pid, 1);
XChangeProperty(SDL_Display, WMwindow, WM_CLIENT_MACHINE, XA_STRING, 8,
PropModeReplace, (unsigned char *)hostname, SDL_strlen(hostname));
}

View file

@ -0,0 +1,94 @@
Use _NET_WM_ICON if possible for X11's SDL_WM_SetIcon() implementation.
--- src/video/x11/SDL_x11wm.c.orig Thu Oct 25 21:58:52 2012
+++ src/video/x11/SDL_x11wm.c Thu Oct 25 22:01:06 2012
@@ -43,6 +43,7 @@ static Uint8 reverse_byte(Uint8 x)
void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask)
{
+ Atom _NET_WM_ICON = XInternAtom(SDL_Display, "_NET_WM_ICON", False);
SDL_Surface *sicon;
XWMHints *wmhints;
XImage *icon_image;
@@ -59,6 +60,81 @@ void X11_SetIcon(_THIS, SDL_Surface *icon, Uint8 *mask
int masksize;
SDL_Lock_EventThread();
+
+ if (_NET_WM_ICON) { /* better interface for modern systems. */
+ SDL_PixelFormat format;
+ SDL_Surface *surface;
+ int propsize;
+ long *propdata;
+
+ /* Convert the icon to ARGB for modern window managers */
+ SDL_memset(&format, 0, sizeof (format));
+ format.BitsPerPixel = 32;
+ format.BytesPerPixel = 4;
+ #if SDL_BYTEORDER == SDL_BIG_ENDIAN
+ format.Rshift = 8;
+ format.Gshift = 16;
+ format.Bshift = 24;
+ format.Ashift = 0;
+ #else
+ format.Rshift = 16;
+ format.Gshift = 8;
+ format.Bshift = 0;
+ format.Ashift = 24;
+ #endif
+ format.Rmask = 0xFF << format.Rshift;
+ format.Gmask = 0xFF << format.Gshift;
+ format.Bmask = 0xFF << format.Bshift;
+ format.Amask = 0xFF << format.Ashift;
+ format.alpha = SDL_ALPHA_OPAQUE;
+
+ surface = SDL_ConvertSurface(icon, &format, 0);
+ if (!surface) {
+ return;
+ }
+
+ /* Set the _NET_WM_ICON property */
+ propsize = 2 + (icon->w * icon->h);
+ propdata = SDL_malloc(propsize * sizeof(long));
+ if (propdata) {
+ const Uint32 alpha = format.Amask;
+ int x, y;
+ Uint32 *src;
+ long *dst;
+
+ propdata[0] = icon->w;
+ propdata[1] = icon->h;
+ dst = &propdata[2];
+
+ size_t maskidx = 0;
+ for (y = 0; y < icon->h; ++y) {
+ src = (Uint32*)((Uint8*)surface->pixels + y * surface->pitch);
+ for (x = 0; x < icon->w; ++x) {
+ const Uint32 pixel = *(src++);
+ if (mask[maskidx / 8] & (1<<(7-(maskidx % 8)))) {
+ *dst++ = pixel | alpha;
+ } else {
+ *dst++ = pixel & ~alpha;
+ }
+ maskidx++;
+ }
+ }
+
+ XChangeProperty(SDL_Display, WMwindow, _NET_WM_ICON, XA_CARDINAL,
+ 32, PropModeReplace, (unsigned char *) propdata,
+ propsize);
+ }
+
+ SDL_FreeSurface(surface);
+ SDL_free(propdata);
+
+ XFlush(SDL_Display);
+ SDL_Unlock_EventThread();
+
+ return;
+ }
+
+ /* Do it the old way... */
/* The icon must use the default visual, depth and colormap of the
screen, so it might need a conversion */

11
devel/sdl/pkg/DESCR Normal file
View file

@ -0,0 +1,11 @@
Simple DirectMedia Layer is a cross-platform multimedia
library designed to provide fast access to the graphics
framebuffer and audio device. It is used by MPEG playback
software, emulators, and many popular games.
Packages can be built with additional FLAVORs:
aa: SDL built with ASCII art support.
This FLAVOR requires the aalib package.
no_x11: Built without X11.

220
devel/sdl/pkg/PLIST Normal file
View file

@ -0,0 +1,220 @@
@pkgpath ${BASE_PKGPATH},altivec
@pkgpath ${BASE_PKGPATH},caca
@pkgpath ${BASE_PKGPATH},esd
@pkgpath ${BASE_PKGPATH},sun
bin/sdl-config
include/SDL/
include/SDL/SDL.h
include/SDL/SDL_active.h
include/SDL/SDL_audio.h
include/SDL/SDL_byteorder.h
include/SDL/SDL_cdrom.h
include/SDL/SDL_config.h
include/SDL/SDL_cpuinfo.h
include/SDL/SDL_endian.h
include/SDL/SDL_error.h
include/SDL/SDL_events.h
include/SDL/SDL_getenv.h
include/SDL/SDL_joystick.h
include/SDL/SDL_keyboard.h
include/SDL/SDL_keysym.h
include/SDL/SDL_loadso.h
include/SDL/SDL_main.h
include/SDL/SDL_mouse.h
include/SDL/SDL_mutex.h
include/SDL/SDL_name.h
include/SDL/SDL_opengl.h
include/SDL/SDL_platform.h
include/SDL/SDL_quit.h
include/SDL/SDL_rwops.h
include/SDL/SDL_stdinc.h
include/SDL/SDL_syswm.h
include/SDL/SDL_thread.h
include/SDL/SDL_timer.h
include/SDL/SDL_types.h
include/SDL/SDL_version.h
include/SDL/SDL_video.h
include/SDL/begin_code.h
include/SDL/close_code.h
@static-lib lib/libSDL.a
lib/libSDL.la
@lib lib/libSDL.so.${LIBSDL_VERSION}
@static-lib lib/libSDLmain.a
lib/libSDLmain.la
lib/pkgconfig/sdl.pc
@man man/man3/SDLKey.3
@man man/man3/SDL_ActiveEvent.3
@man man/man3/SDL_AddTimer.3
@man man/man3/SDL_AudioCVT.3
@man man/man3/SDL_AudioSpec.3
@man man/man3/SDL_BlitSurface.3
@man man/man3/SDL_BuildAudioCVT.3
@man man/man3/SDL_CD.3
@man man/man3/SDL_CDClose.3
@man man/man3/SDL_CDEject.3
@man man/man3/SDL_CDName.3
@man man/man3/SDL_CDNumDrives.3
@man man/man3/SDL_CDOpen.3
@man man/man3/SDL_CDPause.3
@man man/man3/SDL_CDPlay.3
@man man/man3/SDL_CDPlayTracks.3
@man man/man3/SDL_CDResume.3
@man man/man3/SDL_CDStatus.3
@man man/man3/SDL_CDStop.3
@man man/man3/SDL_CDtrack.3
@man man/man3/SDL_CloseAudio.3
@man man/man3/SDL_Color.3
@man man/man3/SDL_CondBroadcast.3
@man man/man3/SDL_CondSignal.3
@man man/man3/SDL_CondWait.3
@man man/man3/SDL_CondWaitTimeout.3
@man man/man3/SDL_ConvertAudio.3
@man man/man3/SDL_ConvertSurface.3
@man man/man3/SDL_CreateCond.3
@man man/man3/SDL_CreateCursor.3
@man man/man3/SDL_CreateMutex.3
@man man/man3/SDL_CreateRGBSurface.3
@man man/man3/SDL_CreateRGBSurfaceFrom.3
@man man/man3/SDL_CreateSemaphore.3
@man man/man3/SDL_CreateThread.3
@man man/man3/SDL_CreateYUVOverlay.3
@man man/man3/SDL_Delay.3
@man man/man3/SDL_DestroyCond.3
@man man/man3/SDL_DestroyMutex.3
@man man/man3/SDL_DestroySemaphore.3
@man man/man3/SDL_DisplayFormat.3
@man man/man3/SDL_DisplayFormatAlpha.3
@man man/man3/SDL_DisplayYUVOverlay.3
@man man/man3/SDL_EnableKeyRepeat.3
@man man/man3/SDL_EnableUNICODE.3
@man man/man3/SDL_Event.3
@man man/man3/SDL_EventState.3
@man man/man3/SDL_ExposeEvent.3
@man man/man3/SDL_FillRect.3
@man man/man3/SDL_Flip.3
@man man/man3/SDL_FreeCursor.3
@man man/man3/SDL_FreeSurface.3
@man man/man3/SDL_FreeWAV.3
@man man/man3/SDL_FreeYUVOverlay.3
@man man/man3/SDL_GL_GetAttribute.3
@man man/man3/SDL_GL_GetProcAddress.3
@man man/man3/SDL_GL_LoadLibrary.3
@man man/man3/SDL_GL_SetAttribute.3
@man man/man3/SDL_GL_SwapBuffers.3
@man man/man3/SDL_GLattr.3
@man man/man3/SDL_GetAppState.3
@man man/man3/SDL_GetAudioStatus.3
@man man/man3/SDL_GetClipRect.3
@man man/man3/SDL_GetCursor.3
@man man/man3/SDL_GetError.3
@man man/man3/SDL_GetEventFilter.3
@man man/man3/SDL_GetGamma.3
@man man/man3/SDL_GetGammaRamp.3
@man man/man3/SDL_GetKeyName.3
@man man/man3/SDL_GetKeyState.3
@man man/man3/SDL_GetModState.3
@man man/man3/SDL_GetMouseState.3
@man man/man3/SDL_GetRGB.3
@man man/man3/SDL_GetRGBA.3
@man man/man3/SDL_GetRelativeMouseState.3
@man man/man3/SDL_GetThreadID.3
@man man/man3/SDL_GetTicks.3
@man man/man3/SDL_GetVideoInfo.3
@man man/man3/SDL_GetVideoSurface.3
@man man/man3/SDL_Init.3
@man man/man3/SDL_InitSubSystem.3
@man man/man3/SDL_JoyAxisEvent.3
@man man/man3/SDL_JoyBallEvent.3
@man man/man3/SDL_JoyButtonEvent.3
@man man/man3/SDL_JoyHatEvent.3
@man man/man3/SDL_JoystickClose.3
@man man/man3/SDL_JoystickEventState.3
@man man/man3/SDL_JoystickGetAxis.3
@man man/man3/SDL_JoystickGetBall.3
@man man/man3/SDL_JoystickGetButton.3
@man man/man3/SDL_JoystickGetHat.3
@man man/man3/SDL_JoystickIndex.3
@man man/man3/SDL_JoystickName.3
@man man/man3/SDL_JoystickNumAxes.3
@man man/man3/SDL_JoystickNumBalls.3
@man man/man3/SDL_JoystickNumButtons.3
@man man/man3/SDL_JoystickNumHats.3
@man man/man3/SDL_JoystickOpen.3
@man man/man3/SDL_JoystickOpened.3
@man man/man3/SDL_JoystickUpdate.3
@man man/man3/SDL_KeyboardEvent.3
@man man/man3/SDL_KillThread.3
@man man/man3/SDL_ListModes.3
@man man/man3/SDL_LoadBMP.3
@man man/man3/SDL_LoadWAV.3
@man man/man3/SDL_LockAudio.3
@man man/man3/SDL_LockSurface.3
@man man/man3/SDL_LockYUVOverlay.3
@man man/man3/SDL_MapRGB.3
@man man/man3/SDL_MapRGBA.3
@man man/man3/SDL_MixAudio.3
@man man/man3/SDL_MouseButtonEvent.3
@man man/man3/SDL_MouseMotionEvent.3
@man man/man3/SDL_NumJoysticks.3
@man man/man3/SDL_OpenAudio.3
@man man/man3/SDL_Overlay.3
@man man/man3/SDL_Palette.3
@man man/man3/SDL_PauseAudio.3
@man man/man3/SDL_PeepEvents.3
@man man/man3/SDL_PixelFormat.3
@man man/man3/SDL_PollEvent.3
@man man/man3/SDL_PumpEvents.3
@man man/man3/SDL_PushEvent.3
@man man/man3/SDL_Quit.3
@man man/man3/SDL_QuitEvent.3
@man man/man3/SDL_QuitSubSystem.3
@man man/man3/SDL_RWFromFile.3
@man man/man3/SDL_Rect.3
@man man/man3/SDL_RemoveTimer.3
@man man/man3/SDL_ResizeEvent.3
@man man/man3/SDL_SaveBMP.3
@man man/man3/SDL_SemPost.3
@man man/man3/SDL_SemTryWait.3
@man man/man3/SDL_SemValue.3
@man man/man3/SDL_SemWait.3
@man man/man3/SDL_SemWaitTimeout.3
@man man/man3/SDL_SetAlpha.3
@man man/man3/SDL_SetClipRect.3
@man man/man3/SDL_SetColorKey.3
@man man/man3/SDL_SetColors.3
@man man/man3/SDL_SetCursor.3
@man man/man3/SDL_SetEventFilter.3
@man man/man3/SDL_SetGamma.3
@man man/man3/SDL_SetGammaRamp.3
@man man/man3/SDL_SetModState.3
@man man/man3/SDL_SetPalette.3
@man man/man3/SDL_SetTimer.3
@man man/man3/SDL_SetVideoMode.3
@man man/man3/SDL_ShowCursor.3
@man man/man3/SDL_Surface.3
@man man/man3/SDL_SysWMEvent.3
@man man/man3/SDL_ThreadID.3
@man man/man3/SDL_UnlockAudio.3
@man man/man3/SDL_UnlockSurface.3
@man man/man3/SDL_UnlockYUVOverlay.3
@man man/man3/SDL_UpdateRect.3
@man man/man3/SDL_UpdateRects.3
@man man/man3/SDL_UserEvent.3
@man man/man3/SDL_VideoDriverName.3
@man man/man3/SDL_VideoInfo.3
@man man/man3/SDL_VideoModeOK.3
@man man/man3/SDL_WM_GetCaption.3
@man man/man3/SDL_WM_GrabInput.3
@man man/man3/SDL_WM_IconifyWindow.3
@man man/man3/SDL_WM_SetCaption.3
@man man/man3/SDL_WM_SetIcon.3
@man man/man3/SDL_WM_ToggleFullScreen.3
@man man/man3/SDL_WaitEvent.3
@man man/man3/SDL_WaitThread.3
@man man/man3/SDL_WarpMouse.3
@man man/man3/SDL_WasInit.3
@man man/man3/SDL_keysym.3
@man man/man3/SDL_mutexP.3
@man man/man3/SDL_mutexV.3
share/aclocal/
share/aclocal/sdl.m4