gamecontrollerdb.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. From a5971d3fe76be19d55f4032461d1acb77ece8d04 Mon Sep 17 00:00:00 2001
  2. From: orbea <orbea@riseup.net>
  3. Date: Mon, 15 Nov 2021 11:31:49 -0800
  4. Subject: [PATCH] Allow installing the database
  5. ---
  6. CMakeLists.txt | 6 ++++--
  7. sdl2-jstest.c | 2 +-
  8. 2 files changed, 5 insertions(+), 3 deletions(-)
  9. diff --git a/CMakeLists.txt b/CMakeLists.txt
  10. index f70d26e..b651581 100644
  11. --- a/CMakeLists.txt
  12. +++ b/CMakeLists.txt
  13. @@ -29,8 +29,7 @@ include(GetProjectVersion)
  14. include(GNUInstallDirs)
  15. add_definitions(-DSDL_JSTEST_VERSION="${PROJECT_VERSION}")
  16. -
  17. -include(GNUInstallDirs)
  18. +add_definitions(-DGAMECONTROLLERDB="${CMAKE_INSTALL_FULL_DATADIR}/sdl-jstest/gamecontrollerdb.txt")
  19. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
  20. @@ -107,6 +106,9 @@ if(BUILD_SDL2_JSTEST)
  21. install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sdl2-jstest.1
  22. DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
  23. + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gamecontrollerdb.txt
  24. + DESTINATION ${CMAKE_INSTALL_DATADIR}/sdl-jstest)
  25. +
  26. install(TARGETS sdl2-jstest
  27. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
  28. endif()
  29. diff --git a/sdl2-jstest.c b/sdl2-jstest.c
  30. index 61e95ea..94c402f 100644
  31. --- a/sdl2-jstest.c
  32. +++ b/sdl2-jstest.c
  33. @@ -579,7 +579,7 @@ int main(int argc, char** argv)
  34. atexit(SDL_Quit);
  35. {
  36. - int ret = SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt");
  37. + int ret = SDL_GameControllerAddMappingsFromFile(GAMECONTROLLERDB);
  38. if (ret < 0)
  39. {
  40. fprintf(stderr, "error: failed to read gamecontrollerdb.txt: %s\n", SDL_GetError());
  41. --
  42. 2.29.2