diff options
-rw-r--r-- | libraries/LucenePlusPlus/LucenePlusPlus.SlackBuild | 11 | ||||
-rw-r--r-- | libraries/LucenePlusPlus/boost.patch | 203 | ||||
-rw-r--r-- | libraries/LucenePlusPlus/e6a376836e5c891577eae6369263152106b9bc02.patch | 78 |
3 files changed, 290 insertions, 2 deletions
diff --git a/libraries/LucenePlusPlus/LucenePlusPlus.SlackBuild b/libraries/LucenePlusPlus/LucenePlusPlus.SlackBuild index 338cd26ea9..234aa4bb31 100644 --- a/libraries/LucenePlusPlus/LucenePlusPlus.SlackBuild +++ b/libraries/LucenePlusPlus/LucenePlusPlus.SlackBuild @@ -2,7 +2,7 @@ # Slackware build script for LucenePlusPlus -# Copyright 2014-2024 Willy Sudiarto Raharjo <willysr@slackbuilds.org> +# Copyright 2014-2025 Willy Sudiarto Raharjo <willysr@slackbuilds.org> # All rights reserved. # # Redistribution and use of this script, with or without modification, is @@ -26,7 +26,7 @@ cd $(dirname $0) ; CWD=$(pwd) PRGNAM=LucenePlusPlus VERSION=${VERSION:-3.0.9} -BUILD=${BUILD:-1} +BUILD=${BUILD:-2} TAG=${TAG:-_SBo} PKGTYPE=${PKGTYPE:-tgz} @@ -78,6 +78,13 @@ find -L . \ patch -p1 < $CWD/a460863810b3a6a473780686e5d3fd70bf4378ba.patch patch -p1 < $CWD/76dc90f2b65d81be018c499714ff11e121ba5585.patch +patch -p1 < $CWD/e6a376836e5c891577eae6369263152106b9bc02.patch +patch -p1 < $CWD/boost.patch + +# Thanks to Conraid +sed -e '/cmake_minimum_required/s/VERSION [0-9.]*)/VERSION 3.5...4.0)/' \ + -i CMakeLists.txt -i cmake/cotire.cmake -i src/core/CMakeLists.txt -i src/contrib/CMakeLists.txt + mkdir -p build cd build cmake \ diff --git a/libraries/LucenePlusPlus/boost.patch b/libraries/LucenePlusPlus/boost.patch new file mode 100644 index 0000000000..5afcd9eedc --- /dev/null +++ b/libraries/LucenePlusPlus/boost.patch @@ -0,0 +1,203 @@ +diff -Naupr a/CMakeLists.txt c/CMakeLists.txt +--- a/CMakeLists.txt 2024-02-18 19:18:26.000000000 +0100 ++++ c/CMakeLists.txt 2025-03-31 10:09:11.175008239 +0200 +@@ -47,7 +47,7 @@ include(dependencies) + include(Lucene++Docs) + + # Enable C++11 +-set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD 17) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + + #################################### +diff -Naupr a/src/core/document/NumericField.cpp c/src/core/document/NumericField.cpp +--- a/src/core/document/NumericField.cpp 2024-02-18 19:18:26.000000000 +0100 ++++ c/src/core/document/NumericField.cpp 2025-03-31 10:29:14.383300303 +0200 +@@ -4,6 +4,10 @@ + // or the GNU Lesser General Public License. + ///////////////////////////////////////////////////////////////////////////// + ++#include <boost/variant/get.hpp> ++#include <locale> ++#include <codecvt> ++ + #include "LuceneInc.h" + #include "NumericField.h" + #include "Field.h" +@@ -53,9 +57,23 @@ ReaderPtr NumericField::readerValue() { + } + + String NumericField::stringValue() { +- StringStream value; +- value << fieldsData; +- return value.str(); ++ std::stringstream value; ++ ++ // Estrazione del valore numerico (come prima) ++ if (int* v = boost::get<int>(&fieldsData)) { ++ value << *v; ++ } else if (int64_t* v = boost::get<int64_t>(&fieldsData)) { ++ value << *v; ++ } else if (double* v = boost::get<double>(&fieldsData)) { ++ value << *v; ++ } else { ++ value << "0"; ++ } ++ ++ std::string narrowStr = value.str(); ++ std::wstring wideStr(narrowStr.begin(), narrowStr.end()); ++ return String(wideStr); ++ + } + + int64_t NumericField::getNumericValue() { +diff -Naupr a/src/core/search/FieldDoc.cpp c/src/core/search/FieldDoc.cpp +--- a/src/core/search/FieldDoc.cpp 2024-02-18 19:18:26.000000000 +0100 ++++ c/src/core/search/FieldDoc.cpp 2025-03-31 10:42:12.819612969 +0200 +@@ -6,6 +6,7 @@ + + #include "LuceneInc.h" + #include "FieldDoc.h" ++#include <boost/variant/get.hpp> + + namespace Lucene { + +@@ -19,14 +20,31 @@ FieldDoc::~FieldDoc() { + String FieldDoc::toString() { + StringStream buffer; + buffer << ScoreDoc::toString() << L"["; ++ ++ bool first = true; + for (Collection<ComparableValue>::iterator field = fields.begin(); field != fields.end(); ++field) { +- if (field != fields.begin()) { ++ if (!first) { + buffer << L", "; + } +- buffer << *field; ++ first = false; ++ ++ // Gestione del boost::variant ++ if (const std::wstring* s = boost::get<std::wstring>(&*field)) { ++ buffer << *s; ++ } else if (const int32_t* i = boost::get<int32_t>(&*field)) { ++ buffer << *i; ++ } else if (const int64_t* l = boost::get<int64_t>(&*field)) { ++ buffer << *l; ++ } else if (const double* d = boost::get<double>(&*field)) { ++ buffer << *d; ++ } else if (const uint8_t* b = boost::get<uint8_t>(&*field)) { ++ buffer << static_cast<int>(*b); ++ } ++ // Aggiungi altri tipi se necessario + } ++ + buffer << L"]"; + return buffer.str(); + } + +-} ++} // namespace Lucene +diff -Naupr a/src/core/search/NumericRangeQuery.cpp c/src/core/search/NumericRangeQuery.cpp +--- a/src/core/search/NumericRangeQuery.cpp 2024-02-18 19:18:26.000000000 +0100 ++++ c/src/core/search/NumericRangeQuery.cpp 2025-03-31 10:46:59.001580233 +0200 +@@ -3,7 +3,7 @@ + // Distributable under the terms of either the Apache License (Version 2.0) + // or the GNU Lesser General Public License. + ///////////////////////////////////////////////////////////////////////////// +- ++#include <boost/variant/get.hpp> + #include "LuceneInc.h" + #include "NumericRangeQuery.h" + #include "_NumericRangeQuery.h" +@@ -131,17 +131,36 @@ String NumericRangeQuery::toString(const + buffer << this->field << L":"; + } + buffer << (minInclusive ? L"[" : L"{"); ++ ++ // Gestione del valore minimo + if (VariantUtils::isNull(min)) { + buffer << L"*"; + } else { +- buffer << min; ++ // Estrazione del valore dal variant ++ if (const int32_t* i = boost::get<int32_t>(&min)) { ++ buffer << *i; ++ } else if (const int64_t* l = boost::get<int64_t>(&min)) { ++ buffer << *l; ++ } else if (const double* d = boost::get<double>(&min)) { ++ buffer << *d; ++ } + } ++ + buffer << L" TO "; ++ ++ // Gestione del valore massimo (NOTA: c'รจ un bug nel codice originale che usa 'min' invece di 'max') + if (VariantUtils::isNull(max)) { + buffer << L"*"; + } else { +- buffer << max; ++ if (const int32_t* i = boost::get<int32_t>(&max)) { ++ buffer << *i; ++ } else if (const int64_t* l = boost::get<int64_t>(&max)) { ++ buffer << *l; ++ } else if (const double* d = boost::get<double>(&max)) { ++ buffer << *d; ++ } + } ++ + buffer << (maxInclusive ? L"]" : L"}"); + buffer << boostString(); + return buffer.str(); +diff -Naupr a/src/core/search/TermRangeQuery.cpp c/src/core/search/TermRangeQuery.cpp +--- a/src/core/search/TermRangeQuery.cpp 2024-02-18 19:18:26.000000000 +0100 ++++ c/src/core/search/TermRangeQuery.cpp 2025-03-31 10:51:38.091670633 +0200 +@@ -10,6 +10,7 @@ + #include "Collator.h" + #include "StringUtils.h" + #include "VariantUtils.h" ++#include <boost/variant/get.hpp> + + namespace Lucene { + +@@ -72,22 +73,39 @@ String TermRangeQuery::toString(const St + buffer << getField() << L":"; + } + buffer << (includeLower ? L"[" : L"{"); ++ ++ // Gestione del lowerTerm + if (VariantUtils::isNull(lowerTerm)) { + buffer << L"*"; + } else { +- buffer << lowerTerm; ++ // Estrazione del valore stringa dal variant ++ if (const String* s = boost::get<String>(&lowerTerm)) { ++ buffer << *s; ++ } else if (const std::wstring* ws = boost::get<std::wstring>(&lowerTerm)) { ++ buffer << *ws; ++ } ++ // Aggiungi altri tipi se necessario + } ++ + buffer << L" TO "; ++ ++ // Gestione dell'upperTerm + if (VariantUtils::isNull(upperTerm)) { + buffer << L"*"; + } else { +- buffer << upperTerm; ++ if (const String* s = boost::get<String>(&upperTerm)) { ++ buffer << *s; ++ } else if (const std::wstring* ws = boost::get<std::wstring>(&upperTerm)) { ++ buffer << *ws; ++ } + } ++ + buffer << (includeUpper ? L"]" : L"}"); + buffer << boostString(); + return buffer.str(); + } + ++ + bool TermRangeQuery::equals(const LuceneObjectPtr& other) { + if (LuceneObject::equals(other)) { + return true; diff --git a/libraries/LucenePlusPlus/e6a376836e5c891577eae6369263152106b9bc02.patch b/libraries/LucenePlusPlus/e6a376836e5c891577eae6369263152106b9bc02.patch new file mode 100644 index 0000000000..9e91f2296b --- /dev/null +++ b/libraries/LucenePlusPlus/e6a376836e5c891577eae6369263152106b9bc02.patch @@ -0,0 +1,78 @@ +From e6a376836e5c891577eae6369263152106b9bc02 Mon Sep 17 00:00:00 2001 +From: Christian Heusel <christian@heusel.eu> +Date: Tue, 21 Jan 2025 01:01:58 +0100 +Subject: [PATCH] Migrate to boost::asio::io_context + +The code previously used the deprecated (and with bost 1.87.0 removed) +`boost::asio::io_service`, which used to be an alias to `io_context`. +The new version heavily changes the `io_context` API and therefore is no +the old interface was removed. + +Fixes https://github.com/luceneplusplus/LucenePlusPlus/issues/208 + +Signed-off-by: Christian Heusel <christian@heusel.eu> +--- + include/lucene++/ThreadPool.h | 10 ++++++---- + src/core/util/ThreadPool.cpp | 9 +++++---- + 2 files changed, 11 insertions(+), 8 deletions(-) + +diff --git a/include/lucene++/ThreadPool.h b/include/lucene++/ThreadPool.h +index dc6446ff..175ac8ad 100644 +--- a/include/lucene++/ThreadPool.h ++++ b/include/lucene++/ThreadPool.h +@@ -14,7 +14,9 @@ + + namespace Lucene { + +-typedef boost::shared_ptr<boost::asio::io_service::work> workPtr; ++ ++typedef boost::asio::io_context io_context_t; ++typedef boost::asio::executor_work_guard<io_context_t::executor_type> work_t; + + /// A Future represents the result of an asynchronous computation. Methods are provided to check if the computation + /// is complete, to wait for its completion, and to retrieve the result of the computation. The result can only be +@@ -51,8 +53,8 @@ class ThreadPool : public LuceneObject { + LUCENE_CLASS(ThreadPool); + + protected: +- boost::asio::io_service io_service; +- workPtr work; ++ io_context_t io_context; ++ work_t work; + boost::thread_group threadGroup; + + static const int32_t THREADPOOL_SIZE; +@@ -64,7 +66,7 @@ class ThreadPool : public LuceneObject { + template <typename FUNC> + FuturePtr scheduleTask(FUNC func) { + FuturePtr future(newInstance<Future>()); +- io_service.post(boost::bind(&ThreadPool::execute<FUNC>, this, func, future)); ++ boost::asio::post(io_context, boost::bind(&ThreadPool::execute<FUNC>, this, func, future)); + return future; + } + +diff --git a/src/core/util/ThreadPool.cpp b/src/core/util/ThreadPool.cpp +index 8086d8b1..116f521c 100644 +--- a/src/core/util/ThreadPool.cpp ++++ b/src/core/util/ThreadPool.cpp +@@ -14,15 +14,16 @@ Future::~Future() { + + const int32_t ThreadPool::THREADPOOL_SIZE = 5; + +-ThreadPool::ThreadPool() { +- work.reset(new boost::asio::io_service::work(io_service)); ++ThreadPool::ThreadPool() ++ : ++ work(boost::asio::make_work_guard(io_context)) ++{ + for (int32_t i = 0; i < THREADPOOL_SIZE; ++i) { +- threadGroup.create_thread(boost::bind(&boost::asio::io_service::run, &io_service)); ++ threadGroup.create_thread(boost::bind(&boost::asio::io_context::run, &io_context)); + } + } + + ThreadPool::~ThreadPool() { +- work.reset(); // stop all threads + threadGroup.join_all(); // wait for all competition + } + |