From 82b2035d428a2b3b2f3f8129fac8dae915915bcd Mon Sep 17 00:00:00 2001 From: "Tom \"spot\" Callaway" Date: Sun, 2 Oct 2011 22:14:35 +0200 Subject: [PATCH] clucene2 support, untested --- sword-1.6.2-clucene2.patch | 125 +++++++++++++++++++++++++++++++++++++ sword.spec | 9 ++- 2 files changed, 132 insertions(+), 2 deletions(-) create mode 100644 sword-1.6.2-clucene2.patch diff --git a/sword-1.6.2-clucene2.patch b/sword-1.6.2-clucene2.patch new file mode 100644 index 0000000..f887f22 --- /dev/null +++ b/sword-1.6.2-clucene2.patch @@ -0,0 +1,125 @@ +diff -up sword-1.6.2/configure.clucene2 sword-1.6.2/configure +--- sword-1.6.2/configure.clucene2 2010-10-22 23:14:28.000000000 +0200 ++++ sword-1.6.2/configure 2011-10-02 21:27:35.420704861 +0200 +@@ -16348,9 +16348,9 @@ for flag in $with_clucene; do + if test -z "$clucene_set_failed"; then + if test -e "$flag/include/CLucene.h"; then + # 64-bit checks first +- if test -e "$flag/lib64/libclucene.la" || test -e "$flag/lib64/libclucene.so"; then ++ if test -e "$flag/lib64/libclucene-core.la" || test -e "$flag/lib64/libclucene-core.so"; then + clucene_set_failed=$flag +- CLUCENE_LIBS="-L$flag/lib64 -lclucene" ++ CLUCENE_LIBS="-L$flag/lib64 -lclucene-core" + if test -e "$flag/include/CLucene/clucene-config.h"; then + CLUCENE_CXXFLAGS="-I$flag/include" + else +@@ -16358,9 +16358,9 @@ for flag in $with_clucene; do + fi + else + # 32-bit checks +- if test -e "$flag/lib/libclucene.la" || test -e "$flag/lib/libclucene.so"; then ++ if test -e "$flag/lib/libclucene-core.la" || test -e "$flag/lib/libclucene-core.so"; then + clucene_set_failed=$flag +- CLUCENE_LIBS="-L$flag/lib -lclucene" ++ CLUCENE_LIBS="-L$flag/lib -lclucene-core" + if test -e "$flag/include/CLucene/clucene-config.h"; then + CLUCENE_CXXFLAGS="-I$flag/include" + else +diff -up sword-1.6.2/m4/acx_clucene.m4.clucene2 sword-1.6.2/m4/acx_clucene.m4 +--- sword-1.6.2/m4/acx_clucene.m4.clucene2 2007-05-19 23:28:23.000000000 +0200 ++++ sword-1.6.2/m4/acx_clucene.m4 2011-10-02 21:27:35.420704861 +0200 +@@ -29,9 +29,9 @@ for flag in $with_clucene; do + if test -z "$clucene_set_failed"; then + if test -e "$flag/include/CLucene.h"; then + # 64-bit checks first +- if test -e "$flag/lib64/libclucene.la" || test -e "$flag/lib64/libclucene.so"; then ++ if test -e "$flag/lib64/libclucene-core.la" || test -e "$flag/lib64/libclucene-core.so"; then + clucene_set_failed=$flag +- CLUCENE_LIBS="-L$flag/lib64 -lclucene" ++ CLUCENE_LIBS="-L$flag/lib64 -lclucene-core" + if test -e "$flag/include/CLucene/clucene-config.h"; then + CLUCENE_CXXFLAGS="-I$flag/include" + else +@@ -39,9 +39,9 @@ for flag in $with_clucene; do + fi + else + # 32-bit checks +- if test -e "$flag/lib/libclucene.la" || test -e "$flag/lib/libclucene.so"; then ++ if test -e "$flag/lib/libclucene-core.la" || test -e "$flag/lib/libclucene-core.so"; then + clucene_set_failed=$flag +- CLUCENE_LIBS="-L$flag/lib -lclucene" ++ CLUCENE_LIBS="-L$flag/lib -lclucene-core" + if test -e "$flag/include/CLucene/clucene-config.h"; then + CLUCENE_CXXFLAGS="-I$flag/include" + else +diff -up sword-1.6.2/src/modules/swmodule.cpp.clucene2 sword-1.6.2/src/modules/swmodule.cpp +--- sword-1.6.2/src/modules/swmodule.cpp.clucene2 2011-10-02 21:32:40.825795281 +0200 ++++ sword-1.6.2/src/modules/swmodule.cpp 2011-10-02 22:02:42.441506634 +0200 +@@ -40,7 +40,7 @@ + + #ifdef USELUCENE + #include +-#include ++//#include + + //Lucence includes + //#include "CLucene.h" +@@ -59,6 +59,9 @@ using namespace lucene::search; + + using std::vector; + ++extern size_t lucene_utf8towcs(wchar_t *, const char *, size_t maxslen); ++extern size_t lucene_wcstoutf8 (char *, const wchar_t *, size_t maxslen); ++ + SWORD_NAMESPACE_START + + SWDisplay SWModule::rawdisp; +@@ -1144,7 +1147,7 @@ signed char SWModule::createSearchFramew + + lucene_utf8towcs(wcharBuffer, keyText, MAX_CONV_SIZE); //keyText must be utf8 + // doc->add( *(new Field("key", wcharBuffer, Field::STORE_YES | Field::INDEX_TOKENIZED))); +- doc->add( *Field::Text(_T("key"), wcharBuffer ) ); ++ doc->add(*_CLNEW Field(_T("key"), wcharBuffer, Field::STORE_YES | Field::INDEX_TOKENIZED) ); + + + if (includeKeyInSearch) { +@@ -1155,11 +1158,11 @@ signed char SWModule::createSearchFramew + } + + lucene_utf8towcs(wcharBuffer, content, MAX_CONV_SIZE); //content must be utf8 +- doc->add( *Field::UnStored(_T("content"), wcharBuffer) ); ++ doc->add(*_CLNEW Field(_T("content"), wcharBuffer, Field::STORE_NO | Field::INDEX_TOKENIZED)); + + if (strong.length() > 0) { + lucene_utf8towcs(wcharBuffer, strong, MAX_CONV_SIZE); +- doc->add( *Field::UnStored(_T("lemma"), wcharBuffer) ); ++ doc->add(*_CLNEW Field(_T("lemma"), wcharBuffer, Field::STORE_NO | Field::INDEX_TOKENIZED) ); + //printf("setting fields (%s).\ncontent: %s\nlemma: %s\n", (const char *)*key, content, strong.c_str()); + } + +@@ -1280,12 +1283,12 @@ signed char SWModule::createSearchFramew + + //printf("proxBuf after (%s).\nprox: %s\nproxLem: %s\n", (const char *)*key, proxBuf.c_str(), proxLem.c_str()); + +- doc->add( *Field::UnStored(_T("prox"), wcharBuffer) ); ++ doc->add(*_CLNEW Field(_T("prox"), wcharBuffer, Field::STORE_NO | Field::INDEX_TOKENIZED) ); + good = true; + } + if (proxLem.length() > 0) { + lucene_utf8towcs(wcharBuffer, proxLem, MAX_CONV_SIZE); //keyText must be utf8 +- doc->add( *Field::UnStored(_T("proxlem"), wcharBuffer) ); ++ doc->add(*_CLNEW Field(_T("proxlem"), wcharBuffer, Field::STORE_NO | Field::INDEX_TOKENIZED) ); + good = true; + } + if (good) { +@@ -1315,7 +1318,9 @@ signed char SWModule::createSearchFramew + fsWriter = new IndexWriter(d, an, true); + } + +- Directory *dirs[] = { ramDir, 0 }; ++ ValueArray dirs(2); ++ dirs[0] = ramDir; ++ dirs[1] = 0; + fsWriter->addIndexes(dirs); + fsWriter->close(); + diff --git a/sword.spec b/sword.spec index 918417f..f372032 100644 --- a/sword.spec +++ b/sword.spec @@ -1,6 +1,6 @@ Name: sword Version: 1.6.2 -Release: 4%{?dist} +Release: 5%{?dist} Summary: Free Bible Software Project Group: System Environment/Libraries @@ -17,6 +17,7 @@ BuildRequires: clucene-core-devel BuildRequires: cppunit-devel Patch0: sword-no-curl-types.patch +Patch1: sword-1.6.2-clucene2.patch %description The SWORD Project is the CrossWire Bible Society's free Bible software @@ -43,9 +44,10 @@ that uses the sword API, such as Gnomesword or Bibletime. %prep %setup -q %patch0 -p1 -b .no-curl-types +%patch1 -p1 -b .clucene2 %build -%configure --disable-static --with-icu --with-lucene +%configure --disable-static --with-icu --with-clucene=%{_prefix} sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool make %{?_smp_mflags} @@ -85,6 +87,9 @@ rm -rf %{buildroot} %{_libdir}/libsword.so %changelog +* Sun Oct 2 2011 Tom Callaway - 1.6.2-5 +- fix compile against clucene2 + * Fri Sep 09 2011 Caolán McNamara - 1.6.2-4 - rebuild for icu 4.8.1