Prepared updated diff after some off-list discussion with awolk@ and sthen@. I've tested it with the consumers that I had anything to run with (I don't have roms to test emulators and none of the id games).
The following consumers run with brief testing of 2-5 minutes: audiality2,sdl2-gfx/-net(via manaplus),sdl2-image/-mixer(via cataclysm), 0ad,blobwars,cataclysm-dda,chromium-bsu,koboredux,lugaru,megaglest, neverball,redeclipse(1.6.0),scummvm,sdlpop,starfighter,stone-soup, tbftss,tome4,warzone2100,imv,mpv The only one that doesn't run of the tested ports is speeddreams, but I understand this didn't launch with SDL2 for a different reason prior to this (https://marc.info/?l=openbsd-ports&m=151415029920289&w=2). Speed dreams may need a closer look then at some point. Here is the console log that I'm getting: https://pastebin.com/TrKWBbeH Some points about the diff: - disabled jack audio which is otherwise built now - now ldepends on libsamplerate - it seems that several applications like speed dreams, sdl-jstest, and FNA games only accept gamecontroller API if haptic (force feedback) is supported. This patch circumvents this by not returning SDL_SetError in that case, working at least with sdl-jstest and FNA games, and removing at least this error message from speed dreams - the x11window patch is no longer needed (upstream fixed it) Index: Makefile =================================================================== RCS file: /cvs/ports/devel/sdl2/Makefile,v retrieving revision 1.18 diff -u -p -r1.18 Makefile --- Makefile 23 Oct 2017 17:10:38 -0000 1.18 +++ Makefile 7 Jan 2018 20:04:41 -0000 @@ -1,19 +1,23 @@ # $OpenBSD: Makefile,v 1.18 2017/10/23 17:10:38 sthen Exp $ COMMENT= cross-platform multimedia library -BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: \#error Please implement for your platform. +BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: \ + #error Please implement for your platform. -V= 2.0.5 -REVISION= 2 +V= 2.0.7 DISTNAME= SDL2-${V} PKGNAME= sdl2-${V} CATEGORIES= devel MASTER_SITES= http://www.libsdl.org/release/ -SHARED_LIBS= SDL2 0.3 +SHARED_LIBS= SDL2 0.4 # 0.7 + +LIB_DEPENDS= audio/libsamplerate HOMEPAGE= http://www.libsdl.org/ +MAINTANER= Thomas Frohwein <[email protected]> + # zlib PERMIT_PACKAGE_CDROM= Yes @@ -29,6 +33,7 @@ CONFIGURE_ARGS+= --disable-alsa \ --disable-dbus \ --disable-esd \ --disable-ibus \ + --disable-jack \ --disable-libudev \ --disable-nas \ --disable-oss \ @@ -37,7 +42,7 @@ CONFIGURE_ARGS+= --disable-alsa \ CONFIGURE_ENV+= ac_cv_lib_usb_hid_init=no \ ac_cv_header_usb_h=no -WANTLIB= m pthread sndio usbhid +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 Index: distinfo =================================================================== RCS file: /cvs/ports/devel/sdl2/distinfo,v retrieving revision 1.5 diff -u -p -r1.5 distinfo --- distinfo 10 Nov 2016 10:08:04 -0000 1.5 +++ distinfo 7 Jan 2018 20:04:41 -0000 @@ -1,2 +1,2 @@ -SHA256 (SDL2-2.0.5.tar.gz) = RCA4z1WWWWny/wbZdgMYE95kOvnJ7cnjMb12HCQuh4U= -SIZE (SDL2-2.0.5.tar.gz) = 4209352 +SHA256 (SDL2-2.0.7.tar.gz) = 7jXHTEMT4u2hBLFLG4b324SgTuq5Qw1W4AHOomi/TV4= +SIZE (SDL2-2.0.7.tar.gz) = 4432499 Index: patches/patch-Makefile_in =================================================================== RCS file: /cvs/ports/devel/sdl2/patches/patch-Makefile_in,v retrieving revision 1.3 diff -u -p -r1.3 patch-Makefile_in --- patches/patch-Makefile_in 10 Nov 2016 10:08:04 -0000 1.3 +++ patches/patch-Makefile_in 7 Jan 2018 20:04:41 -0000 @@ -1,11 +1,14 @@ $OpenBSD: patch-Makefile_in,v 1.3 2016/11/10 10:08:04 jca Exp $ ---- Makefile.in.orig Thu Oct 20 05:56:26 2016 -+++ Makefile.in Thu Oct 20 22:23:28 2016 -@@ -121,7 +121,7 @@ LT_AGE = @LT_AGE@ + +Should make sure only libSDL2, not libSDL2-2.0 are installed +Index: Makefile.in +--- Makefile.in.orig ++++ Makefile.in +@@ -122,7 +122,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 $(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) $(objects)/$(SDLTEST_TARGET) Index: patches/patch-src_SDL_c =================================================================== RCS file: patches/patch-src_SDL_c diff -N patches/patch-src_SDL_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_SDL_c 7 Jan 2018 20:04:41 -0000 @@ -0,0 +1,27 @@ +$OpenBSD$ + +disable breaking if no haptic feedback support which disallows gamecontroller API +pretend to be Linux in SDL_GetPlatform to allow compatibility with FNA games +until OpenBSD support has been rolled out (estimated end of 2018) + +Index: src/SDL.c +--- src/SDL.c.orig ++++ src/SDL.c +@@ -227,8 +227,6 @@ SDL_InitSubSystem(Uint32 flags) + } + } + SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC); +-#else +- return SDL_SetError("SDL not built with haptic (force feedback) support"); + #endif + } + +@@ -425,7 +423,7 @@ SDL_GetPlatform() + #elif __NETBSD__ + return "NetBSD"; + #elif __OPENBSD__ +- return "OpenBSD"; ++ return "Linux"; + #elif __OS2__ + return "OS/2"; + #elif __OSF__ Index: patches/patch-src_filesystem_unix_SDL_sysfilesystem_c =================================================================== RCS file: /cvs/ports/devel/sdl2/patches/patch-src_filesystem_unix_SDL_sysfilesystem_c,v retrieving revision 1.1 diff -u -p -r1.1 patch-src_filesystem_unix_SDL_sysfilesystem_c --- patches/patch-src_filesystem_unix_SDL_sysfilesystem_c 10 Nov 2016 10:08:04 -0000 1.1 +++ patches/patch-src_filesystem_unix_SDL_sysfilesystem_c 7 Jan 2018 20:04:41 -0000 @@ -2,9 +2,10 @@ $OpenBSD: patch-src_filesystem_unix_SDL_ Disable SDL_GetBasePath implementation, not functional. ---- src/filesystem/unix/SDL_sysfilesystem.c.orig Thu Oct 20 05:56:26 2016 -+++ src/filesystem/unix/SDL_sysfilesystem.c Fri Oct 21 15:15:01 2016 -@@ -91,24 +91,6 @@ SDL_GetBasePath(void) +Index: src/filesystem/unix/SDL_sysfilesystem.c +--- src/filesystem/unix/SDL_sysfilesystem.c.orig ++++ src/filesystem/unix/SDL_sysfilesystem.c +@@ -95,24 +95,6 @@ SDL_GetBasePath(void) } } #endif Index: patches/patch-src_joystick_SDL_gamecontroller_c =================================================================== RCS file: patches/patch-src_joystick_SDL_gamecontroller_c diff -N patches/patch-src_joystick_SDL_gamecontroller_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-src_joystick_SDL_gamecontroller_c 7 Jan 2018 20:04:41 -0000 @@ -0,0 +1,30 @@ +$OpenBSD$ + +enable GameController API the Linux way (by posing as Xbox360 controller) +also disable checking string "Xbox 360 Wireless Receiver", so for now +everything will be Xbox360 controller (works with generic joysticks) +- note: the actual Xbox360 controller has buttons and axes messed up on + openbsd with these mappings + +Index: src/joystick/SDL_gamecontroller.c +--- src/joystick/SDL_gamecontroller.c.orig ++++ src/joystick/SDL_gamecontroller.c +@@ -884,15 +884,15 @@ static ControllerMapping_t *SDL_PrivateGetControllerMa + #else + (void) s_pEmscriptenMapping; /* pacify ARMCC */ + #endif +-#ifdef __LINUX__ ++#if defined(__LINUX__) || defined(__OpenBSD__) + if (!mapping && name) { +- if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { ++ //if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { + /* The Linux driver xpad.c maps the wireless dpad to buttons */ + SDL_bool existing; + mapping = SDL_PrivateAddMappingForGUID(guid, + "none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); +- } ++ //} + } + #endif /* __LINUX__ */ + Index: patches/patch-src_video_SDL_egl_c =================================================================== RCS file: /cvs/ports/devel/sdl2/patches/patch-src_video_SDL_egl_c,v retrieving revision 1.1 diff -u -p -r1.1 patch-src_video_SDL_egl_c --- patches/patch-src_video_SDL_egl_c 7 Jan 2016 04:49:37 -0000 1.1 +++ patches/patch-src_video_SDL_egl_c 7 Jan 2018 20:04:41 -0000 @@ -1,7 +1,8 @@ $OpenBSD: patch-src_video_SDL_egl_c,v 1.1 2016/01/07 04:49:37 jsg Exp $ ---- src/video/SDL_egl.c.orig Sun Jan 3 11:47:58 2016 -+++ src/video/SDL_egl.c Sun Jan 3 11:49:32 2016 -@@ -58,7 +58,12 @@ +Index: src/video/SDL_egl.c +--- src/video/SDL_egl.c.orig ++++ src/video/SDL_egl.c +@@ -64,7 +64,12 @@ #define DEFAULT_OGL_ES2 "libGLESv2.dll" #define DEFAULT_OGL_ES_PVR "libGLES_CM.dll" #define DEFAULT_OGL_ES "libGLESv1_CM.dll" Index: patches/patch-src_video_x11_SDL_x11opengl_c =================================================================== RCS file: /cvs/ports/devel/sdl2/patches/patch-src_video_x11_SDL_x11opengl_c,v retrieving revision 1.1.1.1 diff -u -p -r1.1.1.1 patch-src_video_x11_SDL_x11opengl_c --- patches/patch-src_video_x11_SDL_x11opengl_c 30 Oct 2013 18:11:11 -0000 1.1.1.1 +++ patches/patch-src_video_x11_SDL_x11opengl_c 7 Jan 2018 20:04:41 -0000 @@ -1,7 +1,7 @@ $OpenBSD: patch-src_video_x11_SDL_x11opengl_c,v 1.1.1.1 2013/10/30 18:11:11 bcallah Exp $ --- src/video/x11/SDL_x11opengl.c.orig Fri Sep 20 16:47:56 2013 +++ src/video/x11/SDL_x11opengl.c Fri Sep 20 16:48:19 2013 -@@ -31,7 +31,7 @@ +@@ -32,7 +32,7 @@ #include "SDL_loadso.h" #include "SDL_x11opengles.h" Index: patches/patch-src_video_x11_SDL_x11window_c =================================================================== RCS file: patches/patch-src_video_x11_SDL_x11window_c diff -N patches/patch-src_video_x11_SDL_x11window_c --- patches/patch-src_video_x11_SDL_x11window_c 6 Jul 2017 05:32:32 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,20 +0,0 @@ -$OpenBSD: patch-src_video_x11_SDL_x11window_c,v 1.3 2017/07/06 05:32:32 landry Exp $ - -The Xlib documentation demands that 32-bit values here be passed in a long, -even when long itself isn't a 32-bit value. Otherwise libx11 might read -memory incorrectly (Bugzilla #3692). - -97c66d81b2c9 upstream. - -Index: src/video/x11/SDL_x11window.c ---- src/video/x11/SDL_x11window.c.orig -+++ src/video/x11/SDL_x11window.c -@@ -376,7 +376,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) - Atom _NET_WM_WINDOW_TYPE; - Atom wintype; - const char *wintype_name = NULL; -- int compositor = 1; -+ long compositor = 1; - Atom _NET_WM_PID; - Atom XdndAware, xdnd_version = 5; - long fevent = 0; Index: pkg/PLIST =================================================================== RCS file: /cvs/ports/devel/sdl2/pkg/PLIST,v retrieving revision 1.3 diff -u -p -r1.3 PLIST --- pkg/PLIST 7 Jan 2016 04:49:37 -0000 1.3 +++ pkg/PLIST 7 Jan 2018 20:04:41 -0000 @@ -1,5 +1,5 @@ @comment $OpenBSD: PLIST,v 1.3 2016/01/07 04:49:37 jsg Exp $ -bin/sdl2-config +@bin bin/sdl2-config include/SDL2/ include/SDL2/SDL.h include/SDL2/SDL_assert.h @@ -62,6 +62,7 @@ include/SDL2/SDL_test_harness.h include/SDL2/SDL_test_images.h include/SDL2/SDL_test_log.h include/SDL2/SDL_test_md5.h +include/SDL2/SDL_test_memory.h include/SDL2/SDL_test_random.h include/SDL2/SDL_thread.h include/SDL2/SDL_timer.h @@ -69,6 +70,7 @@ include/SDL2/SDL_touch.h include/SDL2/SDL_types.h include/SDL2/SDL_version.h include/SDL2/SDL_video.h +include/SDL2/SDL_vulkan.h include/SDL2/begin_code.h include/SDL2/close_code.h lib/cmake/ @@ -78,7 +80,8 @@ lib/libSDL2.a lib/libSDL2.la @lib lib/libSDL2.so.${LIBSDL2_VERSION} lib/libSDL2_test.a +lib/libSDL2_test.la lib/libSDL2main.a +lib/libSDL2main.la lib/pkgconfig/sdl2.pc -share/aclocal/ share/aclocal/sdl2.m4
