dev-cpp/clucene: fix build w/ libcxx

Use FreeBSD's patches.

Closes: https://bugs.gentoo.org/862195
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Sam James
2022-07-30 03:29:06 +01:00
parent 006e7d01b0
commit fe27109c7a
2 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,66 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
MY_PN="${PN}"-core
MY_P="${MY_PN}"-"${PV}"
inherit cmake
DESCRIPTION="High-performance, full-featured text search engine based off of lucene in C++"
HOMEPAGE="http://clucene.sourceforge.net/"
SRC_URI="mirror://sourceforge/clucene/${MY_P}.tar.gz"
LICENSE="|| ( Apache-2.0 LGPL-2.1 )"
SLOT="1"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
IUSE="debug doc static-libs"
BDEPEND="
doc? ( >=app-doc/doxygen-1.4.2 )
"
RESTRICT="test"
DOCS=(AUTHORS ChangeLog README README.PACKAGE REQUESTS)
S="${WORKDIR}/${MY_PN}-${PV}"
PATCHES=(
"${FILESDIR}/${P}-fix-clang.patch"
"${FILESDIR}/${P}-contrib.patch"
"${FILESDIR}/${P}-pkgconfig.patch"
"${FILESDIR}/${P}-gcc6.patch"
"${FILESDIR}/${P}-gmtime.patch"
"${FILESDIR}/${P}-musl-pthread.patch"
"${FILESDIR}/${P}-libcxx.patch"
)
src_prepare() {
cmake_src_prepare
# patch out installing bundled boost headers, we build against system one
sed -i \
-e '/ADD_SUBDIRECTORY (src\/ext)/d' \
CMakeLists.txt || die
rm -rf src/ext || die
}
src_configure() {
# Disabled threads: see upstream bug
# https://sourceforge.net/p/clucene/bugs/197/
local mycmakeargs=(
-DENABLE_ASCII_MODE=OFF
-DENABLE_PACKAGING=OFF
-DDISABLE_MULTITHREADING=OFF
-DBUILD_CONTRIBS_LIB=ON
"-DLIB_DESTINATION=${EPREFIX}/usr/$(get_libdir)"
-DENABLE_DEBUG=$(usex debug)
-DENABLE_CLDOCS=$(usex doc)
-DBUILD_STATIC_LIBRARIES=$(usex static-libs)
)
cmake_src_configure
}

View File

@@ -0,0 +1,48 @@
https://bugs.gentoo.org/862195
https://cgit.freebsd.org/ports/tree/textproc/clucene/files/patch-src__core__CLucene__index__DocumentsWriter.cpp
https://cgit.freebsd.org/ports/plain/textproc/clucene/files/patch-src__core__CLucene__util__VoidMap.h
--- a/src/core/CLucene/index/DocumentsWriter.cpp
+++ b/src/core/CLucene/index/DocumentsWriter.cpp
@@ -125,7 +125,7 @@
if (this->postingsFreeListDW.values){
if (this->postingsFreeCountDW < this->postingsFreeListDW.length) {
memset(this->postingsFreeListDW.values + this->postingsFreeCountDW
- , NULL
+ , 0
, sizeof(Posting*));
}
postingsFreeListDW.deleteUntilNULL();
--- a/src/core/CLucene/util/VoidMap.h
+++ b/src/core/CLucene/util/VoidMap.h
@@ -11,8 +11,13 @@
#include "CLucene/LuceneThreads.h"
#if defined(_CL_HAVE_TR1_UNORDERED_MAP) && defined(_CL_HAVE_TR1_UNORDERED_SET)
+#if defined(_LIBCPP_VERSION)
+ #include <unordered_map>
+ #include <unordered_set>
+#else
#include <tr1/unordered_map>
#include <tr1/unordered_set>
+#endif
#elif defined(_CL_HAVE_HASH_MAP) && defined(_CL_HAVE_HASH_SET)
//hashing is all or nothing!
#include <hash_map>
@@ -83,7 +88,7 @@
_vt get( _kt k) const {
const_iterator itr = base::find(k);
if ( itr==base::end() )
- return (_vt)NULL;
+ return static_cast<_vt>(0);
else
return itr->second;
}
@@ -316,6 +321,7 @@
if ( _this::dk || _this::dv )
_this::remove(k);
+ (*this)[k] = v;;
}
};