Sunday, October 21, 2018

devel/sdl2: fix for macppc init crash

Hi,

George Koehler ( kernigh () gmail DOT com ) reports that all devel/sdl2 crash
on init on macppc. The reason seems to be an inappropriate bool type. The patch
below for SDL_x11keyboard.c fixes the issue according to George. This has been
merged by upstream along with another change to the types for
XkbSetDetectableAutoRepeat.

The diff below includes both patches, along with formatting of the Makefile to
align it with more commonly used formatting (space before '='). While this may
be harder to review, the Makefile only contains REVISION bump and a change of
MAINTAINER email address.

I tested sdl2 with these changes on amd64 with cataclysm-dda, milkytracker,
citra, dolphin, endless-sky. All of them run on brief testing without issues.

ok to import?

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2/Makefile,v
retrieving revision 1.22
diff -u -p -r1.22 Makefile
--- Makefile 4 Sep 2018 12:46:11 -0000 1.22
+++ Makefile 21 Oct 2018 18:11:03 -0000
@@ -1,52 +1,52 @@
# $OpenBSD: Makefile,v 1.22 2018/09/04 12:46:11 espie Exp $

-COMMENT= cross-platform multimedia library
-BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: \
+COMMENT = cross-platform multimedia library
+BROKEN-hppa = src/atomic/SDL_spinlock.c:101:2: error: \
#error Please implement for your platform.

-V= 2.0.8
-DISTNAME= SDL2-${V}
-PKGNAME= sdl2-${V}
-CATEGORIES= devel
-MASTER_SITES= https://www.libsdl.org/release/
-REVISION=
0
+V = 2.0.8
+DISTNAME = SDL2-${V}
+PKGNAME = sdl2-${V}
+CATEGORIES = devel
+MASTER_SITES = https://www.libsdl.org/release/
+REVISION = 1

-SHARED_LIBS= SDL2 0.5 # 0.8
+SHARED_LIBS = SDL2 0.5 # 0.8

-HOMEPAGE= https://www.libsdl.org/
+HOMEPAGE = https://www.libsdl.org/

-MAINTAINER= Thomas Frohwein <frohwein@ymail.com>
+MAINTAINER = Thomas Frohwein <thfr@openbsd.org>

# zlib
-PERMIT_PACKAGE_CDROM= Yes
+PERMIT_PACKAGE_CDROM = Yes

-WANTLIB= m pthread sndio usbhid samplerate
+WANTLIB += m pthread sndio usbhid samplerate
# GL/X11/Xext/Xrender/Xrandr are dlopen'd by SDL
-WANTLIB+= GL X11 Xau Xdmcp Xext Xrandr Xrender xcb
+WANTLIB += GL X11 Xau Xdmcp Xext Xrandr Xrender xcb

-LIB_DEPENDS= audio/libsamplerate
+LIB_DEPENDS = audio/libsamplerate

-USE_GMAKE= Yes
-SEPARATE_BUILD= Yes
-CONFIGURE_STYLE= gnu
-MODGNU_CONFIG_GUESS_DIRS= ${WRKSRC} ${WRKSRC}/build-scripts
-CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" \
- LDFLAGS="-L${LOCALBASE}/lib"
-
-CONFIGURE_ARGS+= --disable-alsa \
- --disable-arts \
- --disable-dbus \
- --disable-esd \
- --disable-ibus \
- --disable-jack \
- --disable-libudev \
- --disable-nas \
- --disable-oss \
- --disable-pulseaudio
+USE_GMAKE = Yes
+SEPARATE_BUILD = Yes
+CONFIGURE_STYLE = gnu
+MODGNU_CONFIG_GUESS_DIRS = ${WRKSRC} ${WRKSRC}/build-scripts
+CONFIGURE_ENV += CPPFLAGS="-I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib"
+
+CONFIGURE_ARGS += --disable-alsa \
+ --disable-arts \
+ --disable-dbus \
+ --disable-esd \
+ --disable-ibus \
+ --disable-jack \
+ --disable-libudev \
+ --disable-nas \
+ --disable-oss \
+ --disable-pulseaudio
# 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
+CONFIGURE_ENV += ac_cv_lib_usb_hid_init=no \
+ ac_cv_header_usb_h=no

-NO_TEST= Yes
+NO_TEST = Yes

.include <bsd.port.mk>
Index: patches/patch-src_video_x11_SDL_x11keyboard_c
===================================================================
RCS file: patches/patch-src_video_x11_SDL_x11keyboard_c
diff -N patches/patch-src_video_x11_SDL_x11keyboard_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_video_x11_SDL_x11keyboard_c 21 Oct 2018 18:11:03 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+fix incorrect function signature that breaks macppc platform (likely any big
+endian platform): "stack overflow in function X11_InitKeyboard"
+included in upstream changeset 9dd351b26dcb (future versions)
+
+Index: src/video/x11/SDL_x11keyboard.c
+--- src/video/x11/SDL_x11keyboard.c.orig
++++ src/video/x11/SDL_x11keyboard.c
+@@ -266,7 +266,9 @@ X11_InitKeyboard(_THIS)
+ int best_distance;
+ int best_index;
+ int distance;
+- BOOL xkb_repeat = 0;
++ Bool xkb_repeat = 0;
+
+ X11_XAutoRepeatOn(data->display);
+
Index: patches/patch-src_video_x11_SDL_x11sym_h
===================================================================
RCS file: patches/patch-src_video_x11_SDL_x11sym_h
diff -N patches/patch-src_video_x11_SDL_x11sym_h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_video_x11_SDL_x11sym_h 21 Oct 2018 18:11:03 -0000
@@ -0,0 +1,18 @@
+$OpenBSD$
+
+fix incorrect function signature that breaks macppc platform (likely any big
+endian platform)
+included in upstream changeset 9dd351b26dcb (future versions)
+
+Index: src/video/x11/SDL_x11sym.h
+--- src/video/x11/SDL_x11sym.h.orig
++++ src/video/x11/SDL_x11sym.h
+@@ -180,7 +180,7 @@ SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsign
+ SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return)
+ SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
+ SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
+-SDL_X11_SYM(BOOL,XkbSetDetectableAutoRepeat,(Display* a, BOOL b, BOOL* c),(a,b,c),return)
++SDL_X11_SYM(Bool,XkbSetDetectableAutoRepeat,(Display* a, Bool b, Bool* c),(a,b,c),return)
+

No comments:

Post a Comment