From 09014e54d161cd7f3150b2302979e64659d357c9 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@gmail.com>
Date: Sat, 8 Nov 2014 17:51:36 +0100
Subject: Fix include paths.


diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 5e333a9..33614f7 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -227,17 +227,17 @@ FOREACH(file ${HEADERS})
 	file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/core ${apath})
 	IF ( NOT aname MATCHES "^_.*" )
 		install(FILES ${file} 
-		        DESTINATION include/${relpath}
+		        DESTINATION develop/headers/${relpath}
 		        COMPONENT development)
 	ENDIF ( NOT aname MATCHES "^_.*" )
 ENDFOREACH(file)
 
 #install clucene-shared headers.
 install(FILES ${clucene-shared_SOURCE_DIR}/CLucene/SharedHeader.h 
-        DESTINATION include/CLucene 
+        DESTINATION develop/headers/CLucene 
         COMPONENT development)
 install(FILES ${clucene-shared_SOURCE_DIR}/CLucene/LuceneThreads.h 
-        DESTINATION include/CLucene 
+        DESTINATION develop/headers/CLucene 
         COMPONENT development )
 
 # code for installing an script to help cmake applications determine
diff --git a/src/ext/CMakeLists.txt b/src/ext/CMakeLists.txt
index 0ab402e..1055a4b 100644
--- a/src/ext/CMakeLists.txt
+++ b/src/ext/CMakeLists.txt
@@ -9,7 +9,7 @@ FOREACH(file ${EXTHEADERS})
 	file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/ext/boost ${apath})
 	
 	install(FILES ${file} 
-	       DESTINATION "include/CLucene/ext/boost/${relpath}"
+	       DESTINATION "develop/headers/CLucene/ext/boost/${relpath}"
                COMPONENT development)
 ENDFOREACH(file)
 
-- 
2.11.0


From 35173dc3b8275fafa0f80851d88235fa85a5fbba Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 24 Mar 2017 23:25:58 +0100
Subject: Fedora patches


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4950ddb..349ed75 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -163,7 +163,7 @@ IF ( BUILD_CONTRIBS )
   SET(BUILD_CONTRIBS_LIB 1)
 ENDIF ( BUILD_CONTRIBS )
 IF ( BUILD_CONTRIBS_LIB )
-  ADD_SUBDIRECTORY (src/contribs-lib EXCLUDE_FROM_ALL)
+  ADD_SUBDIRECTORY (src/contribs-lib)
 ENDIF ( BUILD_CONTRIBS_LIB )
 
 
diff --git a/src/contribs-lib/CMakeLists.txt b/src/contribs-lib/CMakeLists.txt
index c3cd213..7109e02 100644
--- a/src/contribs-lib/CMakeLists.txt
+++ b/src/contribs-lib/CMakeLists.txt
@@ -106,9 +106,26 @@ add_library(clucene-contribs-lib SHARED
 )
 TARGET_LINK_LIBRARIES(clucene-contribs-lib ${clucene_contrib_extra_libs})
 
+#install public headers.
+FOREACH(file ${HEADERS})
+	get_filename_component(apath ${file} PATH)
+	get_filename_component(aname ${file} NAME)
+	file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/contribs-lib ${apath})
+	IF ( NOT aname MATCHES "^_.*" )
+		install(FILES ${file} 
+		        DESTINATION include/${relpath}
+		        COMPONENT development)
+	ENDIF ( NOT aname MATCHES "^_.*" )
+ENDFOREACH(file)
+
 #set properties on the libraries
 SET_TARGET_PROPERTIES(clucene-contribs-lib PROPERTIES
     VERSION ${CLUCENE_VERSION}
     SOVERSION ${CLUCENE_SOVERSION}
     COMPILE_DEFINITIONS_DEBUG _DEBUG
 )
+
+#and install library
+install(TARGETS clucene-contribs-lib 
+        DESTINATION ${LIB_DESTINATION}  
+        COMPONENT runtime )
diff --git a/src/core/libclucene-core.pc.cmake b/src/core/libclucene-core.pc.cmake
index 0152b25..c3f68e9 100644
--- a/src/core/libclucene-core.pc.cmake
+++ b/src/core/libclucene-core.pc.cmake
@@ -6,6 +6,6 @@ includedir=${prefix}/include:${prefix}/include/CLucene/ext
 Name: libclucene
 Description: CLucene - a C++ search engine, ported from the popular Apache Lucene
 Version: @CLUCENE_VERSION_MAJOR@.@CLUCENE_VERSION_MINOR@.@CLUCENE_VERSION_REVISION@.@CLUCENE_VERSION_PATCH@
-Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core
-Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext
+Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core -lclucene-shared
+Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext -I@LUCENE_SYS_INCLUDES@
 ~
-- 
2.11.0


From 914b424e8dd2974dd2247ebc9e053d10a038bf54 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 24 Mar 2017 23:32:16 +0100
Subject: LibreOffice patches


