1 {lib, stdenv, fetchurl, fetchpatch, cmake, boost, zlib}:
3 stdenv.mkDerivation rec {
4 pname = "clucene-core";
8 url = "mirror://sourceforge/clucene/clucene-core-${version}.tar.gz";
9 sha256 = "1arffdwivig88kkx685pldr784njm0249k0rb1f1plwavlrw9zfx";
12 nativeBuildInputs = [ cmake ];
14 buildInputs = [ boost zlib ];
18 "-DBUILD_CONTRIBS_LIB=ON"
19 "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
20 ] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
21 "-D_CL_HAVE_GCC_ATOMIC_FUNCTIONS=0"
22 "-D_CL_HAVE_NAMESPACES_EXITCODE=0"
23 "-D_CL_HAVE_NAMESPACES_EXITCODE__TRYRUN_OUTPUT="
24 "-D_CL_HAVE_NO_SNPRINTF_BUG_EXITCODE=0"
25 "-D_CL_HAVE_NO_SNPRINTF_BUG_EXITCODE__TRYRUN_OUTPUT="
26 "-D_CL_HAVE_TRY_BLOCKS_EXITCODE=0"
27 "-D_CL_HAVE_TRY_BLOCKS_EXITCODE__TRYRUN_OUTPUT="
28 "-D_CL_HAVE_PTHREAD_MUTEX_RECURSIVE=0"
29 "-DLUCENE_STATIC_CONSTANT_SYNTAX_EXITCODE=0"
30 "-DLUCENE_STATIC_CONSTANT_SYNTAX_EXITCODE__TRYRUN_OUTPUT="
35 ./Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
36 ./Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
37 ./Install-contribs-lib.patch
39 ./fix-missing-include-time.patch
41 # required for darwin and linux-musl
42 ./pthread-include.patch
43 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
46 # see https://bugs.gentoo.org/869170
48 url = "https://869170.bugs.gentoo.org/attachment.cgi?id=858825";
49 hash = "sha256-TbAfBKdXh+1HepZc8J6OhK1XGwhwBCMvO8QBDsad998=";
53 # see https://github.com/macports/macports-ports/commit/236d43f2450c6be52dc42fd3a2bbabbaa5136201
54 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
55 substituteInPlace src/shared/CMakeLists.txt --replace 'fstati64;_fstati64;fstat64;fstat;_fstat' 'fstat;_fstat'
56 substituteInPlace src/shared/CMakeLists.txt --replace 'stati64;_stati64;stat64;stat;_stat' 'stat;_stat'
59 # fails with "Unable to find executable:
60 # /build/clucene-core-2.3.3.4/build/bin/cl_test"
63 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing";
66 description = "Core library for full-featured text search engine";
68 CLucene is a high-performance, scalable, cross platform, full-featured,
69 open-source indexing and searching API. Specifically, CLucene is the guts
70 of a search engine, the hard stuff. You write the easy stuff: the UI and
71 the process of selecting and parsing your data files to pump them into
72 the search engine yourself, and any specialized queries to pull it back
73 for display or further processing.
75 CLucene is a port of the very popular Java Lucene text search engine API.
77 homepage = "https://clucene.sourceforge.net";
78 platforms = platforms.unix;
79 license = with licenses; [ asl20 lgpl2 ];