Skip to content

Commit b21d7ad

Browse files
knyipablicy183
authored andcommitted
clucene: patch to enable c++17
1 parent 2047554 commit b21d7ad

File tree

2 files changed

+148
-5
lines changed

2 files changed

+148
-5
lines changed
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
Replace std::binary_function with typedefs (deprecated in c++11 and removed in c++17).
2+
Bug: https://bugs.gentoo.org/869170
3+
--- a/src/core/CLucene/index/_Term.h
4+
+++ b/src/core/CLucene/index/_Term.h
5+
@@ -13,9 +13,12 @@
6+
CL_NS_DEF(index)
7+
8+
9+
-class Term_Equals:public CL_NS_STD(binary_function)<const Term*,const Term*,bool>
10+
+class Term_Equals
11+
{
12+
public:
13+
+ using first_argument_type = const Term*;
14+
+ using second_argument_type = const Term*;
15+
+ using result_type = bool;
16+
bool operator()( const Term* val1, const Term* val2 ) const{
17+
return val1->equals(val2);
18+
}
19+
--- a/src/core/CLucene/search/BooleanQuery.cpp
20+
+++ b/src/core/CLucene/search/BooleanQuery.cpp
21+
@@ -25,9 +25,12 @@ CL_NS_USE(index)
22+
CL_NS_USE(util)
23+
CL_NS_DEF(search)
24+
25+
- class BooleanClause_Compare:public CL_NS_STD(binary_function)<const BooleanClause*,const BooleanClause*,bool>
26+
+ class BooleanClause_Compare
27+
{
28+
public:
29+
+ using first_argument_type = const BooleanClause*;
30+
+ using second_argument_type = const BooleanClause*;
31+
+ using result_type = bool;
32+
bool operator()( const BooleanClause* val1, const BooleanClause* val2 ) const {
33+
return val1->equals(val2);
34+
}
35+
--- a/src/core/CLucene/search/MultiPhraseQuery.cpp
36+
+++ b/src/core/CLucene/search/MultiPhraseQuery.cpp
37+
@@ -377,9 +377,12 @@ TCHAR* MultiPhraseQuery::toString(const TCHAR* f) const {
38+
return buffer.giveBuffer();
39+
}
40+
41+
-class TermArray_Equals:public CL_NS_STD(binary_function)<const Term**,const Term**,bool>
42+
+class TermArray_Equals
43+
{
44+
public:
45+
+ using first_argument_type = const Term**;
46+
+ using second_argument_type = const Term**;
47+
+ using result_type = bool;
48+
bool operator()( CL_NS(util)::ArrayBase<CL_NS(index)::Term*>* val1, CL_NS(util)::ArrayBase<CL_NS(index)::Term*>* val2 ) const{
49+
if ( val1->length != val2->length )
50+
return false;
51+
--- a/src/core/CLucene/util/Equators.h
52+
+++ b/src/core/CLucene/util/Equators.h
53+
@@ -22,21 +22,30 @@ CL_NS_DEF(util)
54+
/** @internal */
55+
class CLUCENE_INLINE_EXPORT Equals{
56+
public:
57+
- class CLUCENE_INLINE_EXPORT Int32:public CL_NS_STD(binary_function)<const int32_t*,const int32_t*,bool>
58+
+ class CLUCENE_INLINE_EXPORT Int32
59+
{
60+
public:
61+
+ using first_argument_type = const int32_t*;
62+
+ using second_argument_type = const int32_t*;
63+
+ using result_type = bool;
64+
bool operator()( const int32_t val1, const int32_t val2 ) const;
65+
};
66+
67+
- class CLUCENE_INLINE_EXPORT Char:public CL_NS_STD(binary_function)<const char*,const char*,bool>
68+
+ class CLUCENE_INLINE_EXPORT Char
69+
{
70+
public:
71+
+ using first_argument_type = const char*;
72+
+ using second_argument_type = const char*;
73+
+ using result_type = bool;
74+
bool operator()( const char* val1, const char* val2 ) const;
75+
};
76+
#ifdef _UCS2
77+
- class CLUCENE_INLINE_EXPORT WChar: public CL_NS_STD(binary_function)<const wchar_t*,const wchar_t*,bool>
78+
+ class CLUCENE_INLINE_EXPORT WChar
79+
{
80+
public:
81+
+ using first_argument_type = const wchar_t*;
82+
+ using second_argument_type = const wchar_t*;
83+
+ using result_type = bool;
84+
bool operator()( const wchar_t* val1, const wchar_t* val2 ) const;
85+
};
86+
class CLUCENE_INLINE_EXPORT TChar: public WChar{
87+
@@ -48,9 +57,12 @@ public:
88+
89+
90+
template<typename _cl>
91+
- class CLUCENE_INLINE_EXPORT Void:public CL_NS_STD(binary_function)<const void*,const void*,bool>
92+
+ class CLUCENE_INLINE_EXPORT Void
93+
{
94+
public:
95+
+ using first_argument_type = const void*;
96+
+ using second_argument_type = const void*;
97+
+ using result_type = bool;
98+
bool operator()( _cl* val1, _cl* val2 ) const{
99+
return val1==val2;
100+
}
101+
--- a/src/core/CLucene/util/_Arrays.h
102+
+++ b/src/core/CLucene/util/_Arrays.h
103+
@@ -124,12 +124,14 @@ CL_NS_DEF(util)
104+
105+
template <typename _kt, typename _comparator,
106+
typename class1, typename class2>
107+
- class CLListEquals:
108+
- public CL_NS_STD(binary_function)<class1*,class2*,bool>
109+
+ class CLListEquals
110+
{
111+
typedef typename class1::const_iterator _itr1;
112+
typedef typename class2::const_iterator _itr2;
113+
public:
114+
+ using first_argument_type = class1*;
115+
+ using second_argument_type = class2*;
116+
+ using result_type = bool;
117+
CLListEquals(){
118+
}
119+
bool equals( class1* val1, class2* val2 ) const{
120+
--- a/src/test/index/TestTermVectorsReader.cpp
121+
+++ b/src/test/index/TestTermVectorsReader.cpp
122+
@@ -93,17 +93,21 @@ CL_NS_USE(util);
123+
}
124+
};
125+
126+
- struct MyTCharCompare :
127+
- public std::binary_function<const TCHAR*, const TCHAR*, bool>
128+
+ struct MyTCharCompare
129+
{
130+
+ using first_argument_type = const TCHAR*;
131+
+ using second_argument_type = const TCHAR*;
132+
+ using result_type = bool;
133+
bool operator () (const TCHAR* v1, const TCHAR* v2) const {
134+
return _tcscmp(v1, v2) < 0;
135+
}
136+
};
137+
138+
- struct TestTokenCompare :
139+
- public std::binary_function<const TestToken*, const TestToken*, bool>
140+
+ struct TestTokenCompare
141+
{
142+
+ using first_argument_type = const TestToken*;
143+
+ using second_argument_type = const TestToken*;
144+
+ using result_type = bool;
145+
bool operator () (const TestToken* t1, const TestToken* t2) const {
146+
return t1->pos < t2->pos;
147+
}

tur/clucene/build.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ TERMUX_PKG_DESCRIPTION="C++ port of the high-performance text search engine Luce
33
TERMUX_PKG_LICENSE="Apache-2.0, LGPL-2.0"
44
TERMUX_PKG_MAINTAINER="@termux-user-repository"
55
TERMUX_PKG_VERSION=2.3.3.4
6-
TERMUX_PKG_REVISION=2
6+
TERMUX_PKG_REVISION=3
77
TERMUX_PKG_SRCURL=https://downloads.sourceforge.net/clucene/clucene-core-${TERMUX_PKG_VERSION}.tar.gz
88
TERMUX_PKG_SHA256=ddfdc433dd8ad31b5c5819cc4404a8d2127472a3b720d3e744e8c51d79732eab
99
TERMUX_PKG_DEPENDS="boost, zlib"
@@ -13,7 +13,3 @@ TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
1313
-DENABLE_ASCII_MODE=OFF
1414
-DBUILD_CONTRIBS_LIB:BOOL=ON
1515
"
16-
17-
termux_step_pre_configure() {
18-
CXXFLAGS+=" -std=c++11"
19-
}

0 commit comments

Comments
 (0)