File 0011-Use-system-fmt-yaml-cpp-hunspell.patch of Package rstudio

From 5e3e62745d61dc529c4caf06ecc197246e41e3e3 Mon Sep 17 00:00:00 2001
From: haem <mixosaurus+obs@pm.me>
Date: Fri, 12 Sep 2025 18:04:39 +0200
Subject: [PATCH 11/12] Use system fmt, yaml-cpp, hunspell

---
 src/cpp/CMakeLists.txt      |  5 ++++-
 src/cpp/core/CMakeLists.txt | 11 ++++++++---
 src/cpp/ext/CMakeLists.txt  | 17 -----------------
 3 files changed, 12 insertions(+), 21 deletions(-)

diff --git a/src/cpp/CMakeLists.txt b/src/cpp/CMakeLists.txt
index ac002742..b6f8f503 100644
--- a/src/cpp/CMakeLists.txt
+++ b/src/cpp/CMakeLists.txt
@@ -546,7 +546,10 @@ endif()
 
 # external libraries
 add_subdirectory(ext)
-include_directories(SYSTEM "${FMT_SOURCE_DIR}/include")
+
+if(NOT RSTUDIO_USE_SYSTEM_FMT)
+   include_directories(SYSTEM "${FMT_SOURCE_DIR}/include")
+endif()
 
 # shared library
 add_subdirectory(shared_core)
diff --git a/src/cpp/core/CMakeLists.txt b/src/cpp/core/CMakeLists.txt
index 0fa71d81..66363913 100644
--- a/src/cpp/core/CMakeLists.txt
+++ b/src/cpp/core/CMakeLists.txt
@@ -203,6 +203,12 @@ if (UNIX)
       ${ZLIB_LIBRARIES}
       ${CORE_SERVICES_LIBRARY})
 
+   if(RSTUDIO_USE_SYSTEM_HUNSPELL)
+      find_library(HUNSPELL_LIBRARIES hunspell)
+      list(APPEND CORE_SYSTEM_LIBRARIES ${HUNSPELL_LIBRARIES})
+      message(STATUS "Using system hunspell in core libraries")
+   endif()
+
    list(APPEND CORE_SYSTEM_LIBRARIES ${OPENSSL_LIBRARIES})
    list(APPEND CORE_INCLUDE_DIRS ${OPENSSL_INCLUDE_DIR})
 
@@ -327,14 +333,13 @@ define_source_file_names(rstudio-core)
 # link dependencies
 target_link_libraries(rstudio-core
    rstudio-shared-core
-   rstudio-hunspell
    rstudio-websocketpp
    ${Boost_LIBRARIES}
    ${CRASHPAD_LIBRARIES}
    ${SOCI_LIBRARIES}
    ${CORE_SYSTEM_LIBRARIES}
-   fmt::fmt
-   yaml-cpp::yaml-cpp
+   fmt
+   yaml-cpp
    gsl-lite
    expected
 )
diff --git a/src/cpp/ext/CMakeLists.txt b/src/cpp/ext/CMakeLists.txt
index 4c6349cc..0c8e7fc4 100644
--- a/src/cpp/ext/CMakeLists.txt
+++ b/src/cpp/ext/CMakeLists.txt
@@ -248,20 +248,3 @@ target_include_directories(rstudio-rapidjson INTERFACE "${RAPIDJSON_SOURCE_DIR}/
 # Create websocketpp target.
 add_library(rstudio-websocketpp INTERFACE EXCLUDE_FROM_ALL)
 target_include_directories(rstudio-websocketpp INTERFACE "${WEBSOCKETPP_SOURCE_DIR}")
-
-
-# Create hunspell target.
-file(GLOB HUNSPELL_HEADER_FILES "${HUNSPELL_SOURCE_DIR}/src/hunspell/*.h*")
-file(GLOB HUNSPELL_SOURCE_FILES "${HUNSPELL_SOURCE_DIR}/src/hunspell/*.c*")
-add_library(rstudio-hunspell STATIC ${HUNSPELL_SOURCE_FILES} ${HUNSPELL_HEADER_FILES})
-set_target_properties(rstudio-hunspell PROPERTIES LINKER_LANGUAGE CXX)
-target_include_directories(rstudio-hunspell SYSTEM AFTER INTERFACE "${HUNSPELL_SOURCE_DIR}/src")
-target_compile_definitions(rstudio-hunspell PUBLIC HUNSPELL_STATIC=1)
-
-if(WIN32)
-   target_include_directories(rstudio-hunspell SYSTEM AFTER PRIVATE "${HUNSPELL_PREFIX_DIR}/msvc")
-   target_compile_options(rstudio-hunspell PRIVATE /wd4244 /wd4267)
-   target_compile_options(rstudio-hunspell INTERFACE /wd4996)
-else()
-   target_compile_options(rstudio-hunspell PRIVATE -Wno-deprecated-declarations -Wno-sign-compare -Wno-unused-but-set-variable)
-endif()
-- 
2.51.0

openSUSE Build Service is sponsored by