update SDL2 to 2.0.8 and security update of sdl2-image to 2.0.3

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

update SDL2 to 2.0.8 and security update of sdl2-image to 2.0.3

Thomas Frohwein
Hi,

Here the diff for updating both sdl2 and sdl2-image. Note that sdl2-image is a
security update for some buffer overflows and crashes by maliciously-crafted
data (see details below).

The diff below updates sdl2 to 2.0.8. This includes the optional mapping of the
Gamecontroller API via the SDL_GAMECONTROLLERCONFIG env var. To recap, there
are 2 joystick/gamepad APIs in SDL2. The old joystick API was not an issue, but
the newer gamecontroller API did not work before the 2.0.7 update. The 2.0.7
updated included a workaround that mapped the gamecontroller API based on the
fallback part that was already there for Linux, but that was set at compile
time only. This update includes a slightly expanded workaround that checks for
the SDL_GAMECONTROLLERCONFIG env var and maps based on that if found.

Also bump minor. Runs stone-soup, neverball, megaglest, and FNA games as
before on brief testing, including sound, graphics, and gamepad.

The sdl2-image update to 2.0.3 was released today and contains a series of
security patches. Grab maintainer while at it.
NOTE: the sdl2-image update needs sdl2 version 2.0.8.
Also tested with above ports without issues.

The official release notes:

Thanks to all the people who contributed code and feedback, SDL 2.0.8 is now available!
http://www.libsdl.org/download-2.0.php
In addition to lots of bug fixes and build improvements, here are the major changes in this release:
General:
Added SDL_fmod() and SDL_log10()
Each of the SDL math functions now has the corresponding float version
Added SDL_SetYUVConversionMode() and SDL_GetYUVConversionMode() to control the formula used when converting to and from YUV colorspace. The options are JPEG, BT.601, and BT.709
Windows:
Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation
Added resampling support on WASAPI on Windows 7 and above
Windows UWP:
Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on
Mac OS X:
Added support for the Vulkan SDK for Mac:
https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-0-69-0-for-mac/
Added support for OpenGL ES using ANGLE when it's available
Mac OS X / iOS / tvOS:
Added a Metal 2D render implementation
Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation
iOS:
Added the hint SDL_HINT_IOS_HIDE_HOME_INDICATOR to control whether the home indicator bar on iPhone X should be hidden. This defaults to dimming the indicator for fullscreen applications and showing the indicator for windowed applications.
iOS / Android:
Added the hint SDL_HINT_RETURN_KEY_HIDES_IME to control whether the return key on the software keyboard should hide the keyboard or send a key event (the default)
Android:
SDL now supports building with Android Studio and Gradle by default, and the old Ant project is available in android-project-ant
SDL now requires the API 19 SDK to build, but can still target devices down to API 14 (Android 4.0.1)
Added SDL_IsAndroidTV() to tell whether the application is running on Android TV
Android / tvOS:
Added the hint SDL_HINT_TV_REMOTE_AS_JOYSTICK to control whether TV remotes should be listed as joystick devices (the default) or send keyboard events.
Linux:
Added the hint SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR to control whether the X server should skip the compositor for the SDL application. This defaults to "1"
Added the hint SDL_HINT_VIDEO_DOUBLE_BUFFER to control whether the Raspberry Pi and KMSDRM video drivers should use double or triple buffering (the default)

----------------

SDL_image 2.0.3 is now available:
http://www.libsdl.org/projects/SDL_image/

This is a security update release, fixing the following security reports:
TALOS-2017-0488
TALOS-2017-0489
TALOS-2017-0490
TALOS-2017-0491
TALOS-2017-0497
TALOS-2017-0498
TALOS-2017-0499

You'll need to get SDL 2.0.8 for this release of SDL_image.

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- Makefile 12 Jan 2018 19:32:54 -0000 1.20
+++ Makefile 2 Mar 2018 03:50:32 -0000
@@ -4,14 +4,13 @@ COMMENT= cross-platform multimedia libra
 BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: \
  #error Please implement for your platform.
 
-V= 2.0.7
+V= 2.0.8
 DISTNAME= SDL2-${V}
 PKGNAME= sdl2-${V}
 CATEGORIES= devel
 MASTER_SITES= https://www.libsdl.org/release/
-REVISION= 0
 
-SHARED_LIBS= SDL2 0.4 # 0.7
+SHARED_LIBS= SDL2 0.5 # 0.8
 
 HOMEPAGE= https://www.libsdl.org/
 
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/sdl2/distinfo,v
retrieving revision 1.6
diff -u -p -r1.6 distinfo
--- distinfo 7 Jan 2018 22:56:46 -0000 1.6
+++ distinfo 2 Mar 2018 03:50:32 -0000
@@ -1,2 +1,2 @@
-SHA256 (SDL2-2.0.7.tar.gz) = 7jXHTEMT4u2hBLFLG4b324SgTuq5Qw1W4AHOomi/TV4=
-SIZE (SDL2-2.0.7.tar.gz) = 4432499
+SHA256 (SDL2-2.0.8.tar.gz) = 7cd8VzCGYdV26EM0TYY44CWngYv/c/j7+rCcPF/Qkuw=
+SIZE (SDL2-2.0.8.tar.gz) = 4909017
Index: patches/patch-src_joystick_SDL_gamecontroller_c
===================================================================
RCS file: /cvs/ports/devel/sdl2/patches/patch-src_joystick_SDL_gamecontroller_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_joystick_SDL_gamecontroller_c
--- patches/patch-src_joystick_SDL_gamecontroller_c 7 Jan 2018 22:56:46 -0000 1.1
+++ patches/patch-src_joystick_SDL_gamecontroller_c 2 Mar 2018 03:50:32 -0000
@@ -6,10 +6,12 @@ everything will be Xbox360 controller (w
 - note: the actual Xbox360 controller has buttons and axes messed up on
          openbsd with these mappings
 
+EXPERIMENTAL: map to SDL_GAMECONTROLLERCONFIG envvar if available
+
 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
+@@ -884,15 +884,21 @@ static ControllerMapping_t *SDL_PrivateGetControllerMa
  #else
      (void) s_pEmscriptenMapping;  /* pacify ARMCC */
  #endif
@@ -20,10 +22,17 @@ Index: src/joystick/SDL_gamecontroller.c
 +        //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,
+-            mapping = SDL_PrivateAddMappingForGUID(guid,
++    char guid_str[1024];
++            SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
++    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);
 -        }
