From 3951f611302e5e8aefd4eb361c65ed1c8e404ade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Thu, 27 Aug 2020 19:48:07 -0300 Subject: [PATCH 1/2] 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 https://code.foxkit.us/adelie/packages/-/blob/3acdda418554ecd64ea33df0f92ef51ba1548c8d/user/clucene/APKBUILD [ci skip] --- srcpkgs/clucene/patches/fix-cl_test.patch | 21 ++++++ srcpkgs/clucene/patches/fix-test.patch | 12 +++ srcpkgs/clucene/patches/multithreading.patch | 77 ++++++++++++++++++++ srcpkgs/clucene/template | 24 ++++-- 4 files changed, 129 insertions(+), 5 deletions(-) create mode 100644 srcpkgs/clucene/patches/fix-cl_test.patch create mode 100644 srcpkgs/clucene/patches/fix-test.patch create mode 100644 srcpkgs/clucene/patches/multithreading.patch diff --git a/srcpkgs/clucene/patches/fix-cl_test.patch b/srcpkgs/clucene/patches/fix-cl_test.patch new file mode 100644 index 00000000000..33b32719566 --- /dev/null +++ b/srcpkgs/clucene/patches/fix-cl_test.patch @@ -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) diff --git a/srcpkgs/clucene/patches/fix-test.patch b/srcpkgs/clucene/patches/fix-test.patch new file mode 100644 index 00000000000..b9b063a9e27 --- /dev/null +++ b/srcpkgs/clucene/patches/fix-test.patch @@ -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 + #include + #include ++ #include + + using namespace std; + diff --git a/srcpkgs/clucene/patches/multithreading.patch b/srcpkgs/clucene/patches/multithreading.patch new file mode 100644 index 00000000000..dd1a1264127 --- /dev/null +++ b/srcpkgs/clucene/patches/multithreading.patch @@ -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 diff --git a/srcpkgs/clucene/template b/srcpkgs/clucene/template index fed113a79fe..99515ee01ef 100644 --- a/srcpkgs/clucene/template +++ b/srcpkgs/clucene/template @@ -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 " 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" From 22058708544d9773153598a6183f489820d6c9b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Rolim?= Date: Wed, 26 Aug 2020 18:07:18 -0300 Subject: [PATCH 2/2] libreoffice: use system clucene. Also remove obsolete patch from files/. --- srcpkgs/libreoffice/files/musl-os_utils_h.patch | 10 ---------- srcpkgs/libreoffice/template | 11 +---------- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 srcpkgs/libreoffice/files/musl-os_utils_h.patch diff --git a/srcpkgs/libreoffice/files/musl-os_utils_h.patch b/srcpkgs/libreoffice/files/musl-os_utils_h.patch deleted file mode 100644 index 3ff37f206e0..00000000000 --- a/srcpkgs/libreoffice/files/musl-os_utils_h.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- src/common/os/os_utils.h 2016-04-14 16:07:29.000000000 +0200 -+++ - 2019-02-15 02:22:49.698708718 +0100 -@@ -40,6 +40,7 @@ - #define mode_t int - #define DEFAULT_OPEN_MODE (_S_IREAD | _S_IWRITE) - #else -+#include - #define DEFAULT_OPEN_MODE (0666) - #endif - diff --git a/srcpkgs/libreoffice/template b/srcpkgs/libreoffice/template index 0eb5941e2ad..d48abaf07c2 100644 --- a/srcpkgs/libreoffice/template +++ b/srcpkgs/libreoffice/template @@ -1,7 +1,7 @@ # Template file for 'libreoffice' pkgname=libreoffice version=7.0.0.3 -revision=1 +revision=2 build_style=meta make_build_args="build-nocheck" nocross="Several dependencies are nocross=yes" @@ -80,7 +80,6 @@ distfiles=" ${_addurl}/dtoa-20180411.tgz ${_addurl}/beeca87be45ec87d241ddd0e1bad80c1-bsh-2.0b6-src.zip ${_addurl}/35c94d2df8893241173de1d16b6034c0-swingExSrc.zip - ${_addurl}/48d647fbd8ef8889e5a7f422c1bfda94-clucene-core-2.3.3.4.tar.gz ${_addurl}/1f467e5bb703f12cbbb09d5cf67ecf4a-converttexttonumber-1-5-0.oxt ${_addurl}/b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt ${_addurl}/eeb2c7ddf0d302fba4bfc6e97eac9624-libbase-1.1.6.zip @@ -141,7 +140,6 @@ checksum="b25faf8272c6216b72c3c63fa2f56cc5385d38c83619bcb84916a26aabd9541d 0082d0684f7db6f62361b76c4b7faba19e0c7ce5cb8e36c4b65fea8281e711b4 9e93c73e23aff644b17dfff656444474c14150e7f3b38b19635e622235e01c96 64585ac36a81291a58269ec5347e7e3e2e8596dbacb9221015c208191333c6e1 - ddfdc433dd8ad31b5c5819cc4404a8d2127472a3b720d3e744e8c51d79732eab 71b238efd2734be9800af07566daea8d6685aeed28db5eb5fa0e6453f4d85de3 1568ed1d2feb8210bb5de61d69574a165cded536cfa17c6953c9064076469de2 75c80359c9ce343c20aab8a36a45cb3b9ee7c61cf92c13ae45399d854423a9ba @@ -202,7 +200,6 @@ skip_extraction=" dtoa-20180411.tgz beeca87be45ec87d241ddd0e1bad80c1-bsh-2.0b6-src.zip 35c94d2df8893241173de1d16b6034c0-swingExSrc.zip - 48d647fbd8ef8889e5a7f422c1bfda94-clucene-core-2.3.3.4.tar.gz 1f467e5bb703f12cbbb09d5cf67ecf4a-converttexttonumber-1-5-0.oxt b7cae45ad2c23551fd6ccb8ae2c1f59e-numbertext_0.9.5.oxt eeb2c7ddf0d302fba4bfc6e97eac9624-libbase-1.1.6.zip @@ -258,8 +255,6 @@ case "$XBPS_TARGET_MACHINE" in esac if [ "$XBPS_TARGET_LIBC" = "musl" ]; then - # use shipped clucene, because CLucene/analysis/cjk/CJKAnalyzer.h - # is missing in the musl clucene-devel files makedepends+=" libexecinfo-devel" fi @@ -482,10 +477,6 @@ do_configure() { opts+=" --with-system-libs" opts+=" --with-system-headers" case "$XBPS_TARGET_MACHINE" in - i686*|*-musl) - # Can't use system clucence - opts+=" --without-system-clucene" - ;; x86_64) # opts+=" --enable-ext-mariadb-connector" opts+=" --enable-ext-ct2n" opts+=" --enable-ext-numbertext"