sdl: Bump to 1.2.60

* Migrate to sdl12-compat
This commit is contained in:
Tee KOBAYASHI 2023-01-10 11:46:58 +09:00 committed by xtkoba
parent 4a205a7b5c
commit 4f60c445f9
14 changed files with 22 additions and 316 deletions

View File

@ -1,33 +0,0 @@
diff -uNr SDL-1.2.15/configure SDL-1.2.15.mod/configure
--- SDL-1.2.15/configure 2012-01-19 08:30:12.000000000 +0200
+++ SDL-1.2.15.mod/configure 2018-10-26 23:22:05.229411961 +0300
@@ -20265,10 +20265,9 @@
LDFLAGS="$LDFLAGS $ALSA_LIBS"
fi
-ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl -lpthread"
+ALSA_LIBS="$ALSA_LIBS -lasound -lm -ldl"
LIBS=`echo $LIBS | sed 's/-lm//'`
LIBS=`echo $LIBS | sed 's/-ldl//'`
-LIBS=`echo $LIBS | sed 's/-lpthread//'`
LIBS=`echo $LIBS | sed 's/ //'`
LIBS="$ALSA_LIBS $LIBS"
{ echo "$as_me:$LINENO: result: $ALSA_LIBS" >&5
@@ -26923,7 +26922,7 @@
case "$host" in
*-*-linux*|*-*-uclinux*)
pthread_cflags="-D_REENTRANT"
- pthread_lib="-lpthread"
+ pthread_lib=""
;;
*-*-bsdi*)
pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
@@ -26980,7 +26979,7 @@
;;
*)
pthread_cflags="-D_REENTRANT"
- pthread_lib="-lpthread"
+ pthread_lib=""
;;
esac
if test x$enable_threads = xyes -a x$enable_pthreads = xyes -a x$enable_ipod != xyes; then

View File

@ -1,18 +0,0 @@
diff -uNr SDL-1.2.15/src/cdrom/linux/SDL_syscdrom.c SDL-1.2.15.mod/src/cdrom/linux/SDL_syscdrom.c
--- SDL-1.2.15/src/cdrom/linux/SDL_syscdrom.c 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/cdrom/linux/SDL_syscdrom.c 2018-10-26 23:20:45.205391150 +0300
@@ -68,12 +68,12 @@
#ifdef MNTTAB
#define _PATH_MNTTAB MNTTAB
#else
-#define _PATH_MNTTAB "/etc/fstab"
+#define _PATH_MNTTAB "@TERMUX_PREFIX@/etc/fstab"
#endif
#endif /* !_PATH_MNTTAB */
#ifndef _PATH_MOUNTED
-#define _PATH_MOUNTED "/etc/mtab"
+#define _PATH_MOUNTED "@TERMUX_PREFIX@/etc/mtab"
#endif /* !_PATH_MOUNTED */
#ifndef MNTTYPE_CDROM

View File