++    } else {
++    mapping = SDL_PrivateAddMappingForGUID(guid, SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG), &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.2
diff -u -p -r1.2 patch-src_video_SDL_egl_c
--- patches/patch-src_video_SDL_egl_c 7 Jan 2018 22:56:46 -0000 1.2
+++ patches/patch-src_video_SDL_egl_c 2 Mar 2018 03:50:32 -0000
@@ -1,18 +1,21 @@
-$OpenBSD: patch-src_video_SDL_egl_c,v 1.2 2018/01/07 22:56:46 awolk Exp $
+$OpenBSD$
+
+account for OpenBSD lib name convention
+
 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"
--
-+#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"
+@@ -72,6 +72,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: Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2-image/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- Makefile 12 Jan 2018 19:32:54 -0000 1.8
+++ Makefile 2 Mar 2018 03:50:19 -0000
@@ -1,22 +1,23 @@
 # $OpenBSD: Makefile,v 1.8 2018/01/12 19:32:54 bentley Exp $
 
-V = 2.0.1
+V = 2.0.3
 COMMENT = SDL2 image library
 DISTNAME = SDL2_image-${V}
 PKGNAME = sdl2-image-${V}
 CATEGORIES = devel graphics
-REVISION = 0
 
-SHARED_LIBS += SDL2_image 0.0 # 0.0
+SHARED_LIBS += SDL2_image 0.1 # 0.3
 
 HOMEPAGE = https://www.libsdl.org/projects/SDL_image/
 
+MAINTAINER = Thomas Frohwein <[hidden email]>
+
 # zlib
 PERMIT_PACKAGE_CDROM = Yes
 
 MASTER_SITES = https://www.libsdl.org/projects/SDL_image/release/
 
-WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z
+WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z samplerate
 
 LIB_DEPENDS = devel/sdl2 \
  graphics/jpeg \
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/sdl2-image/distinfo,v
retrieving revision 1.2
diff -u -p -r1.2 distinfo
--- distinfo 10 Jan 2016 08:10:16 -0000 1.2
+++ distinfo 2 Mar 2018 03:50:19 -0000
@@ -1,2 +1,2 @@
-SHA256 (SDL2_image-2.0.1.tar.gz) = Oj6vvO6lElwEvlhTc7/Ys6GPJZvX6uPvxObY5g4Nf2Q=
-SIZE (SDL2_image-2.0.1.tar.gz) = 7797848
+SHA256 (SDL2_image-2.0.3.tar.gz) = NRDCXac1/82M47ZQcxUP9Pf5STuGboW4NzgIO1VtI2g=
+SIZE (SDL2_image-2.0.3.tar.gz) = 8685512
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/sdl2-image/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST
--- pkg/PLIST 22 May 2015 11:31:14 -0000 1.2
+++ pkg/PLIST 2 Mar 2018 03:50:19 -0000
@@ -1,5 +1,4 @@
 @comment $OpenBSD: PLIST,v 1.2 2015/05/22 11:31:14 ajacoutot Exp $
-include/SDL2/
 include/SDL2/SDL_image.h
 lib/libSDL2_image.a
 lib/libSDL2_image.la

Reply | Threaded
Open this post in threaded view
|

Re: update SDL2 to 2.0.8 and security update of sdl2-image to 2.0.3

Thomas Frohwein
Ping... and double-ping for the sdl2-image security fix

On Thu, Mar 01, 2018 at 07:52:03PM -0800, Thomas Frohwein wrote:

> Hi,
>
> Here the diff for updating both sdl2 and sdl2-image. Note that sdl2-image is a
> security update for some buffer overflows and crashes by maliciously-crafted
> data (see details below).
>
> The diff below updates sdl2 to 2.0.8. This includes the optional mapping of the
> Gamecontroller API via the SDL_GAMECONTROLLERCONFIG env var. To recap, there
> are 2 joystick/gamepad APIs in SDL2. The old joystick API was not an issue, but
> the newer gamecontroller API did not work before the 2.0.7 update. The 2.0.7
> updated included a workaround that mapped the gamecontroller API based on the
> fallback part that was already there for Linux, but that was set at compile
> time only. This update includes a slightly expanded workaround that checks for
> the SDL_GAMECONTROLLERCONFIG env var and maps based on that if found.
>
> Also bump minor. Runs stone-soup, neverball, megaglest, and FNA games as
> before on brief testing, including sound, graphics, and gamepad.
>
> The sdl2-image update to 2.0.3 was released today and contains a series of
> security patches. Grab maintainer while at it.
> NOTE: the sdl2-image update needs sdl2 version 2.0.8.
> Also tested with above ports without issues.
>
> The official release notes:
>
> Thanks to all the people who contributed code and feedback, SDL 2.0.8 is now available!
> http://www.libsdl.org/download-2.0.php
> In addition to lots of bug fixes and build improvements, here are the major changes in this release:
> General:
> Added SDL_fmod() and SDL_log10()
> Each of the SDL math functions now has the corresponding float version
> Added SDL_SetYUVConversionMode() and SDL_GetYUVConversionMode() to control the formula used when converting to and from YUV colorspace. The options are JPEG, BT.601, and BT.709
> Windows:
> Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation
> Added resampling support on WASAPI on Windows 7 and above
> Windows UWP:
> Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on
> Mac OS X:
> Added support for the Vulkan SDK for Mac:
> https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-0-69-0-for-mac/
> Added support for OpenGL ES using ANGLE when it's available
> Mac OS X / iOS / tvOS:
> Added a Metal 2D render implementation
> Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation
> iOS:
> Added the hint SDL_HINT_IOS_HIDE_HOME_INDICATOR to control whether the home indicator bar on iPhone X should be hidden. This defaults to dimming the indicator for fullscreen applications and showing the indicator for windowed applications.
> iOS / Android:
> Added the hint SDL_HINT_RETURN_KEY_HIDES_IME to control whether the return key on the software keyboard should hide the keyboard or send a key event (the default)
> Android:
> SDL now supports building with Android Studio and Gradle by default, and the old Ant project is available in android-project-ant
> SDL now requires the API 19 SDK to build, but can still target devices down to API 14 (Android 4.0.1)
> Added SDL_IsAndroidTV() to tell whether the application is running on Android TV
> Android / tvOS:
> Added the hint SDL_HINT_TV_REMOTE_AS_JOYSTICK to control whether TV remotes should be listed as joystick devices (the default) or send keyboard events.
> Linux:
> Added the hint SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR to control whether the X server should skip the compositor for the SDL application. This defaults to "1"
> Added the hint SDL_HINT_VIDEO_DOUBLE_BUFFER to control whether the Raspberry Pi and KMSDRM video drivers should use double or triple buffering (the default)
>
> ----------------
>
> SDL_image 2.0.3 is now available:
> http://www.libsdl.org/projects/SDL_image/
>
> This is a security update release, fixing the following security reports:
> TALOS-2017-0488
> TALOS-2017-0489
> TALOS-2017-0490
> TALOS-2017-0491
> TALOS-2017-0497
> TALOS-2017-0498
> TALOS-2017-0499
>
> You'll need to get SDL 2.0.8 for this release of SDL_image.
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/sdl2/Makefile,v
> retrieving revision 1.20
> diff -u -p -r1.20 Makefile
> --- Makefile 12 Jan 2018 19:32:54 -0000 1.20
> +++ Makefile 2 Mar 2018 03:50:32 -0000
> @@ -4,14 +4,13 @@ COMMENT= cross-platform multimedia libra
>  BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: \
>   #error Please implement for your platform.
>  
> -V= 2.0.7
> +V= 2.0.8
>  DISTNAME= SDL2-${V}
>  PKGNAME= sdl2-${V}
>  CATEGORIES= devel
>  MASTER_SITES= https://www.libsdl.org/release/
> -REVISION= 0
>  
> -SHARED_LIBS= SDL2 0.4 # 0.7
> +SHARED_LIBS= SDL2 0.5 # 0.8
>  
>  HOMEPAGE= https://www.libsdl.org/
>  
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/devel/sdl2/distinfo,v
> retrieving revision 1.6
> diff -u -p -r1.6 distinfo
> --- distinfo 7 Jan 2018 22:56:46 -0000 1.6
> +++ distinfo 2 Mar 2018 03:50:32 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (SDL2-2.0.7.tar.gz) = 7jXHTEMT4u2hBLFLG4b324SgTuq5Qw1W4AHOomi/TV4=
> -SIZE (SDL2-2.0.7.tar.gz) = 4432499
> +SHA256 (SDL2-2.0.8.tar.gz) = 7cd8VzCGYdV26EM0TYY44CWngYv/c/j7+rCcPF/Qkuw=
> +SIZE (SDL2-2.0.8.tar.gz) = 4909017
> Index: patches/patch-src_joystick_SDL_gamecontroller_c
> ===================================================================
> RCS file: /cvs/ports/devel/sdl2/patches/patch-src_joystick_SDL_gamecontroller_c,v
> retrieving revision 1.1
> diff -u -p -r1.1 patch-src_joystick_SDL_gamecontroller_c
> --- patches/patch-src_joystick_SDL_gamecontroller_c 7 Jan 2018 22:56:46 -0000 1.1
> +++ patches/patch-src_joystick_SDL_gamecontroller_c 2 Mar 2018 03:50:32 -0000
> @@ -6,10 +6,12 @@ everything will be Xbox360 controller (w
>  - note: the actual Xbox360 controller has buttons and axes messed up on
>           openbsd with these mappings
>  
> +EXPERIMENTAL: map to SDL_GAMECONTROLLERCONFIG envvar if available
> +
>  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
> +@@ -884,15 +884,21 @@ static ControllerMapping_t *SDL_PrivateGetControllerMa
>   #else
>       (void) s_pEmscriptenMapping;  /* pacify ARMCC */
>   #endif
> @@ -20,10 +22,17 @@ Index: src/joystick/SDL_gamecontroller.c
>  +        //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,
> +-            mapping = SDL_PrivateAddMappingForGUID(guid,
> ++    char guid_str[1024];
> ++            SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
> ++    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);
>  -        }
> ++    } else {
> ++    mapping = SDL_PrivateAddMappingForGUID(guid, SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG), &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.2
> diff -u -p -r1.2 patch-src_video_SDL_egl_c
> --- patches/patch-src_video_SDL_egl_c 7 Jan 2018 22:56:46 -0000 1.2
> +++ patches/patch-src_video_SDL_egl_c 2 Mar 2018 03:50:32 -0000
> @@ -1,18 +1,21 @@
> -$OpenBSD: patch-src_video_SDL_egl_c,v 1.2 2018/01/07 22:56:46 awolk Exp $
> +$OpenBSD$
> +
> +account for OpenBSD lib name convention
> +
>  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"
> --
> -+#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"
> +@@ -72,6 +72,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: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/sdl2-image/Makefile,v
> retrieving revision 1.8
> diff -u -p -r1.8 Makefile
> --- Makefile 12 Jan 2018 19:32:54 -0000 1.8
> +++ Makefile 2 Mar 2018 03:50:19 -0000
> @@ -1,22 +1,23 @@
>  # $OpenBSD: Makefile,v 1.8 2018/01/12 19:32:54 bentley Exp $
>  
> -V = 2.0.1
> +V = 2.0.3
>  COMMENT = SDL2 image library
>  DISTNAME = SDL2_image-${V}
>  PKGNAME = sdl2-image-${V}
>  CATEGORIES = devel graphics
> -REVISION = 0
>  
> -SHARED_LIBS += SDL2_image 0.0 # 0.0
> +SHARED_LIBS += SDL2_image 0.1 # 0.3
>  
>  HOMEPAGE = https://www.libsdl.org/projects/SDL_image/
>  
> +MAINTAINER = Thomas Frohwein <[hidden email]>
> +
>  # zlib
>  PERMIT_PACKAGE_CDROM = Yes
>  
>  MASTER_SITES = https://www.libsdl.org/projects/SDL_image/release/
>  
> -WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z
> +WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z samplerate
>  
>  LIB_DEPENDS = devel/sdl2 \
>   graphics/jpeg \
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/devel/sdl2-image/distinfo,v
> retrieving revision 1.2
> diff -u -p -r1.2 distinfo
> --- distinfo 10 Jan 2016 08:10:16 -0000 1.2
> +++ distinfo 2 Mar 2018 03:50:19 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (SDL2_image-2.0.1.tar.gz) = Oj6vvO6lElwEvlhTc7/Ys6GPJZvX6uPvxObY5g4Nf2Q=
> -SIZE (SDL2_image-2.0.1.tar.gz) = 7797848
> +SHA256 (SDL2_image-2.0.3.tar.gz) = NRDCXac1/82M47ZQcxUP9Pf5STuGboW4NzgIO1VtI2g=
> +SIZE (SDL2_image-2.0.3.tar.gz) = 8685512
> Index: pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/devel/sdl2-image/pkg/PLIST,v
> retrieving revision 1.2
> diff -u -p -r1.2 PLIST
> --- pkg/PLIST 22 May 2015 11:31:14 -0000 1.2
> +++ pkg/PLIST 2 Mar 2018 03:50:19 -0000
> @@ -1,5 +1,4 @@
>  @comment $OpenBSD: PLIST,v 1.2 2015/05/22 11:31:14 ajacoutot Exp $
> -include/SDL2/
>  include/SDL2/SDL_image.h
>  lib/libSDL2_image.a
>  lib/libSDL2_image.la
>

Reply | Threaded
Open this post in threaded view
|

Re: update SDL2 to 2.0.8 and security update of sdl2-image to 2.0.3

Bryan Linton
It looks like the patch for sdl2 and sdl2-image got commingled.
After separating them out, they applied successfully and
everything seems to be OK.

I tested with games/manaplus, games/scummvm, and
emulators/retroarch and didn't see any regressions.

--
Bryan

On 2018-03-10 10:16:48, Thomas Frohwein <[hidden email]> wrote:

> Ping... and double-ping for the sdl2-image security fix
>
> On Thu, Mar 01, 2018 at 07:52:03PM -0800, Thomas Frohwein wrote:
> > Hi,
> >
> > Here the diff for updating both sdl2 and sdl2-image. Note that sdl2-image is a
> > security update for some buffer overflows and crashes by maliciously-crafted
> > data (see details below).
> >
> > The diff below updates sdl2 to 2.0.8. This includes the optional mapping of the
> > Gamecontroller API via the SDL_GAMECONTROLLERCONFIG env var. To recap, there
> > are 2 joystick/gamepad APIs in SDL2. The old joystick API was not an issue, but
> > the newer gamecontroller API did not work before the 2.0.7 update. The 2.0.7
> > updated included a workaround that mapped the gamecontroller API based on the
> > fallback part that was already there for Linux, but that was set at compile
> > time only. This update includes a slightly expanded workaround that checks for
> > the SDL_GAMECONTROLLERCONFIG env var and maps based on that if found.
> >
> > Also bump minor. Runs stone-soup, neverball, megaglest, and FNA games as
> > before on brief testing, including sound, graphics, and gamepad.
> >
> > The sdl2-image update to 2.0.3 was released today and contains a series of
> > security patches. Grab maintainer while at it.
> > NOTE: the sdl2-image update needs sdl2 version 2.0.8.
> > Also tested with above ports without issues.
> >
> > The official release notes:
> >
> > Thanks to all the people who contributed code and feedback, SDL 2.0.8 is now available!
> > http://www.libsdl.org/download-2.0.php
> > In addition to lots of bug fixes and build improvements, here are the major changes in this release:
> > General:
> > Added SDL_fmod() and SDL_log10()
> > Each of the SDL math functions now has the corresponding float version
> > Added SDL_SetYUVConversionMode() and SDL_GetYUVConversionMode() to control the formula used when converting to and from YUV colorspace. The options are JPEG, BT.601, and BT.709
> > Windows:
> > Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation
> > Added resampling support on WASAPI on Windows 7 and above
> > Windows UWP:
> > Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on
> > Mac OS X:
> > Added support for the Vulkan SDK for Mac:
> > https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-0-69-0-for-mac/
> > Added support for OpenGL ES using ANGLE when it's available
> > Mac OS X / iOS / tvOS:
> > Added a Metal 2D render implementation
> > Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation
> > iOS:
> > Added the hint SDL_HINT_IOS_HIDE_HOME_INDICATOR to control whether the home indicator bar on iPhone X should be hidden. This defaults to dimming the indicator for fullscreen applications and showing the indicator for windowed applications.
> > iOS / Android:
> > Added the hint SDL_HINT_RETURN_KEY_HIDES_IME to control whether the return key on the software keyboard should hide the keyboard or send a key event (the default)
> > Android:
> > SDL now supports building with Android Studio and Gradle by default, and the old Ant project is available in android-project-ant
> > SDL now requires the API 19 SDK to build, but can still target devices down to API 14 (Android 4.0.1)
> > Added SDL_IsAndroidTV() to tell whether the application is running on Android TV
> > Android / tvOS:
> > Added the hint SDL_HINT_TV_REMOTE_AS_JOYSTICK to control whether TV remotes should be listed as joystick devices (the default) or send keyboard events.
> > Linux:
> > Added the hint SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR to control whether the X server should skip the compositor for the SDL application. This defaults to "1"
> > Added the hint SDL_HINT_VIDEO_DOUBLE_BUFFER to control whether the Raspberry Pi and KMSDRM video drivers should use double or triple buffering (the default)
> >
> > ----------------
> >
> > SDL_image 2.0.3 is now available:
> > http://www.libsdl.org/projects/SDL_image/
> >
> > This is a security update release, fixing the following security reports:
> > TALOS-2017-0488
> > TALOS-2017-0489
> > TALOS-2017-0490
> > TALOS-2017-0491
> > TALOS-2017-0497
> > TALOS-2017-0498
> > TALOS-2017-0499
> >
> > You'll need to get SDL 2.0.8 for this release of SDL_image.
> >
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/sdl2/Makefile,v
> > retrieving revision 1.20
> > diff -u -p -r1.20 Makefile
> > --- Makefile 12 Jan 2018 19:32:54 -0000 1.20
> > +++ Makefile 2 Mar 2018 03:50:32 -0000
> > @@ -4,14 +4,13 @@ COMMENT= cross-platform multimedia libra
> >  BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: \
> >   #error Please implement for your platform.
> >  
> > -V= 2.0.7
> > +V= 2.0.8
> >  DISTNAME= SDL2-${V}
> >  PKGNAME= sdl2-${V}
> >  CATEGORIES= devel
> >  MASTER_SITES= https://www.libsdl.org/release/
> > -REVISION= 0
> >  
> > -SHARED_LIBS= SDL2 0.4 # 0.7
> > +SHARED_LIBS= SDL2 0.5 # 0.8
> >  
> >  HOMEPAGE= https://www.libsdl.org/
> >  
> > Index: distinfo
> > ===================================================================
> > RCS file: /cvs/ports/devel/sdl2/distinfo,v
> > retrieving revision 1.6
> > diff -u -p -r1.6 distinfo
> > --- distinfo 7 Jan 2018 22:56:46 -0000 1.6
> > +++ distinfo 2 Mar 2018 03:50:32 -0000
> > @@ -1,2 +1,2 @@
> > -SHA256 (SDL2-2.0.7.tar.gz) = 7jXHTEMT4u2hBLFLG4b324SgTuq5Qw1W4AHOomi/TV4=
> > -SIZE (SDL2-2.0.7.tar.gz) = 4432499
> > +SHA256 (SDL2-2.0.8.tar.gz) = 7cd8VzCGYdV26EM0TYY44CWngYv/c/j7+rCcPF/Qkuw=
> > +SIZE (SDL2-2.0.8.tar.gz) = 4909017
> > Index: patches/patch-src_joystick_SDL_gamecontroller_c
> > ===================================================================
> > RCS file: /cvs/ports/devel/sdl2/patches/patch-src_joystick_SDL_gamecontroller_c,v
> > retrieving revision 1.1
> > diff -u -p -r1.1 patch-src_joystick_SDL_gamecontroller_c
> > --- patches/patch-src_joystick_SDL_gamecontroller_c 7 Jan 2018 22:56:46 -0000 1.1
> > +++ patches/patch-src_joystick_SDL_gamecontroller_c 2 Mar 2018 03:50:32 -0000
> > @@ -6,10 +6,12 @@ everything will be Xbox360 controller (w
> >  - note: the actual Xbox360 controller has buttons and axes messed up on
> >           openbsd with these mappings
> >  
> > +EXPERIMENTAL: map to SDL_GAMECONTROLLERCONFIG envvar if available
> > +
> >  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
> > +@@ -884,15 +884,21 @@ static ControllerMapping_t *SDL_PrivateGetControllerMa
> >   #else
> >       (void) s_pEmscriptenMapping;  /* pacify ARMCC */
> >   #endif
> > @@ -20,10 +22,17 @@ Index: src/joystick/SDL_gamecontroller.c
> >  +        //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,
> > +-            mapping = SDL_PrivateAddMappingForGUID(guid,
> > ++    char guid_str[1024];
> > ++            SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
> > ++    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);
> >  -        }
> > ++    } else {
> > ++    mapping = SDL_PrivateAddMappingForGUID(guid, SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG), &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.2
> > diff -u -p -r1.2 patch-src_video_SDL_egl_c
> > --- patches/patch-src_video_SDL_egl_c 7 Jan 2018 22:56:46 -0000 1.2
> > +++ patches/patch-src_video_SDL_egl_c 2 Mar 2018 03:50:32 -0000
> > @@ -1,18 +1,21 @@
> > -$OpenBSD: patch-src_video_SDL_egl_c,v 1.2 2018/01/07 22:56:46 awolk Exp $
> > +$OpenBSD$
> > +
> > +account for OpenBSD lib name convention
> > +
> >  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"
> > --
> > -+#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"
> > +@@ -72,6 +72,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: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/devel/sdl2-image/Makefile,v
> > retrieving revision 1.8
> > diff -u -p -r1.8 Makefile
> > --- Makefile 12 Jan 2018 19:32:54 -0000 1.8
> > +++ Makefile 2 Mar 2018 03:50:19 -0000
> > @@ -1,22 +1,23 @@
> >  # $OpenBSD: Makefile,v 1.8 2018/01/12 19:32:54 bentley Exp $
> >  
> > -V = 2.0.1
> > +V = 2.0.3
> >  COMMENT = SDL2 image library
> >  DISTNAME = SDL2_image-${V}
> >  PKGNAME = sdl2-image-${V}
> >  CATEGORIES = devel graphics
> > -REVISION = 0
> >  
> > -SHARED_LIBS += SDL2_image 0.0 # 0.0
> > +SHARED_LIBS += SDL2_image 0.1 # 0.3
> >  
> >  HOMEPAGE = https://www.libsdl.org/projects/SDL_image/
> >  
> > +MAINTAINER = Thomas Frohwein <[hidden email]>
> > +
> >  # zlib
> >  PERMIT_PACKAGE_CDROM = Yes
> >  
> >  MASTER_SITES = https://www.libsdl.org/projects/SDL_image/release/
> >  
> > -WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z
> > +WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z samplerate
> >  
> >  LIB_DEPENDS = devel/sdl2 \
> >   graphics/jpeg \
> > Index: distinfo
> > ===================================================================
> > RCS file: /cvs/ports/devel/sdl2-image/distinfo,v
> > retrieving revision 1.2
> > diff -u -p -r1.2 distinfo
> > --- distinfo 10 Jan 2016 08:10:16 -0000 1.2
> > +++ distinfo 2 Mar 2018 03:50:19 -0000
> > @@ -1,2 +1,2 @@
> > -SHA256 (SDL2_image-2.0.1.tar.gz) = Oj6vvO6lElwEvlhTc7/Ys6GPJZvX6uPvxObY5g4Nf2Q=
> > -SIZE (SDL2_image-2.0.1.tar.gz) = 7797848
> > +SHA256 (SDL2_image-2.0.3.tar.gz) = NRDCXac1/82M47ZQcxUP9Pf5STuGboW4NzgIO1VtI2g=
> > +SIZE (SDL2_image-2.0.3.tar.gz) = 8685512
> > Index: pkg/PLIST
> > ===================================================================
> > RCS file: /cvs/ports/devel/sdl2-image/pkg/PLIST,v
> > retrieving revision 1.2
> > diff -u -p -r1.2 PLIST
> > --- pkg/PLIST 22 May 2015 11:31:14 -0000 1.2
> > +++ pkg/PLIST 2 Mar 2018 03:50:19 -0000
> > @@ -1,5 +1,4 @@
> >  @comment $OpenBSD: PLIST,v 1.2 2015/05/22 11:31:14 ajacoutot Exp $
> > -include/SDL2/
> >  include/SDL2/SDL_image.h
> >  lib/libSDL2_image.a
> >  lib/libSDL2_image.la
> >
>

Reply | Threaded
Open this post in threaded view
|

Re: update SDL2 to 2.0.8 and security update of sdl2-image to 2.0.3

Stuart Henderson
In reply to this post by Thomas Frohwein
On 2018/03/01 19:52, Thomas Frohwein wrote:
>  Index: src/video/SDL_egl.c
..
> +
> +++#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"

+++? There's something wrong here.

> RCS file: /cvs/ports/devel/sdl2-image/Makefile,v
> retrieving revision 1.8
> diff -u -p -r1.8 Makefile
> --- Makefile 12 Jan 2018 19:32:54 -0000 1.8

If there are two things patched in the same mail, please generate
the diff from a common parent directory.

Reply | Threaded
Open this post in threaded view
|

Re: update SDL2 to 2.0.8 and security update of sdl2-image to 2.0.3

Thomas Frohwein
I've added a README with an example use of the SDL_GAMECONTROLLERCONFIG env
var because I've got repeated questions off list.

On Sun, Mar 11, 2018 at 12:14:32PM +0000, Stuart Henderson wrote:

> On 2018/03/01 19:52, Thomas Frohwein wrote:
> >  Index: src/video/SDL_egl.c
> ..
> > +
> > +++#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"
>
> +++? There's something wrong here.

Ugh, yes. I guess this exposed that it finds the libraries even with the Linux
naming scheme '*.so.1'. It does run without the patch for this file indeed, but
I added the lines again (without the extra '+') to be consistent with how it
was set up before and with other OS in that file.

>
> > RCS file: /cvs/ports/devel/sdl2-image/Makefile,v
> > retrieving revision 1.8
> > diff -u -p -r1.8 Makefile
> > --- Makefile 12 Jan 2018 19:32:54 -0000 1.8
>
> If there are two things patched in the same mail, please generate
> the diff from a common parent directory.
>

New diff from parent directory below. I tested again with megaglest, neverball,
dungeon crawl stone soup, and a few FNA games without issues.

Index: sdl2/Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2/Makefile,v
retrieving revision 1.20
diff -u -p -r1.20 Makefile
--- sdl2/Makefile 12 Jan 2018 19:32:54 -0000 1.20
+++ sdl2/Makefile 11 Mar 2018 20:29:52 -0000
@@ -4,14 +4,13 @@ COMMENT= cross-platform multimedia libra
 BROKEN-hppa= src/atomic/SDL_spinlock.c:101:2: error: \
  #error Please implement for your platform.
 
-V= 2.0.7
+V= 2.0.8
 DISTNAME= SDL2-${V}
 PKGNAME= sdl2-${V}
 CATEGORIES= devel
 MASTER_SITES= https://www.libsdl.org/release/
-REVISION= 0
 
-SHARED_LIBS= SDL2 0.4 # 0.7
+SHARED_LIBS= SDL2 0.5 # 0.8
 
 HOMEPAGE= https://www.libsdl.org/
 
Index: sdl2/distinfo
===================================================================
RCS file: /cvs/ports/devel/sdl2/distinfo,v
retrieving revision 1.6
diff -u -p -r1.6 distinfo
--- sdl2/distinfo 7 Jan 2018 22:56:46 -0000 1.6
+++ sdl2/distinfo 11 Mar 2018 20:29:52 -0000
@@ -1,2 +1,2 @@
-SHA256 (SDL2-2.0.7.tar.gz) = 7jXHTEMT4u2hBLFLG4b324SgTuq5Qw1W4AHOomi/TV4=
-SIZE (SDL2-2.0.7.tar.gz) = 4432499
+SHA256 (SDL2-2.0.8.tar.gz) = 7cd8VzCGYdV26EM0TYY44CWngYv/c/j7+rCcPF/Qkuw=
+SIZE (SDL2-2.0.8.tar.gz) = 4909017
Index: sdl2/patches/patch-Makefile_in
===================================================================
RCS file: /cvs/ports/devel/sdl2/patches/patch-Makefile_in,v
retrieving revision 1.4
diff -u -p -r1.4 patch-Makefile_in
--- sdl2/patches/patch-Makefile_in 7 Jan 2018 22:56:46 -0000 1.4
+++ sdl2/patches/patch-Makefile_in 11 Mar 2018 20:29:52 -0000
@@ -1,6 +1,5 @@
 $OpenBSD: patch-Makefile_in,v 1.4 2018/01/07 22:56:46 awolk Exp $
 
-Should make sure only libSDL2, not libSDL2-2.0 are installed
 Index: Makefile.in
 --- Makefile.in.orig
 +++ Makefile.in
Index: sdl2/patches/patch-src_joystick_SDL_gamecontroller_c
===================================================================
RCS file: /cvs/ports/devel/sdl2/patches/patch-src_joystick_SDL_gamecontroller_c,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_joystick_SDL_gamecontroller_c
--- sdl2/patches/patch-src_joystick_SDL_gamecontroller_c 7 Jan 2018 22:56:46 -0000 1.1
+++ sdl2/patches/patch-src_joystick_SDL_gamecontroller_c 11 Mar 2018 20:29:52 -0000
@@ -1,15 +1,15 @@
 $OpenBSD: patch-src_joystick_SDL_gamecontroller_c,v 1.1 2018/01/07 22:56:46 awolk Exp $
 
-enable GameController API the Linux way (by posing as Xbox360 controller)
+enable GameController API the Linux fallback 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
+map to SDL_GAMECONTROLLERCONFIG envvar if available
 
 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
+@@ -884,15 +884,21 @@ static ControllerMapping_t *SDL_PrivateGetControllerMa
  #else
      (void) s_pEmscriptenMapping;  /* pacify ARMCC */
  #endif
@@ -20,10 +20,17 @@ Index: src/joystick/SDL_gamecontroller.c
 +        //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,
+-            mapping = SDL_PrivateAddMappingForGUID(guid,
++    char guid_str[1024];
++            SDL_JoystickGetGUIDString(guid, guid_str, sizeof(guid_str));
++    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);
 -        }
