summary refs log tree commit diff
path: root/pkgs/development/libraries/leveldb/default.nix
blob: 62abc1bd68cad1de601973d418d000d3497f1b0c (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
{ stdenv, fetchFromGitHub, fixDarwinDylibNames }:

stdenv.mkDerivation rec {
  pname = "leveldb";
  version = "1.20";

  src = fetchFromGitHub {
    owner = "google";
    repo = "leveldb";
    rev = "v${version}";
    sha256 = "01kxga1hv4wp94agx5vl3ybxfw5klqrdsrb6p6ywvnjmjxm8322y";
  };

  nativeBuildInputs = []
    ++ stdenv.lib.optional stdenv.isDarwin [ fixDarwinDylibNames ];

  buildPhase = ''
    make all
  '';

  installPhase = "
    mkdir -p $out/{bin,lib,include}

    cp -r include $out
    mkdir -p $out/include/leveldb/helpers
    cp helpers/memenv/memenv.h $out/include/leveldb/helpers

    cp out-shared/lib* $out/lib
    cp out-static/lib* $out/lib

    cp out-static/leveldbutil $out/bin
  ";

  meta = with stdenv.lib; {
    homepage = https://github.com/google/leveldb;
    description = "Fast and lightweight key/value database library by Google";
    license = licenses.bsd3;
    platforms = platforms.all;
  };
}