diff --git a/src/core/CLucene/analysis/AnalysisHeader.h b/src/core/CLucene/analysis/AnalysisHeader.h
index f79d8bf..5c19675 100644
--- a/src/core/CLucene/analysis/AnalysisHeader.h
+++ b/src/core/CLucene/analysis/AnalysisHeader.h
@@ -7,6 +7,8 @@
 #ifndef _lucene_analysis_AnalysisHeader_
 #define _lucene_analysis_AnalysisHeader_
 
+#pragma GCC system_header
+
 #include "CLucene/index/Payload.h"
 #include "CLucene/util/VoidList.h"
 #include "CLucene/LuceneThreads.h"
diff --git a/src/core/CLucene/index/TermInfosReader.cpp b/src/core/CLucene/index/TermInfosReader.cpp
index 6ede797..ebbb315 100644
--- a/src/core/CLucene/index/TermInfosReader.cpp
+++ b/src/core/CLucene/index/TermInfosReader.cpp
@@ -111,7 +111,7 @@ CL_NS_DEF(index)
 	      //destroy their elements
 #ifdef _DEBUG
          for ( int32_t i=0; i<indexTermsLength;++i ){
-            indexTerms[i].__cl_refcount--;
+            indexTerms[i].__cl_decref();
          }
 #endif
          //Delete the arrays
diff --git a/src/core/CLucene/queryParser/QueryParser.cpp b/src/core/CLucene/queryParser/QueryParser.cpp
index 2f9df9a..aa1d4ab 100644
--- a/src/core/CLucene/queryParser/QueryParser.cpp
+++ b/src/core/CLucene/queryParser/QueryParser.cpp
@@ -79,7 +79,7 @@ const TCHAR* QueryParserConstants::tokenImage[] = {
     _T("<RANGEEX_GOOP>")
 };
 
-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};
+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};
 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};
 
 struct QueryParser::JJCalls {
diff --git a/src/core/CLucene/queryParser/QueryParserTokenManager.cpp b/src/core/CLucene/queryParser/QueryParserTokenManager.cpp
index 14de0cf..5d9eccf 100644
--- a/src/core/CLucene/queryParser/QueryParserTokenManager.cpp
+++ b/src/core/CLucene/queryParser/QueryParserTokenManager.cpp
@@ -15,9 +15,9 @@
 
 CL_NS_DEF(queryParser)
 
-const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff)};
+const int64_t QueryParserTokenManager::jjbitVec2[]={0x0L, 0x0L, int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff))};
 const int64_t QueryParserTokenManager::jjbitVec0[] = {
-	_ILONGLONG(0xfffffffffffffffe), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff), _ILONGLONG(0xffffffffffffffff)
+	int64_t(_ILONGLONG(0xfffffffffffffffe)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff)), int64_t(_ILONGLONG(0xffffffffffffffff))
 };
 const int32_t QueryParserTokenManager::jjnextStates[]={
 		15, 17, 18, 29, 32, 23, 33, 30, 20, 21, 32, 23, 33, 31, 34, 27,
diff --git a/src/core/CLucene/search/Searchable.h b/src/core/CLucene/search/Searchable.h
index 86ab605..dfbf78a 100644
--- a/src/core/CLucene/search/Searchable.h
+++ b/src/core/CLucene/search/Searchable.h
@@ -7,6 +7,7 @@
 #ifndef _lucene_search_Searcher_
 #define _lucene_search_Searcher_
 
+#pragma GCC system_header
 
 //#include "CLucene/index/IndexReader.h"
 CL_CLASS_DEF(index,Term)
diff --git a/src/core/CLucene/store/IndexInput.h b/src/core/CLucene/store/IndexInput.h
index 8a43d59..8ab61c4 100644
--- a/src/core/CLucene/store/IndexInput.h
+++ b/src/core/CLucene/store/IndexInput.h
@@ -7,6 +7,8 @@
 #ifndef _lucene_store_IndexInput_
 #define _lucene_store_IndexInput_
 
+#pragma GCC system_header
+
 #include "CLucene/LuceneThreads.h"
 #include "CLucene/util/Equators.h"
 
diff --git a/src/core/CLucene/util/Array.h b/src/core/CLucene/util/Array.h
index 969426a..0f07137 100644
--- a/src/core/CLucene/util/Array.h
+++ b/src/core/CLucene/util/Array.h
@@ -7,6 +7,8 @@
 #ifndef _lucene_util_Array_
 #define _lucene_util_Array_
 
+#pragma GCC system_header
+
 #include <stdlib.h>
 #include <string.h>
 
diff --git a/src/core/CLucene/util/PriorityQueue.h b/src/core/CLucene/util/PriorityQueue.h
index ac25cde..ddd5854 100644
--- a/src/core/CLucene/util/PriorityQueue.h
+++ b/src/core/CLucene/util/PriorityQueue.h
@@ -7,6 +7,8 @@
 #ifndef _lucene_util_PriorityQueue_
 #define _lucene_util_PriorityQueue_
 
+#pragma GCC system_header
+
 #include <stdlib.h>
 
 CL_NS_DEF(util)
diff --git a/src/core/CLucene/util/VoidMap.h b/src/core/CLucene/util/VoidMap.h
index b666dcf..61a597b 100644
--- a/src/core/CLucene/util/VoidMap.h
+++ b/src/core/CLucene/util/VoidMap.h
@@ -316,6 +316,7 @@ public:
 		if ( _this::dk || _this::dv )
 			_this::remove(k);
 
+		(*this)[k] = v;
 	}
 };
 