++    } else {
++    mapping = SDL_PrivateAddMappingForGUID(guid, SDL_GetHint(SDL_HINT_GAMECONTROLLERCONFIG), &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT);
++    }
 +        //}
      }
  #endif /* __LINUX__ */
Index: sdl2/patches/patch-src_video_SDL_egl_c
===================================================================
RCS file: /cvs/ports/devel/sdl2/patches/patch-src_video_SDL_egl_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_video_SDL_egl_c
--- sdl2/patches/patch-src_video_SDL_egl_c 7 Jan 2018 22:56:46 -0000 1.2
+++ sdl2/patches/patch-src_video_SDL_egl_c 11 Mar 2018 20:29:52 -0000
@@ -1,18 +1,18 @@
-$OpenBSD: patch-src_video_SDL_egl_c,v 1.2 2018/01/07 22:56:46 awolk Exp $
+$OpenBSD$
 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"
--
+@@ -72,6 +72,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: sdl2/pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/sdl2/pkg/PLIST,v
retrieving revision 1.4
diff -u -p -r1.4 PLIST
--- sdl2/pkg/PLIST 7 Jan 2018 22:56:46 -0000 1.4
+++ sdl2/pkg/PLIST 11 Mar 2018 20:29:52 -0000
@@ -1,5 +1,5 @@
 @comment $OpenBSD: PLIST,v 1.4 2018/01/07 22:56:46 awolk Exp $
