void-packages/srcpkgs/clucene/patches/multithreading.patch
Érico Rolim 20f99ca5ae clucene: fix musl build, enable tests.
Disable multithreading for musl, which segfaults. Enable tests, which
are passing for glibc and musl. Remove unnecessary iconv config arg,
which was preventing the build system from installing cjk related files.

Changes largely based on
3acdda4185/user/clucene/APKBUILD

[ci skip]
2020-09-09 11:39:02 +02:00

77 lines
2.8 KiB
Diff

Taken from https://code.foxkit.us/adelie/packages/-/blob/3acdda418554ecd64ea33df0f92ef51ba1548c8d/user/clucene/disable-threading.patch
Adapted from https://sourceforge.net/p/clucene/bugs/197
--- src/shared/CLucene/util/Misc.cpp 2011-03-16 20:21:07.000000000 -0400
+++ src/shared/CLucene/util/Misc.cpp 2018-05-20 19:24:09.219901243 -0400
@@ -466,6 +466,7 @@
std::string Misc::toString(const bool value){
return value ? "true" : "false";
}
+#ifndef _CL_DISABLE_MULTITHREADING
std::string Misc::toString(_LUCENE_THREADID_TYPE value){
static int32_t nextindex = 0;
static std::map<_LUCENE_THREADID_TYPE, int32_t> ids;
@@ -474,6 +475,7 @@
}
return toString(ids[value]);
}
+#endif
std::string Misc::toString(const int32_t value){
char buf[20];
TCHAR tbuf[20];
--- src/shared/CLucene/util/Misc.h 2011-03-16 20:21:07.000000000 -0400
+++ src/shared/CLucene/util/Misc.h 2018-05-20 19:24:09.219901243 -0400
@@ -67,7 +67,9 @@
static std::string toString(const int32_t value);
static std::string toString(const int64_t value);
+ #ifndef _CL_DISABLE_MULTITHREADING
static std::string toString(const _LUCENE_THREADID_TYPE value);
+ #endif
static std::string toString(const bool value);
static std::string toString(const float_t value);
static std::string toString(const TCHAR* s, int32_t len=-1);
--- src/shared/CLucene/LuceneThreads.h 2011-03-16 20:21:07.000000000 -0400
+++ src/shared/CLucene/LuceneThreads.h 2018-05-20 19:28:05.999899570 -0400
@@ -13,10 +13,10 @@
#if defined(_CL_DISABLE_MULTITHREADING)
#define SCOPED_LOCK_MUTEX(theMutex)
- #define DEFINE_MUTEX(x)
+ //#define DEFINE_MUTEX(x)
#define DEFINE_MUTABLE_MUTEX(x)
#define DEFINE_CONDITION(x)
- #define STATIC_DEFINE_MUTEX(x)
+ //#define STATIC_DEFINE_MUTEX(x)
#define CONDITION_WAIT(theMutex, theCondition)
#define CONDITION_NOTIFYALL(theCondition)
#define _LUCENE_CURRTHREADID 1
@@ -25,11 +25,27 @@
#define _LUCENE_THREAD_FUNC_RETURN(val) return (int)val;
#define _LUCENE_THREAD_CREATE(func, arg) (*func)(arg)
#define _LUCENE_THREAD_JOIN(value) //nothing to do...
- #define _LUCENE_THREADMUTEX void*
+ //#define _LUCENE_THREADMUTEX void*
#define _LUCENE_ATOMIC_INC(theInteger) (++(*theInteger))
#define _LUCENE_ATOMIC_DEC(theInteger) (--(*theInteger))
#define _LUCENE_ATOMIC_INT int
+
+ #define _LUCENE_ATOMIC_INT_SET(x,v) x=v
+ #define _LUCENE_ATOMIC_INT_GET(x) x
+
+ struct CLUCENE_SHARED_EXPORT mutex_thread
+ {
+ void lock() {}
+ void unlock() {}
+ };
+ #define _LUCENE_THREADMUTEX CL_NS(util)::mutex_thread
+
+ #define DEFINE_MUTEX(theMutex) _LUCENE_THREADMUTEX theMutex;
+ #define STATIC_DEFINE_MUTEX(theMutex) static _LUCENE_THREADMUTEX theMutex;
+
+ #define CONDITION_WAIT(theMutex, theCondition)
+ #define CONDITION_NOTIFYALL(theCondition)
#else
#if defined(_LUCENE_DONTIMPLEMENT_THREADMUTEX)
//do nothing