1{
2 lib,
3 stdenv,
4 fetchurl,
5 autoreconfHook,
6 libuuid,
7 zlib,
8
9 # tests
10 mu,
11 perlPackages,
12 python3,
13 xapian-omega,
14}:
15
16let
17 generic =
18 version: hash:
19 stdenv.mkDerivation {
20 pname = "xapian";
21 inherit version;
22 passthru = { inherit version; };
23
24 src = fetchurl {
25 url = "https://oligarchy.co.uk/xapian/${version}/xapian-core-${version}.tar.xz";
26 inherit hash;
27 };
28
29 outputs = [
30 "out"
31 "man"
32 "doc"
33 ];
34
35 buildInputs = [
36 libuuid
37 zlib
38 ];
39 nativeBuildInputs = [ autoreconfHook ];
40
41 enableParallelBuilding = true;
42
43 doCheck = true;
44
45 env = {
46 AUTOMATED_TESTING = true; # https://trac.xapian.org/changeset/8be35f5e1/git
47 }
48 // lib.optionalAttrs stdenv.hostPlatform.is32bit {
49 NIX_CFLAGS_COMPILE = "-fpermissive";
50 };
51
52 # the configure script thinks that Darwin has ___exp10
53 # but it’s not available on my systems (or hydra apparently)
54 postConfigure = lib.optionalString stdenv.hostPlatform.isDarwin ''
55 substituteInPlace config.h \
56 --replace "#define HAVE___EXP10 1" "#undef HAVE___EXP10"
57 '';
58
59 passthru.tests = {
60 inherit mu xapian-omega;
61 inherit (perlPackages) Xapian;
62 python-xapian = python3.pkgs.xapian;
63 };
64
65 meta = with lib; {
66 description = "Search engine library";
67 homepage = "https://xapian.org/";
68 changelog = "https://xapian.org/docs/xapian-core-${version}/NEWS";
69 license = licenses.gpl2Plus;
70 maintainers = with maintainers; [ matthiasbeyer ];
71 platforms = platforms.unix;
72 };
73 };
74in
75{
76 # Don't forget to change the hashes in xapian-omega and
77 # python3Packages.xapian. They inherit the version from this package, and
78 # should always be built with the equivalent xapian version.
79 xapian_1_4 = generic "1.4.27" "sha256-vLyZz78WCAEZwlcfwpZ5T1Ob1ULKOSbxfCmZYAgwq2E=";
80}