-@bin bin/sdl2-config
+bin/sdl2-config
 include/SDL2/
 include/SDL2/SDL.h
 include/SDL2/SDL_assert.h
@@ -85,3 +85,4 @@ lib/libSDL2main.a
 lib/libSDL2main.la
 lib/pkgconfig/sdl2.pc
 share/aclocal/sdl2.m4
+share/doc/pkg-readmes/${FULLPKGNAME}
Index: sdl2/pkg/README
===================================================================
RCS file: sdl2/pkg/README
diff -N sdl2/pkg/README
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ sdl2/pkg/README 11 Mar 2018 20:29:52 -0000
@@ -0,0 +1,24 @@
+$OpenBSD$
+
++-----------------------------------------------------------------------
+| Customizing ${FULLPKGNAME} gamecontroller layout on OpenBSD
++-----------------------------------------------------------------------
+
+The mapping for SDL2's gamecontroller API is currently based on a workaround.
+It defaults to:
+
+"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,"
+
+A custom mapping can be used via the SDL_GAMECONTROLLERCONFIG env var. Note
+that the first value (for guid) should be 'none' and the second one can be any
+name under which SDL2 will list the gamecontroller device.
+
+Example mapping (for Logitech Dual Action gamepad):
+
+$ export SDL_GAMECONTROLLERCONFIG="none,X360WirelessController,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,"
Index: sdl2-image/Makefile
===================================================================
RCS file: /cvs/ports/devel/sdl2-image/Makefile,v
retrieving revision 1.8
diff -u -p -r1.8 Makefile
--- sdl2-image/Makefile 12 Jan 2018 19:32:54 -0000 1.8
+++ sdl2-image/Makefile 11 Mar 2018 20:29:52 -0000
@@ -1,22 +1,23 @@
 # $OpenBSD: Makefile,v 1.8 2018/01/12 19:32:54 bentley Exp $
 
