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]
This commit is contained in:
Érico Rolim 2020-08-27 19:48:07 -03:00 committed by Jürgen Buchmüller
parent 1c49d720f2
commit 20f99ca5ae
4 changed files with 129 additions and 5 deletions

View file

@ -0,0 +1,21 @@
*** src/test/contribs-lib/analysis/de/TestGermanStemFilter.cpp.orig 2020-08-27 19:02:04.024654943 -0300
--- src/test/contribs-lib/analysis/de/TestGermanStemFilter.cpp 2020-08-27 19:02:26.219672761 -0300
***************
*** 8,15 ****
#include "test.h"
#include "CLucene/util/CLStreams.h"
#include "CLucene/analysis/Analyzers.h"
! #include "CLucene/analysis/de/GermanStemmer.h"
! #include "CLucene/analysis/de/GermanStemFilter.h"
#include "CLucene/analysis/standard/StandardTokenizer.h"
CL_NS_USE(util)
--- 8,15 ----
#include "test.h"
#include "CLucene/util/CLStreams.h"
#include "CLucene/analysis/Analyzers.h"
! #include "CLucene/../../contribs-lib/CLucene/analysis/de/GermanStemmer.h"
! #include "CLucene/../../contribs-lib/CLucene/analysis/de/GermanStemFilter.h"
#include "CLucene/analysis/standard/StandardTokenizer.h"
CL_NS_USE(util)

View file

@ -0,0 +1,12 @@
*** src/test/test.h.orig 2020-08-27 18:47:10.782379958 -0300
--- src/test/test.h 2020-08-27 18:47:16.518388700 -0300
***************
*** 23,28 ****
--- 23,29 ----
#include <iostream>
#include <string.h>
#include <stdio.h>
+ #include <unistd.h>
using namespace std;

View file

@ -0,0 +1,77 @@
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

View file

@ -1,12 +1,12 @@
# Template file for 'clucene'
pkgname=clucene
version=2.3.3.4
revision=7
revision=8
wrksrc=${pkgname}-core-${version}
build_style=cmake
configure_args="-DENABLE_ASCII_MODE=OFF -DENABLE_PACKAGING=OFF
-DBUILD_CONTRIBS_LIB:BOOL=ON -DLIB_DESTINATION:PATH=/usr/lib
-DLUCENE_SYS_INCLUDES:PATH=/usr/include -DDISABLE_MULTITHREADING=OFF"
-DLUCENE_SYS_INCLUDES:PATH=/usr/include"
hostmakedepends="pkg-config"
makedepends="zlib-devel boost-devel"
short_desc="Text search engine written in C++"
@ -16,9 +16,13 @@ maintainer="Orphaned <orphan@voidlinux.org>"
distfiles="${SOURCEFORGE_SITE}/${pkgname}/${pkgname}-core-${version}.tar.gz"
checksum=ddfdc433dd8ad31b5c5819cc4404a8d2127472a3b720d3e744e8c51d79732eab
case "$XBPS_TARGET_MACHINE" in
*-musl) configure_args="-DICONV_SECOND_ARGUMENT_IS_CONST=0"
esac
if [ "$XBPS_TARGET_LIBC" = musl ]; then
# threading segfaults on musl
configure_args+=" -DDISABLE_MULTITHREADING=BOOL:ON"
else
configure_args+=" -DDISABLE_MULTITHREADING=OFF"
fi
if [ "$CROSS_BUILD" ]; then
configure_args+=" -D_CL_HAVE_PTHREAD_MUTEX_RECURSIVE_EXITCODE=0"
configure_args+=" -D_CL_HAVE_PTHREAD_MUTEX_RECURSIVE_EXITCODE__TRYRUN_OUTPUT=0"
@ -33,6 +37,16 @@ if [ "$CROSS_BUILD" ]; then
configure_args+=" -DLUCENE_STATIC_CONSTANT_SYNTAX_EXITCODE=0"
configure_args+=" -DLUCENE_STATIC_CONSTANT_SYNTAX_EXITCODE__TRYRUN_OUTPUT=0"
fi
do_check() {
cd build
make ${makejobs} cl_test
mkdir -p tmp
cd bin
TMP=../tmp ./cl_test
}
clucene-devel_package() {
depends="libstdc++-devel ${sourcepkg}>=${version}_${revision}"
short_desc+=" - development files"