2021-02-05 17:12:51 +00:00
|
|
|
{ lib, stdenv
|
2020-07-18 16:06:22 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, cmake
|
|
|
|
, ninja
|
|
|
|
, bzip2
|
|
|
|
, lz4
|
|
|
|
, snappy
|
|
|
|
, zlib
|
|
|
|
, zstd
|
2020-10-27 00:29:36 +00:00
|
|
|
, enableJemalloc ? false, jemalloc
|
2020-04-24 23:36:52 +00:00
|
|
|
, enableLite ? false
|
2021-01-05 17:05:55 +00:00
|
|
|
, enableShared ? !stdenv.hostPlatform.isStatic
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "rocksdb";
|
2022-02-20 05:27:41 +00:00
|
|
|
version = "6.29.3";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "facebook";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2022-02-20 05:27:41 +00:00
|
|
|
sha256 = "sha256-O0nIPRKj0ZOEjynh7h9kM6V965hQKs+4GgIbN+Os0I4=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [ cmake ninja ];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2020-10-27 00:29:36 +00:00
|
|
|
propagatedBuildInputs = [ bzip2 lz4 snappy zlib zstd ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
buildInputs = lib.optional enableJemalloc jemalloc;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=deprecated-copy -Wno-error=pessimizing-move"
|
|
|
|
+ lib.optionalString stdenv.cc.isClang "-Wno-error=unused-private-field";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
cmakeFlags = [
|
|
|
|
"-DPORTABLE=1"
|
2020-10-27 00:29:36 +00:00
|
|
|
"-DWITH_JEMALLOC=${if enableJemalloc then "1" else "0"}"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DWITH_JNI=0"
|
2020-07-18 16:06:22 +00:00
|
|
|
"-DWITH_BENCHMARK_TOOLS=0"
|
|
|
|
"-DWITH_TESTS=1"
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DWITH_TOOLS=0"
|
|
|
|
"-DWITH_BZ2=1"
|
|
|
|
"-DWITH_LZ4=1"
|
|
|
|
"-DWITH_SNAPPY=1"
|
|
|
|
"-DWITH_ZLIB=1"
|
|
|
|
"-DWITH_ZSTD=1"
|
|
|
|
"-DWITH_GFLAGS=0"
|
|
|
|
"-DUSE_RTTI=1"
|
|
|
|
"-DROCKSDB_INSTALL_ON_WINDOWS=YES" # harmless elsewhere
|
2021-02-05 17:12:51 +00:00
|
|
|
(lib.optional
|
2020-04-24 23:36:52 +00:00
|
|
|
(stdenv.hostPlatform.isx86 && stdenv.hostPlatform.isLinux)
|
|
|
|
"-DFORCE_SSE42=1")
|
2021-02-05 17:12:51 +00:00
|
|
|
(lib.optional enableLite "-DROCKSDB_LITE=1")
|
2020-04-24 23:36:52 +00:00
|
|
|
"-DFAIL_ON_WARNINGS=${if stdenv.hostPlatform.isMinGW then "NO" else "YES"}"
|
2021-02-05 17:12:51 +00:00
|
|
|
] ++ lib.optional (!enableShared) "-DROCKSDB_BUILD_SHARED=0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
# otherwise "cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]"
|
2021-02-05 17:12:51 +00:00
|
|
|
hardeningDisable = lib.optional stdenv.hostPlatform.isWindows "format";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://rocksdb.org";
|
|
|
|
description = "A library that provides an embeddable, persistent key-value store for fast storage";
|
2021-08-08 23:34:03 +00:00
|
|
|
changelog = "https://github.com/facebook/rocksdb/raw/v${version}/HISTORY.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2021-08-08 23:34:03 +00:00
|
|
|
platforms = platforms.all;
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ adev magenbluten ];
|
|
|
|
};
|
|
|
|
}
|