From bc65f301885619966f5304149fcfb6f8887c05f3 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Mon, 22 Jul 2024 12:03:16 +0200 Subject: [PATCH] Add compilation option to not use Compactor::FULLER. For some unknown reason, xapian compiled on Windows/meson crash when we use this flag. Let's allow us to deactivate this flag until we fix the root bug. --- meson.build | 1 + meson_options.txt | 2 ++ src/config.h.in | 2 ++ src/writer/xapianIndexer.cpp | 7 ++++++- 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index b12b485b3..cf7e3c8fb 100644 --- a/meson.build +++ b/meson.build @@ -30,6 +30,7 @@ else private_conf.set('ENABLE_USE_MMAP', get_option('USE_MMAP')) endif private_conf.set('ENABLE_USE_BUFFER_HEADER', get_option('USE_BUFFER_HEADER')) +private_conf.set('ENABLE_XAPIAN_FULLER', get_option('with_xapian_fuller')) static_linkage = get_option('static-linkage') static_linkage = static_linkage or get_option('default_library')=='static' diff --git a/meson_options.txt b/meson_options.txt index 253c7739c..e23118f6e 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -22,5 +22,7 @@ option('tests', type : 'boolean', value : true, description : 'Build the tests.') option('with_xapian', type : 'boolean', value: true, description: 'Build libzim with xapian support') +option('with_xapian_fuller', type: 'boolean', value: true, + description: 'Create xapian archive using "FULLER" compaction.\nThis is a workaround for a compilation issue on Windows. This will be removed soon') option('test_data_dir', type : 'string', value: '', description: 'Where the test data are. If not set, meson will use a internal directory in the build dir. If you want to download the data in the specified directory you can use `meson download_test_data`. As a special value, you can pass `none` to deactivate test using external test data.') diff --git a/src/config.h.in b/src/config.h.in index b3018333c..35e3115eb 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -19,6 +19,8 @@ #mesondefine ENABLE_XAPIAN +#mesondefine ENABLE_XAPIAN_FULLER + #mesondefine ENABLE_USE_MMAP #mesondefine ENABLE_USE_BUFFER_HEADER diff --git a/src/writer/xapianIndexer.cpp b/src/writer/xapianIndexer.cpp index 322b4550c..f34924487 100644 --- a/src/writer/xapianIndexer.cpp +++ b/src/writer/xapianIndexer.cpp @@ -174,7 +174,12 @@ void XapianIndexer::indexTitle(const std::string& path, const std::string& title void XapianIndexer::indexingPostlude() { this->writableDatabase.commit(); - this->writableDatabase.compact(indexPath, Xapian::DBCOMPACT_SINGLE_FILE|Xapian::Compactor::FULLER); +#if defined ENABLE_XAPIAN_FULLER + auto flags = Xapian::DBCOMPACT_SINGLE_FILE|Xapian::Compactor::FULLER; +#else + auto flags = Xapian::DBCOMPACT_SINGLE_FILE; +#endif + this->writableDatabase.compact(indexPath, flags); this->writableDatabase.close(); }