From dec7875a6e23212021e4d9080330a42832dfe02a Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Tue, 15 Jun 2021 01:40:19 +0000
Subject: [PATCH] update SDL soruce to 2.0.14

---
 source/cmake/sdlchecks.cmake |   42 +++++++++++++++++++++++-------------------
 1 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/source/cmake/sdlchecks.cmake b/source/cmake/sdlchecks.cmake
index ee8421f..a9434c8 100644
--- a/source/cmake/sdlchecks.cmake
+++ b/source/cmake/sdlchecks.cmake
@@ -30,7 +30,7 @@
 endmacro()
 
 macro(CheckDLOPEN)
-  check_function_exists(dlopen HAVE_DLOPEN)
+  check_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN)
   if(NOT HAVE_DLOPEN)
     foreach(_LIBNAME dl tdl)
       check_library_exists("${_LIBNAME}" "dlopen" "" DLOPEN_LIB)
@@ -424,7 +424,7 @@
         set(X11_SHARED OFF)
       endif()
 
-      check_function_exists("shmat" HAVE_SHMAT)
+      check_symbol_exists(shmat "sys/shm.h" HAVE_SHMAT)
       if(NOT HAVE_SHMAT)
         check_library_exists(ipc shmat "" HAVE_SHMAT)
         if(HAVE_SHMAT)
@@ -476,7 +476,7 @@
         set(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1)
       endif()
 
-      check_function_exists(XkbKeycodeToKeysym SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
+      check_symbol_exists(XkbKeycodeToKeysym "X11/Xlib.h;X11/XKBlib.h" SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM)
 
       if(VIDEO_X11_XCURSOR AND HAVE_XCURSOR_H)
         set(HAVE_VIDEO_X11_XCURSOR TRUE)
@@ -593,7 +593,7 @@
 # - HAVE_DLOPEN opt
 macro(CheckWayland)
   if(VIDEO_WAYLAND)
-    pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-protocols wayland-egl wayland-cursor egl xkbcommon)
+    pkg_check_modules(WAYLAND wayland-client wayland-scanner wayland-egl wayland-cursor egl xkbcommon)
 
     if(WAYLAND_FOUND)
       execute_process(
@@ -633,6 +633,7 @@
       endforeach()
 
       if(VIDEO_WAYLAND_QT_TOUCH)
+          set(HAVE_VIDEO_WAYLAND_QT_TOUCH TRUE)
           set(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1)
       endif()
 
@@ -901,12 +902,14 @@
         endif()
       endif()
 
-      check_c_source_compiles("
-          #include <pthread.h>
-          #include <pthread_np.h>
-          int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H)
-      check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
-      check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
+      check_include_files("pthread.h" HAVE_PTHREAD_H)
+      check_include_files("pthread_np.h" HAVE_PTHREAD_NP_H)
+      if (HAVE_PTHREAD_H)
+        check_symbol_exists(pthread_setname_np "pthread.h" HAVE_PTHREAD_SETNAME_NP)
+        if (HAVE_PTHREAD_NP_H)
+          check_symbol_exists(pthread_set_name_np "pthread.h;pthread_np.h" HAVE_PTHREAD_SET_NAME_NP)
+        endif()
+      endif()
 
       set(SOURCE_FILES ${SOURCE_FILES}
           ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c
@@ -970,8 +973,8 @@
         #include <usb.h>
         #endif
         #ifdef __DragonFly__
-        # include <bus/usb/usb.h>
-        # include <bus/usb/usbhid.h>
+        # include <bus/u4b/usb.h>
+        # include <bus/u4b/usbhid.h>
         #else
         # include <dev/usb/usb.h>
         # include <dev/usb/usbhid.h>
@@ -996,8 +999,8 @@
           #include <usb.h>
           #endif
           #ifdef __DragonFly__
-          # include <bus/usb/usb.h>
-          # include <bus/usb/usbhid.h>
+          # include <bus/u4b/usb.h>
+          # include <bus/u4b/usbhid.h>
           #else
           # include <dev/usb/usb.h>
           # include <dev/usb/usbhid.h>
@@ -1024,8 +1027,8 @@
           #include <usb.h>
           #endif
           #ifdef __DragonFly__
-          #include <bus/usb/usb.h>
-          #include <bus/usb/usbhid.h>
+          #include <bus/u4b/usb.h>
+          #include <bus/u4b/usbhid.h>
           #else
           #include <dev/usb/usb.h>
           #include <dev/usb/usbhid.h>
@@ -1074,7 +1077,7 @@
       set(HAVE_HIDAPI TRUE)
     else()
       set(HAVE_HIDAPI FALSE)
-      pkg_check_modules(LIBUSB libusb)
+      pkg_check_modules(LIBUSB libusb-1.0)
       if (LIBUSB_FOUND)
         check_include_file(libusb.h HAVE_LIBUSB_H ${LIBUSB_CFLAGS})
         if (HAVE_LIBUSB_H)
@@ -1088,7 +1091,7 @@
       set(HAVE_SDL_JOYSTICK TRUE)
       file(GLOB HIDAPI_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/hidapi/*.c)
       set(SOURCE_FILES ${SOURCE_FILES} ${HIDAPI_SOURCES})
-      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS} -I${SDL2_SOURCE_DIR}/src/hidapi/hidapi")
+      set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${LIBUSB_CFLAGS} \"-I${SDL2_SOURCE_DIR}/src/hidapi/hidapi\"")
       if(NOT HIDAPI_SKIP_LIBUSB)
         if(HIDAPI_ONLY_LIBUSB)
           set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/hidapi/libusb/hid.c)
@@ -1160,7 +1163,8 @@
       set(HAVE_SDL_VIDEO TRUE)
 
       file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c)
-      set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES})
+      file(GLOB KMSDRM_LEGACY_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm_legacy/*.c)
+      set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES} ${KMSDRM_LEGACY_SOURCES})
 
       list(APPEND EXTRA_CFLAGS ${KMSDRM_CFLAGS})
 

--
Gitblit v1.9.3