From bdd3308e6fa180a6098f793341645db1d669f815 Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Wed, 2 Nov 2022 10:11:17 +0900 Subject: [PATCH] sdl: Bump to 1.2.15-p20221028 --- ...src_joystick_linux_SDL_sysjoystick.c.patch | 13 ----- ...1.2.15_src_video_x11_SDL_x11events.c.patch | 55 +------------------ ...DL-1.2.15_src_video_x11_SDL_x11sym.h.patch | 12 ---- ...SDL-1.2.15_src_video_x11_SDL_x11wm.c.patch | 19 ------- x11-packages/sdl/build.sh | 24 ++++++-- 5 files changed, 21 insertions(+), 102 deletions(-) delete mode 100644 x11-packages/sdl/SDL-1.2.15_src_joystick_linux_SDL_sysjoystick.c.patch delete mode 100644 x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11sym.h.patch delete mode 100644 x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11wm.c.patch diff --git a/x11-packages/sdl/SDL-1.2.15_src_joystick_linux_SDL_sysjoystick.c.patch b/x11-packages/sdl/SDL-1.2.15_src_joystick_linux_SDL_sysjoystick.c.patch deleted file mode 100644 index 932b62d1da..0000000000 --- a/x11-packages/sdl/SDL-1.2.15_src_joystick_linux_SDL_sysjoystick.c.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff -uNr SDL-1.2.15/src/joystick/linux/SDL_sysjoystick.c SDL-1.2.15.mod/src/joystick/linux/SDL_sysjoystick.c ---- SDL-1.2.15/src/joystick/linux/SDL_sysjoystick.c 2012-01-19 08:30:06.000000000 +0200 -+++ SDL-1.2.15.mod/src/joystick/linux/SDL_sysjoystick.c 2018-10-26 23:20:45.208724512 +0300 -@@ -1106,6 +1106,9 @@ - } - break; - case EV_ABS: -+ if (code > ABS_MISC) { -+ break; -+ } - switch (code) { - case ABS_HAT0X: - case ABS_HAT0Y: diff --git a/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11events.c.patch b/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11events.c.patch index 25fa5e2cce..fd4dfcc74d 100644 --- a/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11events.c.patch +++ b/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11events.c.patch @@ -14,45 +14,6 @@ diff -uNr SDL-1.2.15/src/video/x11/SDL_x11events.c SDL-1.2.15.mod/src/video/x11/ #ifdef X_HAVE_UTF8_STRING Uint32 Utf8ToUcs4(const Uint8 *utf8) -@@ -395,6 +389,8 @@ - { - int posted; - XEvent xevent; -+ int orig_event_type; -+ KeyCode orig_keycode; - - SDL_memset(&xevent, '\0', sizeof (XEvent)); /* valgrind fix. --ryan. */ - XNextEvent(SDL_Display, &xevent); -@@ -410,9 +406,29 @@ - #ifdef X_HAVE_UTF8_STRING - /* If we are translating with IM, we need to pass all events - to XFilterEvent, and discard those filtered events immediately. */ -+ orig_event_type = xevent.type; -+ if (orig_event_type == KeyPress || orig_event_type == KeyRelease) { -+ orig_keycode = xevent.xkey.keycode; -+ } else { -+ orig_keycode = 0; -+ } - if ( SDL_TranslateUNICODE - && SDL_IM != NULL - && XFilterEvent(&xevent, None) ) { -+ if (orig_keycode) { -+ SDL_keysym keysym; -+ static XComposeStatus state; -+ char keybuf[32]; -+ -+ keysym.scancode = xevent.xkey.keycode; -+ keysym.sym = X11_TranslateKeycode(SDL_Display, xevent.xkey.keycode); -+ keysym.mod = KMOD_NONE; -+ keysym.unicode = 0; -+ if (orig_event_type == KeyPress && XLookupString(&xevent.xkey, keybuf, sizeof(keybuf), NULL, &state)) -+ keysym.unicode = (Uint8)keybuf[0]; -+ -+ SDL_PrivateKeyboard(orig_event_type == KeyPress ? SDL_PRESSED : SDL_RELEASED, &keysym); -+ } - return 0; - } - #endif @@ -429,12 +445,15 @@ if ( xevent.xcrossing.mode == NotifyUngrab ) printf("Mode: NotifyUngrab\n"); @@ -80,8 +41,8 @@ diff -uNr SDL-1.2.15/src/video/x11/SDL_x11events.c SDL-1.2.15.mod/src/video/x11/ #endif - if ((X11_PendingConfigureNotifyWidth != -1) && - (X11_PendingConfigureNotifyHeight != -1)) { -- if ((xevent.xconfigure.width != X11_PendingConfigureNotifyWidth) && -- (xevent.xconfigure.height != X11_PendingConfigureNotifyHeight)) { +- if ((xevent.xconfigure.width == X11_PendingConfigureNotifyWidth) && +- (xevent.xconfigure.height == X11_PendingConfigureNotifyHeight)) { - /* Event is from before the resize, so ignore. */ - break; - } @@ -91,18 +52,6 @@ diff -uNr SDL-1.2.15/src/video/x11/SDL_x11events.c SDL-1.2.15.mod/src/video/x11/ if ( SDL_VideoSurface ) { if ((xevent.xconfigure.width != SDL_VideoSurface->w) || (xevent.xconfigure.height != SDL_VideoSurface->h)) { -@@ -1246,8 +1255,11 @@ - * 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; @@ -1255,6 +1267,12 @@ XKeyEvent xkey; Uint16 unicode; diff --git a/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11sym.h.patch b/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11sym.h.patch deleted file mode 100644 index 2690f1ac0b..0000000000 --- a/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11sym.h.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -uNr SDL-1.2.15/src/video/x11/SDL_x11sym.h SDL-1.2.15.mod/src/video/x11/SDL_x11sym.h ---- SDL-1.2.15/src/video/x11/SDL_x11sym.h 2012-01-19 08:30:06.000000000 +0200 -+++ SDL-1.2.15.mod/src/video/x11/SDL_x11sym.h 2018-10-26 23:20:45.232058046 +0300 -@@ -165,7 +165,7 @@ - */ - #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 _Xconst long *data,unsigned len),(dpy,data,len),return) - SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,len),) - #endif - diff --git a/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11wm.c.patch b/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11wm.c.patch deleted file mode 100644 index 811f51c8f3..0000000000 --- a/x11-packages/sdl/SDL-1.2.15_src_video_x11_SDL_x11wm.c.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff -uNr SDL-1.2.15/src/video/x11/SDL_x11wm.c SDL-1.2.15.mod/src/video/x11/SDL_x11wm.c ---- SDL-1.2.15/src/video/x11/SDL_x11wm.c 2012-01-19 08:30:06.000000000 +0200 -+++ SDL-1.2.15.mod/src/video/x11/SDL_x11wm.c 2018-10-26 23:20:45.235391408 +0300 -@@ -352,13 +352,14 @@ - result = XGrabPointer(SDL_Display, SDL_Window, True, 0, - GrabModeAsync, GrabModeAsync, - SDL_Window, None, CurrentTime); -- if ( result == GrabSuccess ) { -+ if ( result == GrabSuccess || result == GrabNotViewable ) { - break; - } - SDL_Delay(100); - } - if ( result != GrabSuccess ) { - /* Uh, oh, what do we do here? */ ; -+ return(SDL_GRAB_OFF); - } - /* Now grab the keyboard */ - XGrabKeyboard(SDL_Display, WMwindow, True, diff --git a/x11-packages/sdl/build.sh b/x11-packages/sdl/build.sh index af039f55f4..94c19f703f 100644 --- a/x11-packages/sdl/build.sh +++ b/x11-packages/sdl/build.sh @@ -2,11 +2,12 @@ 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_MAINTAINER="@termux" -TERMUX_PKG_VERSION=1.2.15 -TERMUX_PKG_REVISION=48 -TERMUX_PKG_SRCURL=https://www.libsdl.org/release/SDL-${TERMUX_PKG_VERSION}.tar.gz -TERMUX_PKG_SHA256=d6d316a793e5e348155f0dd93b979798933fb98aa1edebcc108829d6474aad00 -TERMUX_PKG_DEPENDS="libandroid-glob, libflac, libogg, libsndfile, libvorbis, libx11, libxext, libxrandr, libxrender, pulseaudio" +_COMMIT=d95c1a4bbd644baba748d341b03141e5f0481ae6 +_COMMIT_DATE=20221028 +TERMUX_PKG_VERSION=1.2.15-p${_COMMIT_DATE} +TERMUX_PKG_SRCURL=https://github.com/libsdl-org/SDL-1.2.git +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_CONFLICTS="libsdl" @@ -18,3 +19,16 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" --disable-pth --enable-video-opengl " + +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 +}