-V = 2.0.1
+V = 2.0.3
 COMMENT = SDL2 image library
 DISTNAME = SDL2_image-${V}
 PKGNAME = sdl2-image-${V}
 CATEGORIES = devel graphics
-REVISION = 0
 
-SHARED_LIBS += SDL2_image 0.0 # 0.0
+SHARED_LIBS += SDL2_image 0.1 # 0.3
 
 HOMEPAGE = https://www.libsdl.org/projects/SDL_image/
 
+MAINTAINER = Thomas Frohwein <[hidden email]>
+
 # zlib
 PERMIT_PACKAGE_CDROM = Yes
 
 MASTER_SITES = https://www.libsdl.org/projects/SDL_image/release/
 
-WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z
+WANTLIB += SDL2 jpeg m png pthread sndio tiff usbhid webp z samplerate
 
 LIB_DEPENDS = devel/sdl2 \
  graphics/jpeg \
Index: sdl2-image/distinfo
===================================================================
RCS file: /cvs/ports/devel/sdl2-image/distinfo,v
retrieving revision 1.2
diff -u -p -r1.2 distinfo
--- sdl2-image/distinfo 10 Jan 2016 08:10:16 -0000 1.2
+++ sdl2-image/distinfo 11 Mar 2018 20:29:52 -0000
@@ -1,2 +1,2 @@
-SHA256 (SDL2_image-2.0.1.tar.gz) = Oj6vvO6lElwEvlhTc7/Ys6GPJZvX6uPvxObY5g4Nf2Q=
-SIZE (SDL2_image-2.0.1.tar.gz) = 7797848
+SHA256 (SDL2_image-2.0.3.tar.gz) = NRDCXac1/82M47ZQcxUP9Pf5STuGboW4NzgIO1VtI2g=
+SIZE (SDL2_image-2.0.3.tar.gz) = 8685512
Index: sdl2-image/pkg/PLIST
===================================================================
RCS file: /cvs/ports/devel/sdl2-image/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST
--- sdl2-image/pkg/PLIST 22 May 2015 11:31:14 -0000 1.2
+++ sdl2-image/pkg/PLIST 11 Mar 2018 20:29:52 -0000
@@ -1,5 +1,4 @@
 @comment $OpenBSD: PLIST,v 1.2 2015/05/22 11:31:14 ajacoutot Exp $
-include/SDL2/
 include/SDL2/SDL_image.h
 lib/libSDL2_image.a
 lib/libSDL2_image.la