Hi,
The below diff updates devel/sdl2 to the latest release version 2.26.4.
I've tested runtime with a few applications, including sdl2-jstest and
openra. I've tested building with a sample of the large number of
reverse dependencies, including audacity, faudio, moc, sdl2-gfx,
sdl2-image, sdl2-mixer, sdl2-net, sdl2-ttf, advancemame,
emulationstation, cataclysm-dda, dunelegacy, freedink, openttd,
scummvm, and mpv.
Let me know if it looks ok, but I'm planning to commit this soon if no
feedback.
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2/Makefile,v
retrieving revision 1.42
diff -u -p -r1.42 Makefile
--- Makefile 7 Nov 2022 21:45:15 -0000 1.42
+++ Makefile 29 Mar 2023 21:52:47 -0000
@@ -1,13 +1,12 @@
COMMENT= cross-platform multimedia library
-V= 2.24.1
-REVISION= 0
+V= 2.26.4
DISTNAME= SDL2-${V}
PKGNAME= sdl2-${V}
CATEGORIES= devel
MASTER_SITES= https://www.libsdl.org/release/
-SHARED_LIBS= SDL2 0.12 # 0.18
+SHARED_LIBS= SDL2 0.13 # 2.26.4
HOMEPAGE= https://www.libsdl.org/
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/sdl2/distinfo,v
retrieving revision 1.15
diff -u -p -r1.15 distinfo
--- distinfo 18 Oct 2022 00:56:38 -0000 1.15
+++ distinfo 29 Mar 2023 21:52:47 -0000
@@ -1,2 +1,2 @@
-SHA256 (SDL2-2.24.1.tar.gz) = vBIViLEQUGVZjOOAeAJqQUwo6pXmbtKtq0xE2Aswnhs=
-SIZE (SDL2-2.24.1.tar.gz) = 7523849
+SHA256 (SDL2-2.26.4.tar.gz) = Gg9oZJj7dorZ8/gLOQN6fQBurAk6rTnLTrzIMqiIcjE=
+SIZE (SDL2-2.26.4.tar.gz) = 8084255
Index: patches/patch-Makefile_in
===================================================================
RCS file: /cvs/ports/devel/sdl2/patches/patch-Makefile_in,v
retrieving revision 1.13
diff -u -p -r1.13 patch-Makefile_in
--- patches/patch-Makefile_in 18 Oct 2022 00:56:38 -0000 1.13
+++ patches/patch-Makefile_in 29 Mar 2023 21:52:47 -0000
@@ -1,7 +1,7 @@
Index: Makefile.in
--- Makefile.in.orig
+++ Makefile.in
-@@ -135,7 +135,7 @@ LT_AGE = @LT_AGE@
+@@ -136,7 +136,7 @@ LT_AGE = @LT_AGE@
LT_CURRENT = @LT_CURRENT@
LT_RELEASE = @LT_RELEASE@
LT_REVISION = @LT_REVISION@
Index: patches/patch-sdl2-config_cmake_in
===================================================================
RCS file: patches/patch-sdl2-config_cmake_in
diff -N patches/patch-sdl2-config_cmake_in
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-sdl2-config_cmake_in 29 Mar 2023 21:52:47 -0000
@@ -0,0 +1,12 @@
+Index: sdl2-config.cmake.in
+--- sdl2-config.cmake.in.orig
++++ sdl2-config.cmake.in
+@@ -124,7 +124,7 @@ if(WIN32)
+ unset(_sdl2_implib)
+ unset(_sdl2_dll)
+ else()
+- set(_sdl2_shared "${SDL2_LIBDIR}/libSDL2${CMAKE_SHARED_LIBRARY_SUFFIX}")
++ set(_sdl2_shared
"${SDL2_LIBDIR}/libSDL2${CMAKE_SHARED_LIBRARY_SUFFIX}.${LIBSDL2_VERSION}")
+ if(EXISTS "${_sdl2_shared}")
+ if(NOT TARGET SDL2::SDL2)
+ add_library(SDL2::SDL2 SHARED IMPORTED)
Index: patches/patch-src_SDL_c
===================================================================
RCS file: /cvs/ports/devel/sdl2/patches/patch-src_SDL_c,v
retrieving revision 1.10
diff -u -p -r1.10 patch-src_SDL_c
--- patches/patch-src_SDL_c 18 Oct 2022 00:56:38 -0000 1.10
+++ patches/patch-src_SDL_c 29 Mar 2023 21:52:47 -0000
@@ -4,7 +4,7 @@
Index: src/SDL.c
--- src/SDL.c.orig
+++ src/SDL.c
-@@ -301,9 +301,6 @@ SDL_InitSubSystem(Uint32 flags)
+@@ -303,9 +303,6 @@ SDL_InitSubSystem(Uint32 flags)
}
SDL_PrivateSubsystemRefCountIncr(SDL_INIT_GAMECONTROLLER);
flags_initialized |= SDL_INIT_GAMECONTROLLER;
@@ -14,7 +14,7 @@ Index: src/SDL.c
#endif
}
-@@ -533,6 +530,10 @@ SDL_GetRevisionNumber(void)
+@@ -558,6 +555,10 @@ SDL_GetRevisionNumber(void)
const char *
SDL_GetPlatform(void)
{
Index: patches/patch-src_joystick_SDL_gamecontrollerdb_h
===================================================================
RCS file:
/cvs/ports/devel/sdl2/patches/patch-src_joystick_SDL_gamecontrollerdb_h,v
retrieving revision 1.6
diff -u -p -r1.6 patch-src_joystick_SDL_gamecontrollerdb_h
--- patches/patch-src_joystick_SDL_gamecontrollerdb_h 7 Nov 2022 21:45:15
-0000 1.6
+++ patches/patch-src_joystick_SDL_gamecontrollerdb_h 29 Mar 2023 21:52:47
-0000
@@ -1,12 +1,9 @@
-- Enable controller detection by GUID on OpenBSD
-- Use both Linux and macOS GUIDs to match both XInput and DInput devices
-- Recognize raphnet USB adapter for SNES/NES-mini gamepads (from upstream,
- see https://github.com/libsdl-org/SDL/pull/6485)
+Use both Linux and macOS GUIDs to match both XInput and DInput devices.
Index: src/joystick/SDL_gamecontrollerdb.h
--- src/joystick/SDL_gamecontrollerdb.h.orig
+++ src/joystick/SDL_gamecontrollerdb.h
-@@ -357,7 +357,7 @@ static const char *s_ControllerMappings [] =
+@@ -360,7 +360,7 @@ static const char *s_ControllerMappings [] =
"030000004f04000003d0000000000000,run'n'drive,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b7,leftshoulder:a3,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:a4,rightstick:b11,righttrigger:b5,rightx:a2,righty:a5,start:b9,x:b0,y:b3,",
"03000000101c0000171c000000000000,uRage
Gamepad,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,",
#endif
@@ -15,20 +12,12 @@ Index: src/joystick/SDL_gamecontrollerdb
"03000000c82d00000090000001000000,8BitDo FC30
Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"03000000c82d00000090000001000000,8BitDo FC30
Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"03000000c82d00001038000000010000,8BitDo FC30
Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
-@@ -509,7 +509,7 @@ static const char *s_ControllerMappings [] =
+@@ -517,7 +517,7 @@ static const char *s_ControllerMappings [] =
"03000000830500006020000000010000,iBuffalo SNES
Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"03000000830500006020000000000000,iBuffalo USB 2-axis 8-button
Gamepad,a:b1,b:b0,back:b6,leftshoulder:b4,leftx:a0,lefty:a1,rightshoulder:b5,start:b7,x:b3,y:b2,",
#endif
--#ifdef SDL_JOYSTICK_LINUX
+-#if SDL_JOYSTICK_LINUX
+#if defined(SDL_JOYSTICK_LINUX) || defined(__OpenBSD__)
"xinput,*,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,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,",
"03000000c82d00000090000011010000,8BitDo FC30
Pro,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b3,y:b4,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
"03000000c82d00000090000011010000,8BitDo FC30
Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a5,rightx:a2,righty:a3,start:b11,x:b4,y:b3,hint:!SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
-@@ -846,6 +846,7 @@ static const char *s_ControllerMappings [] =
-
"050000006964726f69643a636f6e0000,idroid:con,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,",
-
"03000000b50700001503000010010000,impact,a:b2,b:b3,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b0,y:b1,",
- "030000009b2800000300000001010000,raphnet.net 4nes4snes
v1.5,a:b0,b:b4,back:b2,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b3,x:b1,y:b5,",
-+ "030000009b2800008000000020020000,raphnet technologies 1-player WUSBMote
v2.2,a:b1,b:b4,x:b0,y:b5,back:b2,start:b3,leftshoulder:b6,rightshoulder:b7,dpup:b12,dpdown:b13,dpleft:b14,dpright:b15,",
- #endif
- #if defined(__ANDROID__)
- "05000000c82d000006500000ffff3f00,8BitDo M30
Gamepad,a:b0,b:b1,back:b4,guide:b17,leftshoulder:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b10,righttrigger:a4,start:b6,x:b2,y:b3,hint:SDL_GAMECONTROLLER_USE_BUTTON_LABELS:=1,",
Index: patches/patch-src_joystick_bsd_SDL_bsdjoystick_c
===================================================================
RCS file: patches/patch-src_joystick_bsd_SDL_bsdjoystick_c
diff -N patches/patch-src_joystick_bsd_SDL_bsdjoystick_c
--- patches/patch-src_joystick_bsd_SDL_bsdjoystick_c 18 Oct 2022 00:56:38
-0000 1.6
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,130 +0,0 @@
-- Assign buttons correctly
-- Get GUID using USB_GET_DEVICEINFO
-- detect newer (XInput-style) gamecontroller if hitem.logical_maximum is > 255;
- if so invert y axes
-- Use ujoy(4) devices
-
-Index: src/joystick/bsd/SDL_bsdjoystick.c
---- src/joystick/bsd/SDL_bsdjoystick.c.orig
-+++ src/joystick/bsd/SDL_bsdjoystick.c
-@@ -83,6 +83,9 @@
-
- #ifdef __OpenBSD__
-
-+#define DEV_USB 3 /* needed to get GUID from
USB_GET_DEVICEINFO */
-+#define GUID_LEN 32 /* GUID string has length 32 */
-+
- #define HUG_DPAD_UP 0x90
- #define HUG_DPAD_DOWN 0x91
- #define HUG_DPAD_RIGHT 0x92
-@@ -192,6 +195,9 @@ struct joystick_hwdata
-
- static char *joynames[MAX_JOYS];
- static char *joydevnames[MAX_JOYS];
-+#ifdef __OpenBSD__
-+static char joyguids[MAX_JOYS][GUID_LEN];
-+#endif
-
- static int report_alloc(struct report *, struct report_desc *, int);
- static void report_free(struct report *);
-@@ -222,11 +228,14 @@ BSD_JoystickInit(void)
-
- SDL_memset(joynames, 0, sizeof(joynames));
- SDL_memset(joydevnames, 0, sizeof(joydevnames));
-+#ifdef __OpenBSD__
-+ SDL_memset(joyguids, 0, sizeof(char) * MAX_JOYS * GUID_LEN);
-+#endif
-
- for (i = 0; i < MAX_UHID_JOYS; i++) {
- SDL_Joystick nj;
-
-- SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i);
-+ SDL_snprintf(s, SDL_arraysize(s), "/dev/ujoy/%d", i);
-
- joynames[numjoysticks] = SDL_strdup(s);
-
-@@ -362,6 +371,9 @@ BSD_JoystickOpen(SDL_Joystick *joy, int device_index)
- #endif
- int fd;
- int i;
-+#ifdef __OpenBSD__
-+ struct usb_device_info di;
-+#endif
-
- fd = open(path, O_RDONLY | O_CLOEXEC);
- if (fd == -1) {
-@@ -440,6 +452,17 @@ BSD_JoystickOpen(SDL_Joystick *joy, int device_index)
- }
- desc_failed:
- #endif
-+#if defined(__OpenBSD__)
-+ if (ioctl(fd, USB_GET_DEVICEINFO, &di) != -1) {
-+ SDL_snprintf(joyguids[numjoysticks],
-+ SDL_arraysize(joyguids[device_index]),
-+ "%02x%02x0000%02x%02x0000%02x%02x0000%02x%02x0000",
-+ DEV_USB & 0xFF, DEV_USB >> 8,
-+ di.udi_vendorNo & 0xFF, di.udi_vendorNo >> 8,
-+ di.udi_productNo & 0xFF, di.udi_productNo >> 8,
-+ di.udi_releaseNo & 0xFF, di.udi_releaseNo >> 8);
-+ }
-+#endif
- if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
- goto usberr;
- }
-@@ -550,6 +573,7 @@ BSD_JoystickUpdate(SDL_Joystick *joy)
- Sint32 v;
- #ifdef __OpenBSD__
- Sint32 dpad[4] = {0, 0, 0, 0};
-+ int actualbutton;
- #endif
-
- #if defined(__FREEBSD__) || SDL_HAVE_MACHINE_JOYSTICK_H ||
defined(__FreeBSD_kernel__) || defined(__DragonFly_)
-@@ -624,6 +648,18 @@ BSD_JoystickUpdate(SDL_Joystick *joy)
- naxe = joy->hwdata->axis_map[joyaxe];
- /* scaleaxe */
- v = (Sint32) hid_get_data(REP_BUF_DATA(rep),
&hitem);
-+#ifdef __OpenBSD__
-+ /* XInput controllermapping relies on inverted Y
axes.
-+ * These devices have a 16bit signed space, as
opposed
-+ * to older DInput devices (8bit unsigned), so
-+ * hitem.logical_maximum can be used to
differentiate them.
-+ */
-+ if ((joyaxe == JOYAXE_Y || joyaxe == JOYAXE_RY)
-+ && hitem.logical_maximum > 255) {
-+ if (v != 0)
-+ v = ~v;
-+ }
-+#endif
- v -= (hitem.logical_maximum +
- hitem.logical_minimum + 1) / 2;
- v *= 32768 /
-@@ -658,7 +694,12 @@ BSD_JoystickUpdate(SDL_Joystick *joy)
- }
- case HUP_BUTTON:
- v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
-+#ifdef __OpenBSD__
-+ actualbutton = HID_USAGE(hitem.usage) - 1; /* sdl
buttons are zero-based */
-+ SDL_PrivateJoystickButton(joy, actualbutton, v);
-+#else
- SDL_PrivateJoystickButton(joy, nbutton, v);
-+#endif
- nbutton++;
- break;
- default:
-@@ -703,11 +744,16 @@ static SDL_JoystickGUID
- BSD_JoystickGetDeviceGUID( int device_index )
- {
- SDL_JoystickGUID guid;
-+#ifdef __OpenBSD__
-+ guid = SDL_JoystickGetGUIDFromString(joyguids[device_index]);
-+ return guid;
-+#else
- /* the GUID is just the first 16 chars of the name for now */
- const char *name = BSD_JoystickGetDeviceName( device_index );
- SDL_zero( guid );
- SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) );
- return guid;
-+#endif
- }
-
- static int