commit:     fe27109c7a1359fd22d5f9f0cbe9d76919e2cea0
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 30 02:29:06 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jul 30 02:29:06 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fe27109c

dev-cpp/clucene: fix build w/ libcxx

Use FreeBSD's patches.

Closes: https://bugs.gentoo.org/862195
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-cpp/clucene/clucene-2.3.3.4-r8.ebuild          | 66 ++++++++++++++++++++++
 dev-cpp/clucene/files/clucene-2.3.3.4-libcxx.patch | 48 ++++++++++++++++
 2 files changed, 114 insertions(+)

diff --git a/dev-cpp/clucene/clucene-2.3.3.4-r8.ebuild 
b/dev-cpp/clucene/clucene-2.3.3.4-r8.ebuild
new file mode 100644
index 000000000000..6c22b70622bf
--- /dev/null
+++ b/dev-cpp/clucene/clucene-2.3.3.4-r8.ebuild
@@ -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
+}

diff --git a/dev-cpp/clucene/files/clucene-2.3.3.4-libcxx.patch 
b/dev-cpp/clucene/files/clucene-2.3.3.4-libcxx.patch
new file mode 100644
index 000000000000..268b887f6d86
--- /dev/null
+++ b/dev-cpp/clucene/files/clucene-2.3.3.4-libcxx.patch
@@ -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;;
+       }
+ };
+ 

Reply via email to