From f08b3f2046e9f72369c36fe39e71ced5d1943e8c Mon Sep 17 00:00:00 2001 From: Rye Mutt Date: Fri, 2 Aug 2024 06:31:11 -0400 Subject: [PATCH] Update to libhunspell 1.7.2-r1 (#2175) --- autobuild.xml | 16 ++++++++-------- indra/cmake/Copy3rdPartyLibs.cmake | 3 --- indra/cmake/Hunspell.cmake | 13 ++++++++++--- indra/llui/llspellcheck.cpp | 26 +++++++------------------- indra/newview/CMakeLists.txt | 1 - indra/newview/viewer_manifest.py | 5 ----- 6 files changed, 25 insertions(+), 39 deletions(-) diff --git a/autobuild.xml b/autobuild.xml index f3d14ac2b0d..9e83c5f927b 100644 --- a/autobuild.xml +++ b/autobuild.xml @@ -1112,11 +1112,11 @@ archive hash - d5757ab84d934fa358f299ab91e2e297beaa3dac + e71ae7a645603fe967a69aa5beb5b3009185e177 hash_algorithm sha1 url - https://github.com/secondlife/3p-libhunspell/releases/download/v1.3.2.650fb94/libhunspell-1.3.2.650fb94-darwin64-650fb94.tar.zst + https://github.com/secondlife/3p-libhunspell/releases/download/v1.7.2-r1/libhunspell-1.7.2.10207243663-darwin64-10207243663.tar.zst name darwin64 @@ -1126,11 +1126,11 @@ archive hash - 6413d3bd4cd50c2a6b7f949eb4bd6f0c94feb984 + 275ffb7f60064d8008aed8406f80f34229f651fc hash_algorithm sha1 url - https://github.com/secondlife/3p-libhunspell/releases/download/v1.3.2.650fb94/libhunspell-1.3.2.650fb94-linux64-650fb94.tar.zst + https://github.com/secondlife/3p-libhunspell/releases/download/v1.7.2-r1/libhunspell-1.7.2.10207243663-linux64-10207243663.tar.zst name linux64 @@ -1140,11 +1140,11 @@ archive hash - c1be4a79b20435030b2e0e01b582c61b462c8376 + 89ff24e93eaeca7949ccdb5cc368f938f5b1f307 hash_algorithm sha1 url - https://github.com/secondlife/3p-libhunspell/releases/download/v1.3.2.650fb94/libhunspell-1.3.2.650fb94-windows64-650fb94.tar.zst + https://github.com/secondlife/3p-libhunspell/releases/download/v1.7.2-r1/libhunspell-1.7.2.10207243663-windows64-10207243663.tar.zst name windows64 @@ -1155,9 +1155,9 @@ license_file LICENSES/hunspell.txt copyright - See hunspell.txt + LGPL 2.1 version - 1.3.2.650fb94 + 1.7.2.10207243663 name libhunspell description diff --git a/indra/cmake/Copy3rdPartyLibs.cmake b/indra/cmake/Copy3rdPartyLibs.cmake index c2ba9231cc3..2dc9d6080aa 100644 --- a/indra/cmake/Copy3rdPartyLibs.cmake +++ b/indra/cmake/Copy3rdPartyLibs.cmake @@ -57,7 +57,6 @@ if(WINDOWS) libapr-1.dll libaprutil-1.dll nghttp2.dll - libhunspell.dll ) # OpenSSL @@ -185,7 +184,6 @@ elseif(DARWIN) libaprutil-1.0.dylib libaprutil-1.dylib ${EXPAT_COPY} - libhunspell-1.3.0.dylib libndofdev.dylib libnghttp2.dylib libnghttp2.14.dylib @@ -231,7 +229,6 @@ elseif(LINUX) libatk-1.0.so libfreetype.so.6.6.2 libfreetype.so.6 - libhunspell-1.3.so.0.0.0 libopenjp2.so libuuid.so.16 libuuid.so.16.0.22 diff --git a/indra/cmake/Hunspell.cmake b/indra/cmake/Hunspell.cmake index bb037c0237b..129679febdb 100644 --- a/indra/cmake/Hunspell.cmake +++ b/indra/cmake/Hunspell.cmake @@ -1,4 +1,5 @@ # -*- cmake -*- +include(Linking) include(Prebuilt) include_guard() @@ -8,10 +9,16 @@ add_library( ll::hunspell INTERFACE IMPORTED ) use_system_binary(hunspell) use_prebuilt_binary(libhunspell) if (WINDOWS) - target_link_libraries( ll::hunspell INTERFACE libhunspell) + target_compile_definitions( ll::hunspell INTERFACE HUNSPELL_STATIC=1) + target_link_libraries( ll::hunspell INTERFACE + debug ${ARCH_PREBUILT_DIRS_DEBUG}/libhunspell.lib + optimized ${ARCH_PREBUILT_DIRS_RELEASE}/libhunspell.lib + ) elseif(DARWIN) - target_link_libraries( ll::hunspell INTERFACE hunspell-1.3) + target_link_libraries( ll::hunspell INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libhunspell-1.7.a + ) elseif(LINUX) - target_link_libraries( ll::hunspell INTERFACE hunspell-1.3) + target_link_libraries( ll::hunspell INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libhunspell-1.7.a + ) endif() target_include_directories( ll::hunspell SYSTEM INTERFACE ${LIBS_PREBUILT_DIR}/include/hunspell) diff --git a/indra/llui/llspellcheck.cpp b/indra/llui/llspellcheck.cpp index 9d8eadfd3ff..16ffd352cf2 100644 --- a/indra/llui/llspellcheck.cpp +++ b/indra/llui/llspellcheck.cpp @@ -30,12 +30,7 @@ #include "llsdserialize.h" #include "llspellcheck.h" -#if LL_WINDOWS - #include - #pragma comment(lib, "libhunspell.lib") -#else - #include -#endif +#include static const std::string DICT_DIR = "dictionaries"; static const std::string DICT_FILE_CUSTOM = "user_custom.dic"; @@ -64,11 +59,11 @@ void LLSpellChecker::initSingleton() bool LLSpellChecker::checkSpelling(const std::string& word) const { - if ( (!mHunspell) || (word.length() < 3) || (0 != mHunspell->spell(word.c_str())) ) + if ( (!mHunspell) || (word.length() < 3) || (0 != mHunspell->spell(word)) ) { return true; } - if (mIgnoreList.size() > 0) + if (!mIgnoreList.empty()) { std::string word_lower(word); LLStringUtil::toLower(word_lower); @@ -85,15 +80,8 @@ S32 LLSpellChecker::getSuggestions(const std::string& word, std::vectorsuggest(&suggestion_list, word.c_str())) != 0 ) - { - for (int suggestion_index = 0; suggestion_index < suggestion_cnt; suggestion_index++) - { - suggestions.push_back(suggestion_list[suggestion_index]); - } - mHunspell->free_list(&suggestion_list, suggestion_cnt); - } + suggestions = mHunspell->suggest(word); + return static_cast(suggestions.size()); } @@ -194,7 +182,7 @@ void LLSpellChecker::addToCustomDictionary(const std::string& word) { if (mHunspell) { - mHunspell->add(word.c_str()); + mHunspell->add(word); } addToDictFile(getDictionaryUserPath() + DICT_FILE_CUSTOM, word); sSettingsChangeSignal(); @@ -422,7 +410,7 @@ bool LLSpellChecker::canRemoveDictionary(const std::string& dict_language) const LLSD dict_info = getDictionaryData(dict_language); return (dict_info["user_installed"].asBoolean()) && - ( (!getUseSpellCheck()) || (!LLSpellChecker::instance().isActiveDictionary(dict_language)) ); + ( (!getUseSpellCheck()) || (!isActiveDictionary(dict_language)) ); } void LLSpellChecker::removeDictionary(const std::string& dict_language) diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index a34354d287e..4c5deb49744 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -1729,7 +1729,6 @@ if (WINDOWS) ${CMAKE_SOURCE_DIR}/../etc/message.xml ${CMAKE_SOURCE_DIR}/../scripts/messages/message_template.msg ${SHARED_LIB_STAGING_DIR}/openjp2.dll - ${SHARED_LIB_STAGING_DIR}/libhunspell.dll ${SHARED_LIB_STAGING_DIR}/llwebrtc.dll #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/SLVoice.exe #${SHARED_LIB_STAGING_DIR}/${LL_INTDIR}/libsndfile-1.dll diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index a25efc5de4a..09397a0989e 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -587,9 +587,6 @@ def construct(self): # HTTP/2 self.path("nghttp2.dll") - # Hunspell - self.path("libhunspell.dll") - # BugSplat if self.args.get('bugsplat'): self.path("BsSndRpt64.exe") @@ -930,7 +927,6 @@ def construct(self): with self.prefix(src=relpkgdir, dst=""): self.path("libndofdev.dylib") - self.path("libhunspell-*.dylib") with self.prefix(src_dst="cursors_mac"): self.path("*.tif") @@ -1336,7 +1332,6 @@ def construct(self): self.path("libdirectfb-1.4.so.5") self.path("libfusion-1.4.so.5") self.path("libdirect-1.4.so.5*") - self.path("libhunspell-1.3.so*") self.path("libalut.so*") self.path("libopenal.so*") self.path("libopenal.so", "libvivoxoal.so.1") # vivox's sdk expects this soname