Lucene++: update to 3.0.9.

This commit is contained in:
Đoàn Trần Công Danh 2025-08-08 22:01:16 +07:00
parent 906fc8034d
commit bafadc8930
4 changed files with 158 additions and 18 deletions

View file

@ -0,0 +1,64 @@
From c18ead2b0c4aa62af01450cb12353a0baa51411f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bernhard=20Rosenkr=C3=A4nzer?= <bero@lindev.ch>
Date: Wed, 27 Mar 2024 12:00:18 +0100
Subject: [PATCH] Fix build with boost 1.85.0
boost::filesystem::wpath has been deprecated (and typedef-ed to
boost::filesystem::path) for a long time; it is removed from boost
starting with 1.85.0-beta1.
Use boost::filesystem::path instead.
boost/filesystem/convenience.hpp has been removed (and was being
included without being used anyway - its only use was indirectly
pulling in boost/filesystem/directory.hpp, which is actually used).
Include boost/filesystem/directory.hpp directly instead.
---
src/core/store/MMapDirectory.cpp | 2 +-
src/core/util/FileUtils.cpp | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/core/store/MMapDirectory.cpp b/src/core/store/MMapDirectory.cpp
index beac7828..46156e3a 100644
--- a/src/core/store/MMapDirectory.cpp
+++ b/src/core/store/MMapDirectory.cpp
@@ -36,7 +36,7 @@ MMapIndexInput::MMapIndexInput(const String& path) {
bufferPosition = 0;
if (!path.empty()) {
try {
- file.open(boost::filesystem::wpath(path), _length);
+ file.open(boost::filesystem::path(path), _length);
} catch (...) {
boost::throw_exception(FileNotFoundException(path));
}
diff --git a/src/core/util/FileUtils.cpp b/src/core/util/FileUtils.cpp
index 51508b57..d92efbb8 100644
--- a/src/core/util/FileUtils.cpp
+++ b/src/core/util/FileUtils.cpp
@@ -5,9 +5,9 @@
/////////////////////////////////////////////////////////////////////////////
#include "LuceneInc.h"
-#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/operations.hpp>
#include <boost/filesystem/path.hpp>
+#include <boost/filesystem/directory.hpp>
#include "LuceneThread.h"
#include "StringUtils.h"
#include "FileUtils.h"
@@ -128,12 +128,12 @@ String joinPath(const String& path, const String& file) {
}
String extractPath(const String& path) {
- boost::filesystem::wpath parentPath(path.c_str());
+ boost::filesystem::path parentPath(path.c_str());
return parentPath.parent_path().wstring().c_str();
}
String extractFile(const String& path) {
- boost::filesystem::wpath fileName(path.c_str());
+ boost::filesystem::path fileName(path.c_str());
return fileName.filename().wstring().c_str();
}

View file

@ -0,0 +1,74 @@
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(-)
--- 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 @@ public:
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 @@ public:
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;
}
--- 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
}

View file

@ -0,0 +1,11 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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)
####################################

View file

@ -1,33 +1,24 @@
# Template file for 'Lucene++'
pkgname=Lucene++
version=3.0.7
revision=15
version=3.0.9
revision=1
build_style=cmake
configure_args="-Wno-dev"
makedepends="boost-devel gtest-devel"
makedepends="boost-devel-minimal libboost_filesystem libboost_iostreams
libboost_thread libboost_date_time gtest-devel zlib-devel"
short_desc="C++ port of the popular text search engine"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="LGPL-3.0-or-later, Apache-2.0"
homepage="https://github.com/luceneplusplus/LucenePlusPlus"
distfiles="https://github.com/luceneplusplus/LucenePlusPlus/archive/rel_${version}.tar.gz"
checksum=6c19f203311e4b44a0ccf7b1127db77436eb47159ea1c54f7531a0b1ca585e0c
checksum=4e69e29d5d79a976498ef71eab70c9c88c7014708be4450a9fda7780fe93584e
post_extract() {
sed -i 's/boost::get/boost::relaxed_get/' include/VariantUtils.h
post_patch() {
sed -i '/cmake_minimum_require/d' cmake/*.cmake
sed -i '/add_subdirectory.gtest/d' src/test/CMakeLists.txt
}
pre_configure() {
# Disable tests
echo > CMakeExternal.txt
rm -r src/test
sed -i \
-e "/find_package(Subversion REQUIRED)/d" \
-e "/enable_testing/d" \
-e "/add_subdirectory(src\/test)/d" \
CMakeLists.txt
}
post_install() {
xpost_install() {
# Install missing header files
vcopy "include/*" usr/include/lucene++
vcopy "build/include/*" usr/include/lucene++