summaryrefslogtreecommitdiff
path: root/games-engines/odamex/files/odamex-10.0.0-unbundle-fltk.patch
diff options
context:
space:
mode:
Diffstat (limited to 'games-engines/odamex/files/odamex-10.0.0-unbundle-fltk.patch')
-rw-r--r--games-engines/odamex/files/odamex-10.0.0-unbundle-fltk.patch105
1 files changed, 105 insertions, 0 deletions
diff --git a/games-engines/odamex/files/odamex-10.0.0-unbundle-fltk.patch b/games-engines/odamex/files/odamex-10.0.0-unbundle-fltk.patch
new file mode 100644
index 000000000000..1c9a8753b44a
--- /dev/null
+++ b/games-engines/odamex/files/odamex-10.0.0-unbundle-fltk.patch
@@ -0,0 +1,105 @@
+From 8a2b7c043fe86916d56044d7489f8dce6ed2d479 Mon Sep 17 00:00:00 2001
+From: James Le Cuirot <chewi@gentoo.org>
+Date: Sun, 27 Feb 2022 14:01:33 +0000
+Subject: [PATCH 3/3] Allow building against the system FLTK library
+
+`USE_INTERNAL_FLTK` defaults to true and ignores `USE_INTERNAL_LIBS`
+because users are unlikely to have it installed.
+
+Odamex makes of use screen scaling features in FLTK that have not yet
+been released. This change therefore checks for the Fl::screen_scale
+symbol and skips the associated code if it is absent. In practise, this
+only affects the size of the dialog window on HiDPI screens. The game
+window is unaffected.
+
+Tested against FLTK 1.3.5 on Gentoo Linux.
+
+(cherry picked from commit 656afab54e30598022f4dd2af298cf6a487a1fe1)
+---
+ CMakeLists.txt | 1 +
+ client/CMakeLists.txt | 23 ++++++++++++++++++++++-
+ client/gui/gui_boot.cpp | 2 ++
+ libraries/CMakeLists.txt | 2 +-
+ 4 files changed, 26 insertions(+), 2 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 9353d0c6b..599b6e85b 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -42,6 +42,7 @@ option(USE_INTERNAL_DEUTEX "Use internal DeuTex" ${USE_INTERNAL_LIBS})
+ cmake_dependent_option( USE_INTERNAL_ZLIB "Use internal zlib" ${USE_INTERNAL_LIBS} BUILD_CLIENT 0 )
+ cmake_dependent_option( USE_INTERNAL_PNG "Use internal libpng" ${USE_INTERNAL_LIBS} BUILD_CLIENT 0 )
+ cmake_dependent_option( USE_INTERNAL_CURL "Use internal libcurl" ${USE_INTERNAL_LIBS} BUILD_CLIENT 0 )
++cmake_dependent_option( USE_INTERNAL_FLTK "Use internal FLTK" 1 BUILD_CLIENT 0 )
+ cmake_dependent_option( USE_INTERNAL_JSONCPP "Use internal JsonCpp" 1 BUILD_SERVER 0 )
+ cmake_dependent_option( USE_INTERNAL_WXWIDGETS "Use internal wxWidgets" ${USE_INTERNAL_LIBS} BUILD_LAUNCHER 0 )
+ cmake_dependent_option( ENABLE_PORTMIDI "Enable portmidi support" 1 BUILD_CLIENT 0 )
+diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt
+index bd071a7a5..ff1e72ba3 100644
+--- a/client/CMakeLists.txt
++++ b/client/CMakeLists.txt
+@@ -206,7 +206,28 @@ if(TARGET SDL2::SDL2 OR TARGET SDL::SDL)
+ target_link_libraries(odamex ${PNG_LIBRARY} ${ZLIB_LIBRARY} CURL::libcurl)
+ if(NOT GCONSOLE)
+ target_include_directories(odamex PRIVATE gui)
+- target_link_libraries(odamex fltk fltk_images)
++
++ if(USE_INTERNAL_FLTK)
++ set(FLTK_LIBRARIES fltk fltk_images)
++ set(HAVE_FLTK_SCREEN_SCALE TRUE)
++ else()
++ set(FLTK_SKIP_OPENGL 1)
++ set(FLTK_SKIP_FORMS 1)
++ set(FLTK_SKIP_FLUID 1)
++ find_package(FLTK REQUIRED)
++ target_include_directories(odamex SYSTEM PRIVATE ${FLTK_INCLUDE_DIR})
++
++ include(CheckCXXSymbolExists)
++ set(CMAKE_REQUIRED_INCLUDES ${FLTK_INCLUDE_DIR})
++ set(CMAKE_REQUIRED_LIBRARIES ${FLTK_LIBRARIES})
++ check_cxx_symbol_exists(Fl::screen_scale "FL/Fl.H" HAVE_FLTK_SCREEN_SCALE)
++ endif()
++
++ if(HAVE_FLTK_SCREEN_SCALE)
++ target_compile_definitions(odamex PRIVATE HAVE_FLTK_SCREEN_SCALE)
++ endif()
++
++ target_link_libraries(odamex ${FLTK_LIBRARIES})
+ endif()
+
+ if(ENABLE_PORTMIDI)
+diff --git a/client/gui/gui_boot.cpp b/client/gui/gui_boot.cpp
+index f0a0035d1..834038209 100644
+--- a/client/gui/gui_boot.cpp
++++ b/client/gui/gui_boot.cpp
+@@ -315,12 +315,14 @@ static BootWindow* MakeBootWindow()
+ */
+ std::string GUI_BootWindow()
+ {
++#ifdef HAVE_FLTK_SCREEN_SCALE
+ // Scale according to 1600x900.
+ Fl::screen_scale(0, MAX(Fl::h() / 900.0f, 1.0f));
+
+ // This feature is too clever by half, and in my experience just
+ // deforms the window.
+ Fl::keyboard_screen_scaling(0);
++#endif
+
+ BootWindow* win = MakeBootWindow();
+ win->initWADDirs();
+diff --git a/libraries/CMakeLists.txt b/libraries/CMakeLists.txt
+index 493d8f12b..a53441d13 100644
+--- a/libraries/CMakeLists.txt
++++ b/libraries/CMakeLists.txt
+@@ -255,7 +255,7 @@ endif()
+
+ ### FLTK (dep: libpng) ###
+
+-if(BUILD_CLIENT)
++if(BUILD_CLIENT AND USE_INTERNAL_FLTK)
+ message(STATUS "Compiling FLTK...")
+
+ set(_FLTK_BUILDGEN_PARAMS
+--
+2.34.1
+