@ -1,28 +0,0 @@
diff -uNr SDL-1.2.15/src/video/SDL_gamma.c SDL-1.2.15.mod/src/video/SDL_gamma.c
--- SDL-1.2.15/src/video/SDL_gamma.c 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/SDL_gamma.c 2018-10-26 23:20:45.222057960 +0300
@@ -92,22 +92,11 @@
int SDL_SetGamma(float red, float green, float blue)
{
- int succeeded;
+ int succeeded = -1;
SDL_VideoDevice *video = current_video;
SDL_VideoDevice *this = current_video;
- succeeded = -1;
- /* Prefer using SetGammaRamp(), as it's more flexible */
- {
- Uint16 ramp[3][256];
-
- CalculateGammaRamp(red, ramp[0]);
- CalculateGammaRamp(green, ramp[1]);
- CalculateGammaRamp(blue, ramp[2]);
- succeeded = SDL_SetGammaRamp(ramp[0], ramp[1], ramp[2]);
- }
- if ( (succeeded < 0) && video->SetGamma ) {
- SDL_ClearError();
+ if ( video->SetGamma ) {
succeeded = video->SetGamma(this, red, green, blue);
}
return succeeded;

View File

@ -1,12 +0,0 @@
diff -uNr SDL-1.2.15/src/video/SDL_yuv_sw.c SDL-1.2.15.mod/src/video/SDL_yuv_sw.c
--- SDL-1.2.15/src/video/SDL_yuv_sw.c 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/SDL_yuv_sw.c 2018-10-26 23:20:45.225391322 +0300
@@ -89,6 +89,8 @@
#include "SDL_yuvfuncs.h"
#include "SDL_yuv_sw_c.h"
+#undef __OPTIMIZE__
+
/* The functions used to manipulate software video overlays */
static struct private_yuvhwfuncs sw_yuvfuncs = {
SDL_LockYUV_SW,

View File

@ -1,49 +0,0 @@
diff -uNr SDL-1.2.15/src/video/fbcon/SDL_fbvideo.c SDL-1.2.15.mod/src/video/fbcon/SDL_fbvideo.c
--- SDL-1.2.15/src/video/fbcon/SDL_fbvideo.c 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/fbcon/SDL_fbvideo.c 2018-10-26 23:20:45.212057874 +0300
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
+#include <sys/syscall.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
@@ -52,16 +53,15 @@
#if defined(i386) && defined(FB_TYPE_VGA_PLANES)
#define VGA16_FBCON_SUPPORT
-#include <sys/io.h> /* For ioperm() */
#ifndef FB_AUX_VGA_PLANES_VGA4
#define FB_AUX_VGA_PLANES_VGA4 0
#endif
-/*
+
static inline void outb (unsigned char value, unsigned short port)
{
__asm__ __volatile__ ("outb %b0,%w1"::"a" (value), "Nd" (port));
-}
-*/
+}
+
#endif /* FB_TYPE_VGA_PLANES */
/* A list of video resolutions that we query for (sorted largest to smallest) */
@@ -280,7 +280,7 @@
FB_Available, FB_CreateDevice
};
-#define FB_MODES_DB "/etc/fb.modes"
+#define FB_MODES_DB "@TERMUX_PREFIX@/etc/fb.modes"
static int read_fbmodes_line(FILE*f, char* line, int length)
{
@@ -541,7 +541,7 @@
case FB_TYPE_VGA_PLANES:
/* VGA16 is supported, but that's it */
if ( finfo.type_aux == FB_AUX_VGA_PLANES_VGA4 ) {
- if ( ioperm(0x3b4, 0x3df - 0x3b4 + 1, 1) < 0 ) {
+ if ( syscall(__NR_ioperm, 0x3b4, 0x3df - 0x3b4 + 1, 1) < 0 ) {
SDL_SetError("No I/O port permissions");
FB_VideoQuit(this);
return(-1);

View File

@ -1,12 +0,0 @@
diff -uNr SDL-1.2.15/src/video/ipod/SDL_ipodvideo.c SDL-1.2.15.mod/src/video/ipod/SDL_ipodvideo.c
--- SDL-1.2.15/src/video/ipod/SDL_ipodvideo.c 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/ipod/SDL_ipodvideo.c 2018-10-26 23:20:45.212057874 +0300
@@ -170,7 +170,7 @@
static const char * const vcs[] = { "/dev/vc/%d", "/dev/tty%d", 0 };
int i, tty0_fd;
- dbgout = fdopen (open ("/etc/sdlpod.log", O_WRONLY | O_SYNC | O_APPEND), "a");
+ dbgout = fdopen (open ("@TERMUX_PREFIX@/etc/sdlpod.log", O_WRONLY | O_SYNC | O_APPEND), "a");
if (dbgout) {
setbuf (dbgout, 0);
fprintf (dbgout, "--> Started SDL <--\n");

View File

@ -1,12 +0,0 @@
diff -uNr SDL-1.2.15/src/video/photon/SDL_ph_gl.h SDL-1.2.15.mod/src/video/photon/SDL_ph_gl.h
--- SDL-1.2.15/src/video/photon/SDL_ph_gl.h 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/photon/SDL_ph_gl.h 2018-10-26 23:20:45.215391237 +0300
@@ -26,7 +26,7 @@
#include "SDL_ph_video.h"
-#define DEFAULT_OPENGL "/usr/lib/libGL.so"
+#define DEFAULT_OPENGL "@TERMUX_PREFIX@/lib/libGL.so"
#if SDL_VIDEO_OPENGL
void ph_GL_SwapBuffers(_THIS);

View File

@ -1,67 +0,0 @@
diff -uNr SDL-1.2.15/src/video/x11/SDL_x11events.c SDL-1.2.15.mod/src/video/x11/SDL_x11events.c
--- SDL-1.2.15/src/video/x11/SDL_x11events.c 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/x11/SDL_x11events.c 2018-10-26 23:20:45.228724684 +0300
@@ -57,12 +57,6 @@
static SDLKey MISC_keymap[256];
SDLKey X11_TranslateKeycode(Display *display, KeyCode kc);
-/*
- Pending resize target for ConfigureNotify (so outdated events don't
- cause inappropriate resize events)
-*/
-int X11_PendingConfigureNotifyWidth = -1;
-int X11_PendingConfigureNotifyHeight = -1;
#ifdef X_HAVE_UTF8_STRING
Uint32 Utf8ToUcs4(const Uint8 *utf8)
@@ -429,12 +445,15 @@
if ( xevent.xcrossing.mode == NotifyUngrab )
printf("Mode: NotifyUngrab\n");
#endif
- if ( this->input_grab == SDL_GRAB_OFF ) {
- posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
+ if ( (xevent.xcrossing.mode != NotifyGrab) &&
+ (xevent.xcrossing.mode != NotifyUngrab) ) {
+ if ( this->input_grab == SDL_GRAB_OFF ) {
+ posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
+ }
+ posted = SDL_PrivateMouseMotion(0, 0,
+ xevent.xcrossing.x,
+ xevent.xcrossing.y);
}
- posted = SDL_PrivateMouseMotion(0, 0,
- xevent.xcrossing.x,
- xevent.xcrossing.y);
}
break;
@@ -825,16 +844,6 @@
#ifdef DEBUG_XEVENTS
printf("ConfigureNotify! (resize: %dx%d)\n", xevent.xconfigure.width, xevent.xconfigure.height);
#endif
- if ((X11_PendingConfigureNotifyWidth != -1) &&
- (X11_PendingConfigureNotifyHeight != -1)) {
- if ((xevent.xconfigure.width == X11_PendingConfigureNotifyWidth) &&
- (xevent.xconfigure.height == X11_PendingConfigureNotifyHeight)) {
- /* Event is from before the resize, so ignore. */
- break;
- }
- X11_PendingConfigureNotifyWidth = -1;
- X11_PendingConfigureNotifyHeight = -1;
- }
if ( SDL_VideoSurface ) {
if ((xevent.xconfigure.width != SDL_VideoSurface->w) ||
(xevent.xconfigure.height != SDL_VideoSurface->h)) {
@@ -1255,6 +1267,12 @@
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

@ -1,12 +0,0 @@
diff -uNr SDL-1.2.15/src/video/x11/SDL_x11events_c.h SDL-1.2.15.mod/src/video/x11/SDL_x11events_c.h
--- SDL-1.2.15/src/video/x11/SDL_x11events_c.h 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/x11/SDL_x11events_c.h 2018-10-26 23:20:45.225391322 +0300
@@ -27,8 +27,3 @@
extern void X11_InitOSKeymap(_THIS);
extern void X11_PumpEvents(_THIS);
extern void X11_SetKeyboardState(Display *display, const char *key_vec);
-
-/* Variables to be exported */
-extern int X11_PendingConfigureNotifyWidth;
-extern int X11_PendingConfigureNotifyHeight;
-

View File

@ -1,12 +0,0 @@
diff -uNr SDL-1.2.15/src/video/x11/SDL_x11gl.c SDL-1.2.15.mod/src/video/x11/SDL_x11gl.c
--- SDL-1.2.15/src/video/x11/SDL_x11gl.c 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/x11/SDL_x11gl.c 2018-10-26 23:20:45.228724684 +0300
@@ -30,7 +30,7 @@
/* IRIX doesn't have a GL library versioning system */
#define DEFAULT_OPENGL "libGL.so"
#elif defined(__MACOSX__)
-#define DEFAULT_OPENGL "/usr/X11R6/lib/libGL.1.dylib"
+#define DEFAULT_OPENGL "@TERMUX_PREFIX@/X11R6/lib/libGL.1.dylib"
#elif defined(__QNXNTO__)
#define DEFAULT_OPENGL "libGL.so.3"
#elif defined(__OpenBSD__)

View File

@ -1,12 +0,0 @@
diff -uNr SDL-1.2.15/src/video/x11/SDL_x11modes.c SDL-1.2.15.mod/src/video/x11/SDL_x11modes.c
--- SDL-1.2.15/src/video/x11/SDL_x11modes.c 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/x11/SDL_x11modes.c 2018-10-26 23:20:45.232058046 +0300
@@ -458,7 +458,7 @@
if ( SDL_strcmp(ServerVendor(SDL_Display), "Metro Link Incorporated") == 0 ) {
FILE *metro_fp;
- metro_fp = fopen("/usr/X11R6/lib/X11/Metro/.version", "r");
+ metro_fp = fopen("@TERMUX_PREFIX@/X11R6/lib/X11/Metro/.version", "r");
if ( metro_fp != NULL ) {
int major, minor, patch, version, scannum;
major = 0; minor = 0; patch = 0;

View File

@ -1,21 +0,0 @@
diff -uNr SDL-1.2.15/src/video/x11/SDL_x11video.c SDL-1.2.15.mod/src/video/x11/SDL_x11video.c
--- SDL-1.2.15/src/video/x11/SDL_x11video.c 2012-01-19 08:30:06.000000000 +0200
+++ SDL-1.2.15.mod/src/video/x11/SDL_x11video.c 2018-10-26 23:20:45.235391408 +0300
@@ -1088,7 +1088,7 @@
}
}
-#if 0 /* This is an experiment - are the graphics faster now? - nope. */
+#if 1 /* This is an experiment - are the graphics faster now? - nope. */
if ( SDL_getenv("SDL_VIDEO_X11_BACKINGSTORE") )
#endif
/* Cache the window in the server, when possible */
@@ -1177,8 +1177,6 @@
current = NULL;
goto done;
}
- X11_PendingConfigureNotifyWidth = width;
- X11_PendingConfigureNotifyHeight = height;
} else {
if (X11_CreateWindow(this,current,width,height,bpp,flags) < 0) {
current = NULL;

View File

@ -1,34 +1,14 @@
TERMUX_PKG_HOMEPAGE=https://www.libsdl.org
TERMUX_PKG_DESCRIPTION="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_DESCRIPTION="Simple DirectMedia Layer (SDL) sdl12-compat"
TERMUX_PKG_LICENSE="ZLIB"
TERMUX_PKG_MAINTAINER="@termux"
_COMMIT=ca3acd25348edc9b6e984fc1712fd4d365931dc1
_COMMIT_DATE=20221201
TERMUX_PKG_VERSION=1.2.15-p${_COMMIT_DATE}
TERMUX_PKG_SRCURL=git+https://github.com/libsdl-org/SDL-1.2
TERMUX_PKG_GIT_BRANCH=main
TERMUX_PKG_DEPENDS="libiconv, libx11, libxext, libxrandr, libxrender, pulseaudio"
TERMUX_PKG_BUILD_DEPENDS="glu, mesa"
TERMUX_PKG_RECOMMENDS="mesa"
TERMUX_PKG_VERSION=1.2.60
TERMUX_PKG_SRCURL=https://github.com/libsdl-org/sdl12-compat/archive/refs/tags/release-${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=029fa24fe9e0d6a15b94f4737a2d3ed3144c5ef920eb82b4c6b30248eb94518b
TERMUX_PKG_DEPENDS="sdl2"
TERMUX_PKG_CONFLICTS="libsdl"
TERMUX_PKG_REPLACES="libsdl"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
--disable-assembly
--disable-nasm
--disable-pth
--enable-video-opengl
-DSDL12TESTS=OFF
"
termux_step_post_get_source() {
git fetch --unshallow
git checkout $_COMMIT
local pdate="p$(git log -1 --format=%cs | sed 's/-//g')"
if [[ "$TERMUX_PKG_VERSION" != *"${pdate}" ]]; then
echo -n "ERROR: The version string \"$TERMUX_PKG_VERSION\" is"
echo -n " different from what is expected to be; should end"
echo " with \"${pdate}\"."
return 1
fi
}
TERMUX_PKG_NO_STATICSPLIT=true

View File

@ -0,0 +1,14 @@
--- a/src/SDL12_compat.c
+++ b/src/SDL12_compat.c
@@ -1143,7 +1143,11 @@
}
#elif defined(__unix__)
#include <dlfcn.h>
+#ifdef __ANDROID__
+ #define SDL20_LIBNAME "libSDL2-2.0.so"
+#else
#define SDL20_LIBNAME "libSDL2-2.0.so.0"
+#endif
#define SDL20_REQUIRED_VER SDL_VERSIONNUM(2,0,7)
static void *Loaded_SDL20 = NULL;
#define LoadSDL20Library() ((Loaded_SDL20 = dlopen(SDL20_LIBNAME, RTLD_LOCAL|RTLD_NOW)) != NULL)