wok view libsdl/stuff/sdl-1.2.14-add-XGetRequest-symbol.patch @ rev 23984

linld: fix bootiso/strhead
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Nov 25 20:41:41 2020 +0000 (2020-11-25)
parents
children
line source
1 _XGetRequest API was backported to libx11-1.4.4 in:
2 http://git.openembedded.org/openembedded-core/commit/?id=e08604800fe1cb8f240f53c147ceb4ee08a29b91
4 This breaks e.g. libsdl-image build with:
5 | /OE/shr-core/tmp-eglibc/sysroots/qemux86-64/usr/lib/libSDL.so: undefined reference to `_XGetRequest'
7 For details see: https://bugzilla.redhat.com/show_bug.cgi?id=782251
9 Upstrea-Status: Accepted
11 @@ -, +, @@
12 added.
13 src/video/x11/SDL_x11dyn.c | 24 ++++++++++++++++++++++++
14 src/video/x11/SDL_x11sym.h | 6 ++++++
15 2 files changed, 30 insertions(+), 0 deletions(-)
16 --- a/src/video/x11/SDL_x11dyn.c
17 +++ a/src/video/x11/SDL_x11dyn.c
18 @@ -109,6 +109,21 @@ char *(*pXGetICValues)(XIC, ...) = NULL;
19 #undef SDL_X11_SYM
22 +static void *SDL_XGetRequest_workaround(Display* dpy, CARD8 type, size_t len)
23 +{
24 + xReq *req;
25 + WORD64ALIGN
26 + if (dpy->bufptr + len > dpy->bufmax)
27 + _XFlush(dpy);
28 + dpy->last_req = dpy->bufptr;
29 + req = (xReq*)dpy->bufptr;
30 + req->reqType = type;
31 + req->length = len / 4;
32 + dpy->bufptr += len;
33 + dpy->request++;
34 + return req;
35 +}
36 +
37 static int x11_load_refcount = 0;
39 void SDL_X11_UnloadSymbols(void)
40 @@ -168,6 +183,15 @@ int SDL_X11_LoadSymbols(void)
41 X11_GetSym("XGetICValues",&SDL_X11_HAVE_UTF8,(void **)&pXGetICValues);
42 #endif
44 + /*
45 + * In case we're built with newer Xlib headers, we need to make sure
46 + * that _XGetRequest() is available, even on older systems.
47 + * Otherwise, various Xlib macros we use will call a NULL pointer.
48 + */
49 + if (!SDL_X11_HAVE_XGETREQUEST) {
50 + p_XGetRequest = SDL_XGetRequest_workaround;
51 + }
52 +
53 if (SDL_X11_HAVE_BASEXLIB) { /* all required symbols loaded. */
54 SDL_ClearError();
55 } else {
56 --- a/src/video/x11/SDL_x11sym.h
57 +++ a/src/video/x11/SDL_x11sym.h
58 @@ -170,6 +170,12 @@ SDL_X11_SYM(void,_XRead32,(Display *dpy,register long *data,long len),(dpy,data,
59 #endif
61 /*
62 + * libX11 1.4.99.1 added _XGetRequest, and macros use it behind the scenes.
63 + */
64 +SDL_X11_MODULE(XGETREQUEST)
65 +SDL_X11_SYM(void *,_XGetRequest,(Display* a,CARD8 b,size_t c),(a,b,c),return)
66 +
67 +/*
68 * These only show up on some variants of Unix.
69 */
70 #if defined(__osf__)