2021-12-26 21:34:38 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchpatch, fixDarwinDylibNames, snappy, cmake
|
2021-12-22 15:51:10 +00:00
|
|
|
, static ? stdenv.hostPlatform.isStatic }:
|
2013-05-11 06:52:32 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-08-15 12:41:18 +00:00
|
|
|
pname = "leveldb";
|
2021-12-22 15:51:10 +00:00
|
|
|
version = "1.23";
|
2013-05-11 06:52:32 +00:00
|
|
|
|
2014-11-15 05:54:12 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "google";
|
|
|
|
repo = "leveldb";
|
2021-12-22 15:51:10 +00:00
|
|
|
rev = "${version}";
|
|
|
|
sha256 = "sha256-RL+dfSFZZzWvUobSqiPbuC4nDiGzjIIukbVJZRacHbI=";
|
2013-05-11 06:52:32 +00:00
|
|
|
};
|
|
|
|
|
2021-12-26 21:34:38 +00:00
|
|
|
patches = [
|
|
|
|
# Re-enable RTTI. Needed for e.g. Ceph to compile properly.
|
|
|
|
# See https://github.com/NixOS/nixpkgs/issues/147801,
|
|
|
|
# https://github.com/google/leveldb/issues/731,
|
|
|
|
# https://lists.ceph.io/hyperkitty/list/dev@ceph.io/thread/K4OSAA4AJS2V7FQI6GNCKCK3IRQDBQRS/.
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://src.fedoraproject.org/rpms/leveldb/raw/e8178670c664e952fdd00f1fc6e3eb28b2c5b6a8/f/0006-revert-no-rtti.patch";
|
|
|
|
sha256 = "sha256-d2YAV8O+1VKu3WwgNsWw6Cxg5sUUR+xOlJtA7pTcigQ=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-12-22 15:51:10 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
|
|
|
|
2020-06-10 00:07:51 +00:00
|
|
|
buildInputs = [ snappy ];
|
|
|
|
|
2021-12-22 15:51:10 +00:00
|
|
|
nativeBuildInputs = lib.optional stdenv.isDarwin fixDarwinDylibNames ++ [ cmake ];
|
2020-02-26 12:44:13 +00:00
|
|
|
|
2021-03-24 18:05:44 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
buildFlags = [ "all" ];
|
|
|
|
|
2021-12-22 15:51:10 +00:00
|
|
|
# NOTE: disabling tests due to gtest issue
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DBUILD_SHARED_LIBS=${if static then "OFF" else "ON"}"
|
|
|
|
"-DLEVELDB_BUILD_TESTS=OFF"
|
2022-04-09 02:17:27 +00:00
|
|
|
"-DLEVELDB_BUILD_BENCHMARKS=OFF"
|
2021-12-22 15:51:10 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
substituteInPlace "$out"/lib/cmake/leveldb/leveldbTargets.cmake \
|
|
|
|
--replace 'INTERFACE_INCLUDE_DIRECTORIES "''${_IMPORT_PREFIX}/include"' 'INTERFACE_INCLUDE_DIRECTORIES "'$dev'"'
|
|
|
|
mkdir -p $dev/lib/pkgconfig
|
|
|
|
cat <<EOF > $dev/lib/pkgconfig/leveldb.pc
|
|
|
|
Name: leveldb
|
|
|
|
Description: Fast and lightweight key/value database library by Google.
|
|
|
|
Version: ${version}
|
|
|
|
Libs: -L$out/lib -lleveldb
|
|
|
|
Cflags: -I$dev/include
|
|
|
|
EOF
|
2021-03-24 18:05:44 +00:00
|
|
|
'';
|
2013-05-11 06:52:32 +00:00
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 01:11:51 +00:00
|
|
|
homepage = "https://github.com/google/leveldb";
|
2013-10-06 09:49:53 +00:00
|
|
|
description = "Fast and lightweight key/value database library by Google";
|
2014-11-15 05:54:12 +00:00
|
|
|
license = licenses.bsd3;
|
|
|
|
platforms = platforms.all;
|
2013-05-11 06:52:32 +00:00
|
|
|
};
|
|
|
|
}
|