diff --git a/src/shared/CLucene/LuceneThreads.h b/src/shared/CLucene/LuceneThreads.h
index 97072ee..d32d131 100644
--- a/src/shared/CLucene/LuceneThreads.h
+++ b/src/shared/CLucene/LuceneThreads.h
@@ -70,7 +70,7 @@ class CLuceneThreadIdCompare;
         		void NotifyAll();
 					};
 
-          #ifdef _CL_HAVE_GCC_ATOMIC_FUNCTIONS
+          #if ( __GNUC__ > 4 ) || (( __GNUC__ == 4)  && ( __GNUC_MINOR__ >= 4 ))
             #define _LUCENE_ATOMIC_INT uint32_t
             #define _LUCENE_ATOMIC_INT_SET(x,v) x=v
             #define _LUCENE_ATOMIC_INT_GET(x) x
diff --git a/src/shared/CLucene/config/threads.cpp b/src/shared/CLucene/config/threads.cpp
index 0b5f30a..15e766d 100644
--- a/src/shared/CLucene/config/threads.cpp
+++ b/src/shared/CLucene/config/threads.cpp
@@ -185,7 +185,7 @@ CL_NS_DEF(util)
     }
       
     int32_t atomic_threads::atomic_increment(_LUCENE_ATOMIC_INT *theInteger){
-      #ifdef _CL_HAVE_GCC_ATOMIC_FUNCTIONS
+      #if ( __GNUC__ > 4 ) || (( __GNUC__ == 4)  && ( __GNUC_MINOR__ >= 4 ))
         return __sync_add_and_fetch(theInteger, 1);
       #else
         SCOPED_LOCK_MUTEX(theInteger->THIS_LOCK)
@@ -193,7 +193,7 @@ CL_NS_DEF(util)
       #endif
     }
     int32_t atomic_threads::atomic_decrement(_LUCENE_ATOMIC_INT *theInteger){
-      #ifdef _CL_HAVE_GCC_ATOMIC_FUNCTIONS
+      #if ( __GNUC__ > 4 ) || (( __GNUC__ == 4)  && ( __GNUC_MINOR__ >= 4 ))
         return __sync_sub_and_fetch(theInteger, 1);
       #else
         SCOPED_LOCK_MUTEX(theInteger->THIS_LOCK)
-- 
2.11.0


From 557aec44617afa32a64ec7f0b5bccf048395e965 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 24 Mar 2017 23:41:45 +0100
Subject: Fix include path.


diff --git a/src/contribs-lib/CMakeLists.txt b/src/contribs-lib/CMakeLists.txt
index 7109e02..c6e8fb1 100644
--- a/src/contribs-lib/CMakeLists.txt
+++ b/src/contribs-lib/CMakeLists.txt
@@ -113,7 +113,7 @@ FOREACH(file ${HEADERS})
 	file(RELATIVE_PATH relpath ${CMAKE_SOURCE_DIR}/src/contribs-lib ${apath})
 	IF ( NOT aname MATCHES "^_.*" )
 		install(FILES ${file} 
-		        DESTINATION include/${relpath}
+		        DESTINATION develop/headers/${relpath}
 		        COMPONENT development)
 	ENDIF ( NOT aname MATCHES "^_.*" )
 ENDFOREACH(file)
-- 
2.11.0


From a1e92b57f5d2b89be14eedae6e8fb36487e30f74 Mon Sep 17 00:00:00 2001
From: Kacper Kasper <kacperkasper@gmail.com>
Date: Sun, 2 Apr 2017 16:57:35 +0000
Subject: Fix pkgconfig file.


diff --git a/src/core/libclucene-core.pc.cmake b/src/core/libclucene-core.pc.cmake
index c3f68e9..085f7d2 100644
--- a/src/core/libclucene-core.pc.cmake
+++ b/src/core/libclucene-core.pc.cmake
@@ -7,5 +7,5 @@ Name: libclucene
 Description: CLucene - a C++ search engine, ported from the popular Apache Lucene
 Version: @CLUCENE_VERSION_MAJOR@.@CLUCENE_VERSION_MINOR@.@CLUCENE_VERSION_REVISION@.@CLUCENE_VERSION_PATCH@
 Libs: -L${prefix}/@LIB_DESTINATION@/ -lclucene-core -lclucene-shared
-Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext -I@LUCENE_SYS_INCLUDES@
+Cflags: -I${prefix}/include -I${prefix}/include/CLucene/ext -I${prefix}/@LUCENE_SYS_INCLUDES@
 ~
-- 
2.11.0

