about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/search/re-isearch/default.nix
blob: 45dbedcd466d3b5faa31f91b22b06fc7a9358f15 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{ stdenv, fetchFromGitHub, lib, db, file, libnsl }:

stdenv.mkDerivation rec {
  pname = "re-Isearch";
  version = "unstable-2022-03-24";

  src = fetchFromGitHub {
    owner = pname;
    repo = pname;
    rev = "e5953ea6c84285283be3689df7065908369cdbaf";
    sha256 = "sha256-D0PDqlWzIOHqdS2MlNzR2T5cyhiLcFlf30v6eFokoRQ=";
  };

  postPatch = ''
    # Fix gcc-13 build due to missing <cstdint> include.
    sed -e '1i #include <cstdint>' -i src/mmap.cxx
  '';

  buildinputs = [
    db
    file # libmagic
    libnsl
  ];

  makeFlags = [
    "CC=g++" "cc=gcc" "LD=g++"
    "INSTALL=${placeholder "out"}/bin"
  ];

  preBuild = ''
    cd build
    makeFlagsArray+=(
      EXTRA_INC="-I${db.dev}/include -I${lib.getDev file}/include"
      LD_PATH="-L../lib -L${db.out}/lib -L${file}/lib -L${libnsl}/lib"
    )
  '';

  preInstall = ''
    mkdir -p $out/{bin,lib}
  '';
  postInstall = ''
    cp ../lib/*.so $out/lib/
  '';

  meta = with lib; {
    description = "Novel multimodal search and retrieval engine";
    homepage = "https://github.com/re-Isearch/";
    license = licenses.asl20;
    maintainers = [ maintainers.astro ];
  };
}