Skip to content

Commit 4f1f4a5

Browse files
knyipablicy183
authored andcommitted
new package: clucene
1 parent ffea5c1 commit 4f1f4a5

10 files changed

+319
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
diff -NaurpBb clucene-core-2.3.3.4/CMakeLists.txt clucene-core-2.3.3.4-mod/CMakeLists.txt
2+
--- clucene-core-2.3.3.4/CMakeLists.txt 2011-03-17 03:21:07.000000000 +0300
3+
+++ clucene-core-2.3.3.4-mod/CMakeLists.txt 2011-08-16 16:56:55.968268152 +0400
4+
@@ -163,7 +163,7 @@ IF ( BUILD_CONTRIBS )
5+
SET(BUILD_CONTRIBS_LIB 1)
6+
ENDIF ( BUILD_CONTRIBS )
7+
IF ( BUILD_CONTRIBS_LIB )
8+
- ADD_SUBDIRECTORY (src/contribs-lib EXCLUDE_FROM_ALL)
9+
+ ADD_SUBDIRECTORY (src/contribs-lib)
10+
ENDIF ( BUILD_CONTRIBS_LIB )
11+
12+
13+
diff -NaurpBb clucene-core-2.3.3.4/src/contribs-lib/CMakeLists.txt clucene-core-2.3.3.4-mod/src/contribs-lib/CMakeLists.txt
14+
--- clucene-core-2.3.3.4/src/contribs-lib/CMakeLists.txt 2011-03-17 03:21:07.000000000 +0300
15+
+++ clucene-core-2.3.3.4-mod/src/contribs-lib/CMakeLists.txt 2011-08-16 17:14:13.499275499 +0400
16+
@@ -106,9 +106,26 @@ add_library(clucene-contribs-lib SHARED
17+
)
18+
TARGET_LINK_LIBRARIES(clucene-contribs-lib ${clucene_contrib_extra_libs})
19+
20+
+#install public headers.
21+
+FOREACH(file ${HEADERS})
22+
+ get_filename_component(apath ${file} PATH)
23+
+ get_filename_component(aname ${file} NAME)
24+
+ file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/contribs-lib ${apath})
25+
+ IF ( NOT aname MATCHES "^_.*" )
26+
+ install(FILES ${file}
27+
+ DESTINATION include/${relpath}
28+
+ COMPONENT development)
29+
+ ENDIF ( NOT aname MATCHES "^_.*" )
30+
+ENDFOREACH(file)
31+
+
32+
#set properties on the libraries
33+
SET_TARGET_PROPERTIES(clucene-contribs-lib PROPERTIES
34+
VERSION ${CLUCENE_VERSION}
35+
SOVERSION ${CLUCENE_SOVERSION}
36+
COMPILE_DEFINITIONS_DEBUG _DEBUG
37+
)
38+
+
39+
+#and install library
40+
+install(TARGETS clucene-contribs-lib
41+
+ DESTINATION ${LIB_DESTINATION}
42+
+ COMPONENT runtime )
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
diff -up clucene-core-2.3.3.4/src/core/libclucene-core.pc.cmake.pkgconfig_sys_includes clucene-core-2.3.3.4/src/core/libclucene-core.pc.cmake
2+
--- clucene-core-2.3.3.4/src/core/libclucene-core.pc.cmake.pkgconfig_sys_includes 2011-03-16 19:21:07.000000000 -0500
3+
+++ clucene-core-2.3.3.4/src/core/libclucene-core.pc.cmake 2012-03-19 09:01:00.689263954 -0500
4+
@@ -6,6 +6,6 @@ includedir=${prefix}/include:${prefix}/i
5+
Name: libclucene
6+
Description: CLucene - a C++ search engine, ported from the popular Apache Lucene
7+
Version: @CLUCENE_VERSION_MAJOR@.@CLUCENE_VERSION_MINOR@.@CLUCENE_VERSION_REVISION@.@CLUCENE_VERSION_PATCH@
8+
-Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core
9+
-Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext
10+
+Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core -lclucene-shared
11+
+Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext -I@LUCENE_SYS_INCLUDES@
12+
~
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
From: Veit Jahns <[email protected]>
2+
Date: Thu, 26 May 2011 11:35:28 +0000 (+0200)
3+
Subject: Fixing ZLIB configuration in shared's CMakeLists
4+
X-Git-Url: http://clucene.git.sourceforge.net/git/gitweb.cgi?p=clucene%2Fclucene;a=commitdiff_plain;h=772481ca94071ddfe65102a451926e4f9aeb4d2c;hp=a834f87bad3543b2a0331cef7202c15ded4245be
5+
6+
Fixing ZLIB configuration in shared's CMakeLists
7+
---
8+
9+
diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt
10+
index 68314a7..3d1975e 100644
11+
--- a/src/shared/CMakeLists.txt
12+
+++ b/src/shared/CMakeLists.txt
13+
@@ -42,7 +42,7 @@ INCLUDE (CheckAtomicFunctions)
14+
find_package(ZLIB)
15+
IF ( ZLIB_FOUND )
16+
SET ( EXTRA_LIBS ${EXTRA_LIBS} ${ZLIB_LIBRARY} )
17+
-ELSEIF ( ZLIB_FOUND )
18+
+ELSE ( ZLIB_FOUND )
19+
MESSAGE( "ZLIB not found, using local: ${clucene-ext_SOURCE_DIR}/zlib" )
20+
SET(ZLIB_INCLUDE_DIR ${clucene-ext_SOURCE_DIR}/zlib )
21+
SET(ZLIB_LIBRARY ${clucene-ext_BINARY_DIR})
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
From c1c2000c35ff39b09cb70fbdf66a107d3b17a674 Mon Sep 17 00:00:00 2001
2+
From: Stephan Bergmann <[email protected]>
3+
Date: Wed, 12 Oct 2022 08:40:49 +0200
4+
Subject: [PATCH] Fix missing #include <time.h>
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
At least on recent Fedora 37 beta, building now failed with
10+
11+
> CLucene/document/DateTools.cpp:26:19: error: ‘gmtime’ was not declared in this scope
12+
> 26 | tm *ptm = gmtime(&secs);
13+
> | ^~~~~~
14+
15+
etc.
16+
17+
As it turns out, after 22f9d40320e3deeaa8d6aaa7a770077c20a21dae "git-svn-id:
18+
https://clucene.svn.sourceforge.net/svnroot/clucene/branches/lucene2_3_2@2672
19+
20ef185c-fe11-0410-a618-ba9304b01011" on 2008-06-26 had commented out
20+
_CL_TIME_WITH_SYS_TIME in clucene-config.h.cmake as "not actually used for
21+
anything", then cceccfb52917b5f4da447f1cf20c135952d41442 "Presenting DateTools
22+
and deprecating DateField. DateTools still requires some testing and its own
23+
unit testing" on 2008-06-29 had introduced this use of it (into then
24+
src/CLucene/document/DateTools.H). And apparently most build environments have
25+
silently been happy ever since when the dead leading check for
26+
_CL_TIME_WITH_SYS_TIME didn't include both <sys/time.h> and <time.h>, but the
27+
following check for _CL_HAVE_SYS_TIME_H only included <sys/time.h> but not
28+
<time.h>.
29+
---
30+
src/shared/CLucene/clucene-config.h.cmake | 3 +--
31+
1 file changed, 1 insertion(+), 2 deletions(-)
32+
33+
diff --git a/src/shared/CLucene/clucene-config.h.cmake b/src/shared/CLucene/clucene-config.h.cmake
34+
index bd8683a5..6fe0f92b 100644
35+
--- a/src/shared/CLucene/clucene-config.h.cmake
36+
+++ b/src/shared/CLucene/clucene-config.h.cmake
37+
@@ -100,8 +100,7 @@ ${SYMBOL__T}
38+
//#cmakedefine _CL_STAT_MACROS_BROKEN
39+
40+
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
41+
-//not actually used for anything...
42+
-//#cmakedefine _CL_TIME_WITH_SYS_TIME 1
43+
+#cmakedefine _CL_TIME_WITH_SYS_TIME 1
44+
45+
/* Define that we will be using -fvisibility=hidden, and
46+
* make public classes visible using __attribute__ ((visibility("default")))
47+
--
48+
2.37.3
49+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
--- a/src/core/CLucene/util/VoidMap.h
2+
+++ b/src/core/CLucene/util/VoidMap.h
3+
@@ -316,6 +316,7 @@ public:
4+
if ( _this::dk || _this::dv )
5+
_this::remove(k);
6+
7+
+ (*this)[k] = v;
8+
}
9+
};
10+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
--- a/src/core/CLucene/queryParser/QueryParser.cpp.sav 2011-03-17 01:21:07.000000000 +0100
2+
+++ b/src/core/CLucene/queryParser/QueryParser.cpp 2012-03-09 18:20:58.000000000 +0100
3+
@@ -79,7 +79,7 @@
4+
_T("<RANGEEX_GOOP>")
5+
};
6+
7+
-const int32_t QueryParser::jj_la1_0[] = {0x180,0x180,0xe00,0xe00,0x1f69f80,0x48000,0x10000,0x1f69000,0x1348000,0x80000,0x80000,0x10000,0x18000000,0x2000000,0x18000000,0x10000,0x80000000,0x20000000,0x80000000,0x10000,0x80000,0x10000,0x1f68000};
8+
+const int32_t QueryParser::jj_la1_0[] = {0x180,0x180,0xe00,0xe00,0x1f69f80,0x48000,0x10000,0x1f69000,0x1348000,0x80000,0x80000,0x10000,0x18000000,0x2000000,0x18000000,0x10000,int32_t(0x80000000),0x20000000,int32_t(0x80000000),0x10000,0x80000,0x10000,0x1f68000};
9+
const int32_t QueryParser::jj_la1_1[] = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x1,0x0,0x0,0x0,0x0};
10+
11+
struct QueryParser::JJCalls {
12+
--- a/src/core/CLucene/queryParser/QueryParserTokenManager.cpp.sav 2011-03-17 01:21:07.000000000 +0100
13+
+++ b/src/core/CLucene/queryParser/QueryParserTokenManager.cpp 2012-03-09 18:20:24.000000000 +0100
14+
@@ -15,9 +15,9 @@
15+
16+
CL_NS_DEF(queryParser)
17+
18+
-const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff)};
19+
+const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff))};
20+
const int64_t QueryParserTokenManager::jjbitVec0[] = {
21+
- _ILONGLONG(0xfffffffffffffffe), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff)
22+
+ int64_t(_ILONGLONG(0xfffffffffffffffe)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff))
23+
};
24+
const int32_t QueryParserTokenManager::jjnextStates[]={
25+
15, 17, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27,
26+
--- a/src/core/CLucene/queryParser/legacy/Lexer.cpp
27+
+++ b/src/core/CLucene/queryParser/legacy/Lexer.cpp
28+
@@ -117,7 +117,7 @@
29+
if( _istspace(ch)!=0 ) {
30+
continue;
31+
}
32+
- TCHAR buf[2] = {ch,'\0'};
33+
+ TCHAR buf[2] = {static_cast<TCHAR>(ch),'\0'};
34+
switch(ch) {
35+
case '+':
36+
token->set(buf, QueryToken::PLUS);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--- a/src/core/CLucene/index/TermInfosReader.cpp
2+
+++ b/src/core/CLucene/index/TermInfosReader.cpp
3+
@@ -111,7 +111,7 @@
4+
//destroy their elements
5+
#ifdef _DEBUG
6+
for ( int32_t i=0; i<indexTermsLength;++i ){
7+
- indexTerms[i].__cl_refcount--;
8+
+ indexTerms[i].__cl_decref();
9+
}
10+
#endif
11+
//Delete the arrays
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
--- a/src/shared/cmake/CheckAtomicFunctions.cmake
2+
+++ b/src/shared/cmake/CheckAtomicFunctions.cmake
3+
@@ -1,9 +1,9 @@
4+
-INCLUDE(CheckCXXSourceRuns)
5+
+INCLUDE(CheckCXXSourceCompiles)
6+
7+
MACRO ( CHECK_HAVE_GCC_ATOMIC_FUNCTIONS result )
8+
9+
# Do step by step checking,
10+
-CHECK_CXX_SOURCE_RUNS("
11+
+CHECK_CXX_SOURCE_COMPILES("
12+
#include <cstdlib>
13+
int main()
14+
{
15+
--- a/src/shared/cmake/CheckErrorHandling.cmake
16+
+++ b/src/shared/cmake/CheckErrorHandling.cmake
17+
@@ -1,9 +1,10 @@
18+
#check if we can do try and catch.
19+
#bit useless, since we don't have any alternatives to try and catch currently
20+
+INCLUDE(CheckCXXSourceCompiles)
21+
22+
MACRO ( CHECK_HAVE_FUNCTION_TRY_BLOCKS result )
23+
#check for try/catch blocks
24+
- CHECK_CXX_SOURCE_RUNS("
25+
+ CHECK_CXX_SOURCE_COMPILES("
26+
void foo() { try{ return; } catch( ... ){} }
27+
int main(){ foo(); return 0; }" ${result})
28+
IF ( NOT ${result} )
29+
--- a/src/shared/cmake/CheckNamespace.cmake
30+
+++ b/src/shared/cmake/CheckNamespace.cmake
31+
@@ -1,7 +1,9 @@
32+
+INCLUDE(CheckCXXSourceCompiles)
33+
+
34+
#check if we support namespaces
35+
MACRO ( CHECK_NAMESPACE haveNamespace )
36+
#Check if namespaces work in the compiler
37+
- CHECK_CXX_SOURCE_RUNS("
38+
+ CHECK_CXX_SOURCE_COMPILES("
39+
namespace Outer { namespace Inner { int i = 0; }}
40+
int main(){ using namespace Outer::Inner; return i; }"
41+
${haveNamespace} )
42+
--- a/src/shared/cmake/CheckPthread.cmake
43+
+++ b/src/shared/cmake/CheckPthread.cmake
44+
@@ -5,6 +5,7 @@
45+
IF ( ${ifpthread} )
46+
SET ( CMAKE_REQUIRED_FLAGS "${CMAKE_THREAD_LIBS_INIT}")
47+
48+
+ IF (NOT CMAKE_CROSSCOMPILING)
49+
CHECK_CXX_SOURCE_RUNS("
50+
#include <sys/types.h>
51+
#include <pthread.h>
52+
@@ -20,7 +21,9 @@
53+
}
54+
" ${result} )
55+
#NOTE: pthread_mutexattr_setkind_np is the deprecated name for pthread_mutexattr_settype. old compilers might need it
56+
-
57+
+ ELSE()
58+
+ SET (result 0)
59+
+ ENDIF()
60+
61+
SET ( CMAKE_REQUIRED_FLAGS)
62+
ENDIF ( ${ifpthread} )
63+
--- a/src/shared/cmake/CheckSnprintf.cmake
64+
+++ b/src/shared/cmake/CheckSnprintf.cmake
65+
@@ -1,6 +1,7 @@
66+
#checks if snprintf have bugs
67+
68+
MACRO ( CHECK_SNPRINTF )
69+
+ IF (NOT CMAKE_CROSSCOMPILING)
70+
#check that our snprintf works correctly...
71+
IF ( _CL_HAVE_FUNCTION_SNPRINTF )
72+
CHECK_CXX_SOURCE_RUNS("
73+
@@ -39,4 +40,5 @@
74+
SET ( _CL_HAVE_SNWPRINTF_BUG 1 )
75+
ENDIF ( NOT _CL_HAVE_NO_SNWPRINTF_BUG )
76+
ENDIF ( _CL_HAVE_FUNCTION_SNWPRINTF )
77+
+ ENDIF()
78+
ENDMACRO ( CHECK_SNPRINTF )
79+
--- a/src/shared/cmake/DefineStaticSyntax.cmake
80+
+++ b/src/shared/cmake/DefineStaticSyntax.cmake
81+
@@ -2,8 +2,12 @@
82+
83+
MACRO ( DEFINE_STATIC_SYNTAX )
84+
85+
+ IF (NOT CMAKE_CROSSCOMPILING)
86+
#check which syntax of static const to use
87+
CHECK_CXX_SOURCE_RUNS("class x{public: static const int SCI=55; }; int main(){ x a; if ( a.SCI!=55 ) throw \"err\"; return 0; }" LUCENE_STATIC_CONSTANT_SYNTAX)
88+
+ ELSE()
89+
+ SET (LUCENE_STATIC_CONSTANT_SYNTAX 0)
90+
+ ENDIF()
91+
IF ( LUCENE_STATIC_CONSTANT_SYNTAX )
92+
SET ( LUCENE_STATIC_CONSTANT_SYNTAX "static const type assignment")
93+
ELSE ( LUCENE_STATIC_CONSTANT_SYNTAX )

tur/clucene/0009-pthread_t.patch

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
`pthread_t` is an alias of `long` in bionic.
2+
3+
--- a/src/shared/CLucene/util/Misc.cpp
4+
+++ b/src/shared/CLucene/util/Misc.cpp
5+
@@ -466,6 +466,7 @@
6+
std::string Misc::toString(const bool value){
7+
return value ? "true" : "false";
8+
}
9+
+#if !defined(__ANDROID__) || !defined(__LP64__)
10+
std::string Misc::toString(_LUCENE_THREADID_TYPE value){
11+
static int32_t nextindex = 0;
12+
static std::map<_LUCENE_THREADID_TYPE, int32_t> ids;
13+
@@ -474,6 +475,7 @@
14+
}
15+
return toString(ids[value]);
16+
}
17+
+#endif
18+
std::string Misc::toString(const int32_t value){
19+
char buf[20];
20+
TCHAR tbuf[20];
21+
--- a/src/shared/CLucene/util/Misc.h
22+
+++ b/src/shared/CLucene/util/Misc.h
23+
@@ -67,7 +67,9 @@
24+
25+
static std::string toString(const int32_t value);
26+
static std::string toString(const int64_t value);
27+
+#if !defined(__ANDROID__) || !defined(__LP64__)
28+
static std::string toString(const _LUCENE_THREADID_TYPE value);
29+
+#endif
30+
static std::string toString(const bool value);
31+
static std::string toString(const float_t value);
32+
static std::string toString(const TCHAR* s, int32_t len=-1);

tur/clucene/build.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
TERMUX_PKG_HOMEPAGE="http://clucene.sourceforge.net/"
2+
TERMUX_PKG_DESCRIPTION="C++ port of the high-performance text search engine Lucene"
3+
TERMUX_PKG_LICENSE="Apache-2.0, LGPL-2.0"
4+
TERMUX_PKG_MAINTAINER="@termux-user-repository"
5+
TERMUX_PKG_VERSION=2.3.3.4
6+
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/clucene/clucene-core-${TERMUX_PKG_VERSION}.tar.gz
7+
TERMUX_PKG_SHA256=ddfdc433dd8ad31b5c5819cc4404a8d2127472a3b720d3e744e8c51d79732eab
8+
TERMUX_PKG_DEPENDS="boost, zlib"
9+
TERMUX_PKG_BUILD_DEPENDS="boost-headers"
10+
11+
termux_step_pre_configure() {
12+
CXXFLAGS+=" -std=c++11"
13+
}

0 commit comments

Comments
 (0)