Here is an update to SDL 2.0.14. Tested with a few apps. More testing and feedback welcome.
--------------------------------------------------------------------------- 2.0.14: --------------------------------------------------------------------------- General: * Added support for PS5 DualSense and Xbox Series X controllers to the HIDAPI controller driver * Added game controller button constants for paddles and new buttons * Added game controller functions to get additional information: * SDL_GameControllerGetSerial() * SDL_GameControllerHasAxis() * SDL_GameControllerHasButton() * SDL_GameControllerGetNumTouchpads() * SDL_GameControllerGetNumTouchpadFingers() * SDL_GameControllerGetTouchpadFinger() * SDL_GameControllerHasSensor() * SDL_GameControllerSetSensorEnabled() * SDL_GameControllerIsSensorEnabled() * SDL_GameControllerGetSensorData() * SDL_GameControllerRumbleTriggers() * SDL_GameControllerHasLED() * SDL_GameControllerSetLED() * Added the hint SDL_HINT_JOYSTICK_HIDAPI_PS5 to control whether the HIDAPI driver for PS5 controllers should be used. * Added joystick functions to get additional information: * SDL_JoystickGetSerial() * SDL_JoystickRumbleTriggers() * SDL_JoystickHasLED() * SDL_JoystickSetLED() * Added an API to allow the application to create virtual joysticks: * SDL_JoystickAttachVirtual() * SDL_JoystickDetachVirtual() * SDL_JoystickIsVirtual() * SDL_JoystickSetVirtualAxis() * SDL_JoystickSetVirtualButton() * SDL_JoystickSetVirtualHat() * Added SDL_LockSensors() and SDL_UnlockSensors() to guarantee exclusive access to the sensor list * Added SDL_HAPTIC_STEERING_AXIS to play an effect on the steering wheel * Added the hint SDL_HINT_MOUSE_RELATIVE_SCALING to control whether relative motion is scaled by the screen DPI or renderer logical size * The default value for SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS is now false for better compatibility with modern window managers * Added SDL_GetPreferredLocales() to get the application's current locale setting * Added the hint SDL_HINT_PREFERRED_LOCALES to override your application's default locale setting * Added SDL_OpenURL() to open a URL in the system's default browser * Added SDL_HasSurfaceRLE() to tell whether a surface is currently using RLE encoding * Added SDL_SIMDRealloc() to reallocate memory obtained from SDL_SIMDAlloc() * Added SDL_GetErrorMsg() to get the last error in a thread-safe way * Added SDL_crc32(), SDL_wcscasecmp(), SDL_wcsncasecmp(), SDL_trunc(), SDL_truncf() * Added clearer names for RGB pixel formats, e.g. SDL_PIXELFORMAT_XRGB8888, SDL_PIXELFORMAT_XBGR8888, etc. Linux: * Added the hint SDL_HINT_AUDIO_DEVICE_APP_NAME to specify the name that shows up in PulseAudio for your application * Added the hint SDL_HINT_AUDIO_DEVICE_STREAM_NAME to specify the name that shows up in PulseAudio associated with your audio stream * Added the hint SDL_HINT_LINUX_JOYSTICK_DEADZONES to control whether HID defined dead zones should be respected on Linux * Added the hint SDL_HINT_THREAD_PRIORITY_POLICY to specify the thread scheduler policy * Added the hint SDL_HINT_THREAD_FORCE_REALTIME_TIME_CRITICAL to allow time critical threads to use a realtime scheduling policy Index: Makefile =================================================================== RCS file: /home/cvs/ports/devel/sdl2/Makefile,v retrieving revision 1.31 diff -u -p -u -p -r1.31 Makefile --- Makefile 24 May 2020 03:24:54 -0000 1.31 +++ Makefile 25 Dec 2020 02:36:44 -0000 @@ -2,13 +2,13 @@ COMMENT= cross-platform multimedia library -V= 2.0.12 +V= 2.0.14 DISTNAME= SDL2-${V} PKGNAME= sdl2-${V} CATEGORIES= devel MASTER_SITES= https://www.libsdl.org/release/ -SHARED_LIBS= SDL2 0.8 # 0.12 +SHARED_LIBS= SDL2 0.9 # 0.12 HOMEPAGE= https://www.libsdl.org/ @@ -19,10 +19,10 @@ DEBUG_PACKAGES= ${BUILD_PACKAGES} # zlib PERMIT_PACKAGE= Yes -WANTLIB= m pthread sndio usbhid samplerate -# GL/Xau/Xdmcp are dlopen'd by SDL -WANTLIB+= GL X11 Xau xcb Xcursor Xdmcp Xext Xfixes Xi Xinerama -WANTLIB+= Xrandr Xrender Xss Xxf86vm +WANTLIB+= X11 Xcursor Xext Xfixes Xi Xinerama Xrandr Xrender Xss +WANTLIB+= Xxf86vm m pthread samplerate sndio usbhid xcb +# GL and X11 libraries are dlopen'd by SDL +WANTLIB+= GL LIB_DEPENDS= audio/libsamplerate @@ -30,14 +30,12 @@ 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-hidapi \ --disable-jack \ --disable-libsamplerate-shared \ --disable-libudev \ @@ -46,17 +44,11 @@ CONFIGURE_ARGS+= --disable-alsa \ --disable-pulseaudio \ --disable-sndio-shared \ --disable-x11-shared -# 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+= CPPFLAGS="-I${LOCALBASE}/include" \ + LDFLAGS="-L${LOCALBASE}/lib" .if ${MACHINE_ARCH} == "hppa" CONFIGURE_ARGS+= --disable-atomic -.endif - -# clang can't handle simd asm -.if ${MACHINE_ARCH} == "arm" -CONFIGURE_ARGS+= --disable-arm-simd .endif # tests in test subdir, but interactive and not hooked up to build Index: distinfo =================================================================== RCS file: /home/cvs/ports/devel/sdl2/distinfo,v retrieving revision 1.10 diff -u -p -u -p -r1.10 distinfo --- distinfo 1 Apr 2020 20:43:08 -0000 1.10 +++ distinfo 24 Dec 2020 21:26:47 -0000 @@ -1,2 +1,2 @@ -SHA256 (SDL2-2.0.12.tar.gz) = NJJo9pXALvvJuRSKcLheWM77v3BKvT6RvmVNt/HiyGM= -SIZE (SDL2-2.0.12.tar.gz) = 5720162 +SHA256 (SDL2-2.0.14.tar.gz) = 2CFbVxpYG+EzLSEG+ANvywPRKnC64B4g9CSXbSdUMrw= +SIZE (SDL2-2.0.14.tar.gz) = 6089974 Index: patches/patch-Makefile_in =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-Makefile_in,v retrieving revision 1.8 diff -u -p -u -p -r1.8 patch-Makefile_in --- patches/patch-Makefile_in 1 Apr 2020 20:43:08 -0000 1.8 +++ patches/patch-Makefile_in 15 Nov 2020 03:29:18 -0000 @@ -3,12 +3,12 @@ $OpenBSD: patch-Makefile_in,v 1.8 2020/0 Index: Makefile.in --- Makefile.in.orig +++ Makefile.in -@@ -126,7 +126,7 @@ LT_AGE = @LT_AGE@ +@@ -129,7 +129,7 @@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ -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) ++LT_LDFLAGS = -no-undefined -rpath $(libdir) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) all: $(srcdir)/configure Makefile $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) Index: patches/patch-sdl2-config_cmake_in =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-sdl2-config_cmake_in,v retrieving revision 1.1 diff -u -p -u -p -r1.1 patch-sdl2-config_cmake_in --- patches/patch-sdl2-config_cmake_in 1 Apr 2020 20:43:08 -0000 1.1 +++ patches/patch-sdl2-config_cmake_in 26 Jun 2020 06:02:45 -0000 @@ -13,25 +13,25 @@ Index: sdl2-config.cmake.in - # This may require "libdir" beeing set (from above) - string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS "@SDL_RLD_FLAGS@ @SDL_LIBS@ ") - string(STRIP "${SDL2_EXTRA_LINK_FLAGS}" SDL2_EXTRA_LINK_FLAGS) -- string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_RLD_FLAGS@ @SDL_STATIC_LIBS@ ") +- string(REPLACE "-lSDL2 " "" SDL2_EXTRA_LINK_FLAGS_STATIC "@SDL_STATIC_LIBS@ ") - string(STRIP "${SDL2_EXTRA_LINK_FLAGS_STATIC}" SDL2_EXTRA_LINK_FLAGS_STATIC) - - add_library(SDL2::SDL2 SHARED IMPORTED) - set_target_properties(SDL2::SDL2 PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "@libdir@/libSDL2.so" +- IMPORTED_LOCATION "@libdir@/${CMAKE_SHARED_LIBRARY_PREFIX}SDL2${CMAKE_SHARED_LIBRARY_SUFFIX}" - INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS}") - - add_library(SDL2::SDL2-static STATIC IMPORTED) - set_target_properties(SDL2::SDL2-static PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "@includedir@/SDL2" - IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "@libdir@/libSDL2.a" +- IMPORTED_LOCATION "@libdir@/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2${CMAKE_STATIC_LIBRARY_SUFFIX}" - INTERFACE_LINK_LIBRARIES "${SDL2_EXTRA_LINK_FLAGS_STATIC}") - - add_library(SDL2::SDL2main STATIC IMPORTED) - set_target_properties(SDL2::SDL2main PROPERTIES - IMPORTED_LINK_INTERFACE_LANGUAGES "C" -- IMPORTED_LOCATION "@libdir@/libSDL2main.a") +- IMPORTED_LOCATION "@libdir@/${CMAKE_STATIC_LIBRARY_PREFIX}SDL2main${CMAKE_STATIC_LIBRARY_SUFFIX}") -endif() Index: patches/patch-sdl2_pc_in =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-sdl2_pc_in,v retrieving revision 1.2 diff -u -p -u -p -r1.2 patch-sdl2_pc_in --- patches/patch-sdl2_pc_in 1 Apr 2020 20:43:08 -0000 1.2 +++ patches/patch-sdl2_pc_in 26 Jun 2020 06:02:26 -0000 @@ -3,12 +3,11 @@ $OpenBSD: patch-sdl2_pc_in,v 1.2 2020/04 Index: sdl2.pc.in --- sdl2.pc.in.orig +++ sdl2.pc.in -@@ -10,6 +10,5 @@ Description: Simple DirectMedia Layer is a cross-platf +@@ -10,5 +10,5 @@ Description: Simple DirectMedia Layer is a cross-platf Version: @SDL_VERSION@ Requires: Conflicts: --Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ --Libs.private: @SDL_STATIC_LIBS@ +-Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @PKG_CONFIG_LIBS_PRIV@ @SDL_STATIC_LIBS@ -Cflags: -I${includedir}/SDL2 @SDL_CFLAGS@ +Libs: -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ @X_LIBS@ +Cflags: -I${includedir}/SDL2 @SDL_CFLAGS@ @X_CFLAGS@ Index: patches/patch-src_SDL_c =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-src_SDL_c,v retrieving revision 1.4 diff -u -p -u -p -r1.4 patch-src_SDL_c --- patches/patch-src_SDL_c 1 Apr 2020 20:43:08 -0000 1.4 +++ patches/patch-src_SDL_c 15 Nov 2020 03:29:14 -0000 @@ -7,7 +7,7 @@ until OpenBSD support has been rolled ou Index: src/SDL.c --- src/SDL.c.orig +++ src/SDL.c -@@ -263,8 +263,6 @@ SDL_InitSubSystem(Uint32 flags) +@@ -273,8 +273,6 @@ SDL_InitSubSystem(Uint32 flags) } } SDL_PrivateSubsystemRefCountIncr(SDL_INIT_HAPTIC); @@ -16,7 +16,7 @@ Index: src/SDL.c #endif } -@@ -489,7 +487,7 @@ SDL_GetPlatform() +@@ -506,7 +504,7 @@ SDL_GetPlatform() #elif __NETBSD__ return "NetBSD"; #elif __OPENBSD__ Index: patches/patch-src_joystick_SDL_gamecontroller_c =================================================================== RCS file: /home/cvs/ports/devel/sdl2/patches/patch-src_joystick_SDL_gamecontroller_c,v retrieving revision 1.6 diff -u -p -u -p -r1.6 patch-src_joystick_SDL_gamecontroller_c --- patches/patch-src_joystick_SDL_gamecontroller_c 24 May 2020 03:24:54 -0000 1.6 +++ patches/patch-src_joystick_SDL_gamecontroller_c 24 Dec 2020 21:27:47 -0000 @@ -11,7 +11,7 @@ many controllers use this mapping Index: src/joystick/SDL_gamecontroller.c --- src/joystick/SDL_gamecontroller.c.orig +++ src/joystick/SDL_gamecontroller.c -@@ -739,7 +739,7 @@ static char *SDL_PrivateGetControllerGUIDFromMappingSt +@@ -968,7 +968,7 @@ static char *SDL_PrivateGetControllerGUIDFromMappingSt SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); SDL_memcpy(&pchGUID[0], "03000000", 8); } @@ -20,10 +20,10 @@ Index: src/joystick/SDL_gamecontroller.c if (SDL_strlen(pchGUID) == 32 && SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 && SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) { -@@ -1026,17 +1026,21 @@ static ControllerMapping_t *SDL_PrivateGetControllerMa +@@ -1131,17 +1131,21 @@ static ControllerMapping_t *SDL_PrivateGetControllerMa ControllerMapping_t *mapping; - mapping = SDL_PrivateGetControllerMappingForGUID(&guid, SDL_FALSE); + mapping = SDL_PrivateGetControllerMappingForGUID(guid, SDL_FALSE); -#ifdef __LINUX__ +#if defined(__LINUX__) || defined(__OpenBSD__) if (!mapping && name) { @@ -37,9 +37,8 @@ Index: src/joystick/SDL_gamecontroller.c + if (SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG) == NULL) { 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); +"none,XBox360 Controller,a:b7,b:b8,back:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b2,lefttrigger:a2,leftx:a0,lefty:a1~,rightshoulder:b5,rightstick:b3,righttrigger:a5,rightx:a3,righty:a4~,start:b0,x:b9,y:b10", -+ &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); + &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); + } else { + mapping = SDL_PrivateAddMappingForGUID(guid, SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG), &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } @@ -47,5 +46,5 @@ Index: src/joystick/SDL_gamecontroller.c -#endif /* __LINUX__ */ +#endif /* __LINUX__ || __OpenBSD__ */ - if (!mapping && name) { + if (!mapping && name && !SDL_IsJoystickWGI(guid)) { if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box") || SDL_strstr(name, "XBOX")) { Index: patches/patch-src_video_SDL_egl_c =================================================================== RCS file: patches/patch-src_video_SDL_egl_c diff -N patches/patch-src_video_SDL_egl_c --- patches/patch-src_video_SDL_egl_c 1 Apr 2020 20:43:08 -0000 1.5 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,19 +0,0 @@ -$OpenBSD: patch-src_video_SDL_egl_c,v 1.5 2020/04/01 20:43:08 naddy Exp $ - -Index: src/video/SDL_egl.c ---- src/video/SDL_egl.c.orig -+++ src/video/SDL_egl.c -@@ -73,6 +73,13 @@ - #define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib" //??? - #define DEFAULT_OGL_ES "libGLESv1_CM.dylib" //??? - -+#elif defined(__OpenBSD__) -+#define DEFAULT_OGL "libGL.so" -+#define DEFAULT_EGL "libEGL.so" -+#define DEFAULT_OGL_ES2 "libGLESv2.so" -+#define DEFAULT_OGL_ES_PVR "libGLES_CM.so" -+#define DEFAULT_OGL_ES "libGLESv1_CM.so" -+ - #else - /* Desktop Linux */ - #define DEFAULT_OGL "libGL.so.1" Index: patches/patch-src_video_wayland_SDL_waylandvulkan_c =================================================================== RCS file: patches/patch-src_video_wayland_SDL_waylandvulkan_c diff -N patches/patch-src_video_wayland_SDL_waylandvulkan_c --- patches/patch-src_video_wayland_SDL_waylandvulkan_c 23 Mar 2019 05:27:33 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -$OpenBSD: patch-src_video_wayland_SDL_waylandvulkan_c,v 1.1 2019/03/23 05:27:33 jsg Exp $ - -Index: src/video/wayland/SDL_waylandvulkan.c ---- src/video/wayland/SDL_waylandvulkan.c.orig -+++ src/video/wayland/SDL_waylandvulkan.c -@@ -50,7 +50,7 @@ int Wayland_Vulkan_LoadLibrary(_THIS, const char *path - if(!path) - path = SDL_getenv("SDL_VULKAN_LIBRARY"); - if(!path) -- path = "libvulkan.so.1"; -+ path = "libvulkan.so"; - _this->vulkan_config.loader_handle = SDL_LoadObject(path); - if(!_this->vulkan_config.loader_handle) - return -1; Index: patches/patch-src_video_x11_SDL_x11opengl_c =================================================================== RCS file: patches/patch-src_video_x11_SDL_x11opengl_c diff -N patches/patch-src_video_x11_SDL_x11opengl_c --- patches/patch-src_video_x11_SDL_x11opengl_c 1 Apr 2020 20:43:08 -0000 1.3 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -$OpenBSD: patch-src_video_x11_SDL_x11opengl_c,v 1.3 2020/04/01 20:43:08 naddy Exp $ - -Index: src/video/x11/SDL_x11opengl.c ---- src/video/x11/SDL_x11opengl.c.orig -+++ src/video/x11/SDL_x11opengl.c -@@ -32,7 +32,7 @@ - #include "SDL_loadso.h" - #include "SDL_x11opengles.h" - --#if defined(__IRIX__) -+#if defined(__IRIX__) || defined(__OpenBSD__) - /* IRIX doesn't have a GL library versioning system */ - #define DEFAULT_OPENGL "libGL.so" - #elif defined(__MACOSX__) Index: patches/patch-src_video_x11_SDL_x11vulkan_c =================================================================== RCS file: patches/patch-src_video_x11_SDL_x11vulkan_c diff -N patches/patch-src_video_x11_SDL_x11vulkan_c --- patches/patch-src_video_x11_SDL_x11vulkan_c 23 Mar 2019 05:27:33 -0000 1.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ -$OpenBSD: patch-src_video_x11_SDL_x11vulkan_c,v 1.1 2019/03/23 05:27:33 jsg Exp $ - -Index: src/video/x11/SDL_x11vulkan.c ---- src/video/x11/SDL_x11vulkan.c.orig -+++ src/video/x11/SDL_x11vulkan.c -@@ -52,7 +52,7 @@ int X11_Vulkan_LoadLibrary(_THIS, const char *path) - if(!path) - path = SDL_getenv("SDL_VULKAN_LIBRARY"); - if(!path) -- path = "libvulkan.so.1"; -+ path = "libvulkan.so"; - _this->vulkan_config.loader_handle = SDL_LoadObject(path); - if(!_this->vulkan_config.loader_handle) - return -1; Index: pkg/PLIST =================================================================== RCS file: /home/cvs/ports/devel/sdl2/pkg/PLIST,v retrieving revision 1.9 diff -u -p -u -p -r1.9 PLIST --- pkg/PLIST 1 Apr 2020 20:43:08 -0000 1.9 +++ pkg/PLIST 15 Nov 2020 03:36:01 -0000 @@ -23,10 +23,12 @@ include/SDL2/SDL_joystick.h include/SDL2/SDL_keyboard.h include/SDL2/SDL_keycode.h include/SDL2/SDL_loadso.h +include/SDL2/SDL_locale.h include/SDL2/SDL_log.h include/SDL2/SDL_main.h include/SDL2/SDL_messagebox.h include/SDL2/SDL_metal.h +include/SDL2/SDL_misc.h include/SDL2/SDL_mouse.h include/SDL2/SDL_mutex.h include/SDL2/SDL_name.h @@ -75,7 +77,6 @@ include/SDL2/SDL_video.h include/SDL2/SDL_vulkan.h include/SDL2/begin_code.h include/SDL2/close_code.h -lib/cmake/ lib/cmake/SDL2/ lib/cmake/SDL2/sdl2-config-version.cmake lib/cmake/SDL2/sdl2-config.cmake