[bibletime] Add patch so it builds again CLucene 2.0+

Rex Dieter rdieter at fedoraproject.org
Wed Oct 19 13:53:20 UTC 2011


commit 1a13310207a7c036b2ddc10eeaeec274299193ee
Author: Rex Dieter <rdieter at fedoraproject.org>
Date:   Wed Oct 19 08:53:19 2011 -0500

    Add patch so it builds again CLucene 2.0+

 bibletime-clucene2.patch |   92 ++++++++++++++++++++++++++++++++++++++++++++++
 bibletime.spec           |   10 +++-
 2 files changed, 99 insertions(+), 3 deletions(-)
---
diff --git a/bibletime-clucene2.patch b/bibletime-clucene2.patch
new file mode 100644
index 0000000..deabab0
--- /dev/null
+++ b/bibletime-clucene2.patch
@@ -0,0 +1,92 @@
+diff -urb bibletime-2.8.1/cmake/FindCLucene.cmake bibletime-2.8.1b/cmake/FindCLucene.cmake
+--- bibletime-2.8.1/cmake/FindCLucene.cmake	2011-01-22 04:11:11.000000000 -0800
++++ bibletime-2.8.1b/cmake/FindCLucene.cmake	2011-10-18 09:34:33.018912674 -0700
+@@ -95,6 +95,18 @@
+         MESSAGE(ERROR "CLucene version 0.9.17 is not supported.")
+             SET(CLUCENE_GOOD_VERSION FALSE)
+     ENDIF (CLUCENE_VERSION STREQUAL "0.9.17")
++    IF (CLUCENE_VERSION STRGREATER "2.0.0")
++        FIND_LIBRARY_WITH_DEBUG(CLUCENE_SHARED_LIB
++            NAMES clucene-shared
++            PATHS ${TRIAL_LIBRARY_PATHS})
++
++        IF (CLUCENE_SHARED_LIB)
++            MESSAGE(STATUS "Found CLucene shared library: ${CLUCENE_SHARED_LIB}")
++        ELSE (CLUCENE_SHARED_LIB)
++            MESSAGE(FATAL_ERROR "Unable to find CLucene shared library.")
++            SET(CLUCENE_GOOD_VERSION FALSE)
++        ENDIF(CLUCENE_SHARED_LIB)
++    ENDIF (CLUCENE_VERSION STRGREATER "2.0.0")
+     ENDIF (CLMATCH)
+ ELSE (CLUCENE_LIBRARY_DIR)
+     MESSAGE(STATUS "CLucene library dir not found.")
+diff -urb bibletime-2.8.1/CMakeLists.txt bibletime-2.8.1b/CMakeLists.txt
+--- bibletime-2.8.1/CMakeLists.txt	2011-01-22 04:11:11.000000000 -0800
++++ bibletime-2.8.1b/CMakeLists.txt	2011-10-18 09:33:32.684505476 -0700
+@@ -147,6 +147,7 @@
+     TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME}
+         ${QT_LIBRARIES}
+         ${CLUCENE_LIBRARY}
++        ${CLUCENE_SHARED_LIB}
+         ${CURL_LIBRARIES} # optional, empty if not found
+         ${ICU_LIBRARIES} # optional, empty if not found
+         ${ICU_I18N_LIBRARIES} # optional, empty if not found
+@@ -163,6 +164,7 @@
+     TARGET_LINK_LIBRARIES(${EXECUTABLE_NAME}
+         ${QT_LIBRARIES}
+         ${CLUCENE_LIBRARY}
++        ${CLUCENE_SHARED_LIB}
+         ${CURL_LIBRARIES} # optional, empty if not found
+         ${ICU_LIBRARIES} # optional, empty if not found
+         ${ICU_I18N_LIBRARIES} # optional, empty if not found
+diff -urb bibletime-2.8.1/src/backend/drivers/cswordmoduleinfo.cpp bibletime-2.8.1b/src/backend/drivers/cswordmoduleinfo.cpp
+--- bibletime-2.8.1/src/backend/drivers/cswordmoduleinfo.cpp	2011-01-22 04:11:11.000000000 -0800
++++ bibletime-2.8.1b/src/backend/drivers/cswordmoduleinfo.cpp	2011-10-18 09:22:24.541080927 -0700
+@@ -11,8 +11,6 @@
+ 
+ #include <QSharedPointer>
+ #include <CLucene.h>
+-#include <CLucene/util/Misc.h>
+-#include <CLucene/util/Reader.h>
+ #include <QByteArray>
+ #include <QCoreApplication>
+ #include <QDebug>
+@@ -260,7 +258,6 @@
+         QSharedPointer<lucene::index::IndexWriter> writer( new lucene::index::IndexWriter(index.toAscii().constData(), &an, true) ); //always create a new index
+         writer->setMaxFieldLength(BT_MAX_LUCENE_FIELD_LENGTH);
+         writer->setUseCompoundFile(true); //merge segments into a single file
+-        writer->setMinMergeDocs(1000);
+ 
+         m_module->setPosition(sword::TOP);
+         unsigned long verseLowIndex = m_module->Index();
+@@ -455,7 +452,7 @@
+         lucene_utf8towcs(wcharBuffer, searchedText.toUtf8().constData(), BT_MAX_LUCENE_FIELD_LENGTH);
+         QSharedPointer<lucene::search::Query> q( lucene::queryParser::QueryParser::parse((const TCHAR*)wcharBuffer, (const TCHAR*)_T("content"), &analyzer) );
+ 
+-        QSharedPointer<lucene::search::Hits> h( searcher.search(q.data(), lucene::search::Sort::INDEXORDER) );
++        QSharedPointer<lucene::search::Hits> h( searcher.search(q.data(), lucene::search::Sort::INDEXORDER()) );
+ 
+         /// \warning This is a workaround for Sword constness
+         const bool useScope = (const_cast<sword::ListKey&>(scope).Count() > 0);
+@@ -465,7 +462,7 @@
+         QSharedPointer<sword::SWKey> swKey( module()->CreateKey() );
+ 
+ 
+-        for (int i = 0; i < h->length(); ++i) {
++        for (unsigned int i = 0; i < h->length(); ++i) {
+             doc = &h->doc(i);
+             lucene_wcstoutf8(utfBuffer, (const wchar_t*)doc->get((const TCHAR*)_T("key")), BT_MAX_LUCENE_FIELD_LENGTH);
+ 
+diff -urb bibletime-2.8.1/src/backend/drivers/cswordmoduleinfo.h bibletime-2.8.1b/src/backend/drivers/cswordmoduleinfo.h
+--- bibletime-2.8.1/src/backend/drivers/cswordmoduleinfo.h	2011-01-22 04:11:11.000000000 -0800
++++ bibletime-2.8.1b/src/backend/drivers/cswordmoduleinfo.h	2011-10-18 09:19:58.790491225 -0700
+@@ -23,6 +23,9 @@
+ #include <swsearchable.h>
+ #include <swversion.h>
+ 
++// CLucene no longer lists the following functions in its headers
++extern size_t lucene_utf8towcs(wchar_t *, const char *,  size_t maxslen);
++extern size_t lucene_wcstoutf8 (char *,  const wchar_t *, size_t maxslen);
+ 
+ class CSwordBackend;
+ class CSwordKey;
diff --git a/bibletime.spec b/bibletime.spec
index b40c979..acaaabe 100644
--- a/bibletime.spec
+++ b/bibletime.spec
@@ -1,14 +1,15 @@
 Summary:	An easy to use Bible study tool
 Name:		bibletime
 Version:	2.8.1
-Release:	1%{?dist}
+Release:	2%{?dist}
 License:	GPLv2
 Url:		http://www.bibletime.info/
 Group:		Applications/Productivity
 Source0:	http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.bz2
+Patch0:         bibletime-clucene2.patch
 BuildRoot:	%{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:	cmake qt4-webkit-devel
-BuildRequires:	sword-devel >= 1.5.10 clucene-core-devel >= 0.9.16a
+BuildRequires:	sword-devel >= 1.5.10 clucene-core-devel >= 2.0
 BuildRequires:	boost-devel openssl-devel curl-devel zlib-devel dbus-devel
 BuildRequires:	desktop-file-utils gettext
 
@@ -21,8 +22,8 @@ texts (search in texts, write own notes, save, print etc.).
 BibleTime is a frontend for the  SWORD Bible Framework.
 
 %prep
-
 %setup -q
+%patch0 -p1
 
 %build
 mkdir fedora
@@ -82,6 +83,9 @@ done
 %doc ChangeLog README LICENSE
 
 %changelog
+* Mon Oct 17 2011 Jonathan Dieter <jdieter at lesbg.com> - 2.8.1-2
+- Add patch so it builds again CLucene 2.0+
+
 * Thu Jun 02 2011 Deji Akingunola <dakingun at gmail.com> - 2.8.1-1
 - Update to 2.8.1
 


More information about the scm-commits mailing list