2021-01-21 18:00:13 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fixDarwinDylibNames, snappy }:
|
2013-05-11 08:52:32 +02:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 14:41:18 +02:00
|
|
|
pname = "leveldb";
|
2018-11-02 00:13:43 +01:00
|
|
|
version = "1.20";
|
2013-05-11 08:52:32 +02:00
|
|
|
|
2014-11-15 06:54:12 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "leveldb";
|
|
|
|
rev = "v${version}";
|
2018-11-02 00:13:43 +01:00
|
|
|
sha256 = "01kxga1hv4wp94agx5vl3ybxfw5klqrdsrb6p6ywvnjmjxm8322y";
|
2013-05-11 08:52:32 +02:00
|
|
|
};
|
|
|
|
|
2020-06-10 02:07:51 +02:00
|
|
|
buildInputs = [ snappy ];
|
|
|
|
|
2021-03-24 19:05:44 +01:00
|
|
|
nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames;
|
2020-02-26 13:44:13 +01:00
|
|
|
|
2021-03-24 19:05:44 +01:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
buildFlags = [ "all" ];
|
|
|
|
|
|
|
|
postPatch = lib.optionalString stdenv.hostPlatform.isStatic ''
|
|
|
|
# remove shared objects from "all" target
|
|
|
|
sed -i '/^all:/ s/$(SHARED_LIBS) $(SHARED_PROGRAMS)//' Makefile
|
2014-11-15 06:54:12 +01:00
|
|
|
'';
|
2013-05-11 08:52:32 +02:00
|
|
|
|
2021-03-24 19:05:44 +01:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
2017-12-10 02:40:07 +01:00
|
|
|
|
2021-03-24 19:05:44 +01:00
|
|
|
install -D -t $out/include/leveldb include/leveldb/*
|
|
|
|
install -D helpers/memenv/memenv.h $out/include/leveldb/helpers
|
2017-12-10 02:40:07 +01:00
|
|
|
|
2021-03-24 19:05:44 +01:00
|
|
|
install -D -t $out/lib out-{static,shared}/lib*
|
|
|
|
install -D -t $out/bin out-static/{leveldbutil,db_bench}
|
2017-12-10 02:40:07 +01:00
|
|
|
|
2021-03-24 19:05:44 +01:00
|
|
|
runHook postInstall
|
|
|
|
'';
|
2013-05-11 08:52:32 +02:00
|
|
|
|
2021-01-21 18:00:13 +01:00
|
|
|
meta = with lib; {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/google/leveldb";
|
2013-10-06 11:49:53 +02:00
|
|
|
description = "Fast and lightweight key/value database library by Google";
|
2014-11-15 06:54:12 +01:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.all;
|
2013-05-11 08:52:32 +02:00
|
|
|
};
|
|
|
|
}
|