forgejo-lts: 7.0.10 -> 7.0.11
[NixPkgs.git] / pkgs / development / libraries / clucene-core / 2.x.nix
blob6fc4ac289677aeb24d76c7fc889f19afcd986d94
1 {lib, stdenv, fetchurl, fetchpatch, cmake, boost, zlib}:
3 stdenv.mkDerivation rec {
4   pname = "clucene-core";
5   version = "2.3.3.4";
7   src = fetchurl {
8     url = "mirror://sourceforge/clucene/clucene-core-${version}.tar.gz";
9     sha256 = "1arffdwivig88kkx685pldr784njm0249k0rb1f1plwavlrw9zfx";
10   };
12   nativeBuildInputs = [ cmake ];
14   buildInputs = [ boost zlib ];
16   cmakeFlags = [
17     "-DBUILD_CONTRIBS=ON"
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="
31   ];
33   patches = [
34     # From debian
35     ./Fix-pkgconfig-file-by-adding-clucene-shared-library.patch
36     ./Fixing_ZLIB_configuration_in_shared_CMakeLists.patch
37     ./Install-contribs-lib.patch
38     # From arch
39     ./fix-missing-include-time.patch
41     # required for darwin and linux-musl
42     ./pthread-include.patch
43   ] ++ lib.optionals stdenv.hostPlatform.isDarwin [
44     ./fix-darwin.patch
46     # see https://bugs.gentoo.org/869170
47     (fetchpatch {
48        url = "https://869170.bugs.gentoo.org/attachment.cgi?id=858825";
49        hash = "sha256-TbAfBKdXh+1HepZc8J6OhK1XGwhwBCMvO8QBDsad998=";
50     })
51   ];
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'
57   '';
59   # fails with "Unable to find executable:
60   # /build/clucene-core-2.3.3.4/build/bin/cl_test"
61   doCheck = false;
63   env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isClang "-Wno-error=c++11-narrowing";
65   meta = with lib; {
66     description = "Core library for full-featured text search engine";
67     longDescription = ''
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.
76     '';
77     homepage = "https://clucene.sourceforge.net";
78     platforms = platforms.unix;
79     license = with licenses; [ asl20 lgpl2 ];
80   };