@@ -1,4 +1,8 @@
1−{ stdenv, fetchFromGitHub, lib, bzip2, cmake, lz4, snappy, zlib, zstd, enableLite ? false }:
1+{ stdenv, fetchFromGitHub, fetchpatch
2+, cmake
3+, bzip2, lz4, snappy, zlib, zstd
4+, enableLite ? false
5+}:
26
37stdenv.mkDerivation rec {
48 pname = "rocksdb";
@@ -14,6 +18,25 @@ stdenv.mkDerivation rec {
1418 nativeBuildInputs = [ cmake ];
1519 buildInputs = [ bzip2 lz4 snappy zlib zstd ];
1620
21+ patches = [
22+ (fetchpatch {
23+ url = "https://github.com/facebook/rocksdb/commit/6a376fc709e9d289c1be4a7d479eb460cd27a87f.diff";
24+ sha256 = "1rsc1nagwica0krfkvjv21jhgfxpl9359aqqaaxqfnbvfds43ljs";
25+ })
26+ (fetchpatch {
27+ url = "https://github.com/facebook/rocksdb/commit/3b860886c01bd880158e9a63ff970dfe9aa966cb.diff";
28+ sha256 = "1b6p2ghmbawcafv4w9m8g4xv1f9xjijdbm4hj4rg3f8mylqcv7i1";
29+ })
30+ (fetchpatch {
31+ url = "https://github.com/facebook/rocksdb/commit/31ac949de35c0e21440f851a6811304de964d22a.diff";
32+ sha256 = "1316cw74cdfll51gacr9qshrwdg4j8w9n75bvfxiir8v57xaipzj";
33+ })
34+ (fetchpatch {
35+ url = "https://github.com/facebook/rocksdb/commit/c585211cec1211ad9b977211ba5aa69853a20348.diff";
36+ sha256 = "01kwnm0r4msc3b6fwx2j14p68ii7z2d6abig2093izcvbm6hq6p1";
37+ })
38+ ];
39+
1740 postPatch = ''
1841 substituteInPlace CMakeLists.txt --replace "find_package(zlib " "find_package(ZLIB "
1942 '';
@@ -30,12 +53,17 @@ stdenv.mkDerivation rec {
3053 "-DWITH_ZLIB=1"
3154 "-DWITH_ZSTD=1"
3255 "-DWITH_GFLAGS=0"
33− (lib.optional
56+ "-DROCKSDB_INSTALL_ON_WINDOWS=YES" # harmless elsewhere
57+ (stdenv.lib.optional
3458 (stdenv.hostPlatform.isx86 && stdenv.hostPlatform.isLinux)
3559 "-DFORCE_SSE42=1")
36− (lib.optional enableLite "-DROCKSDB_LITE=1")
60+ (stdenv.lib.optional enableLite "-DROCKSDB_LITE=1")
61+ "-DFAIL_ON_WARNINGS=${if stdenv.hostPlatform.isMinGW then "NO" else "YES"}"
3762 ];
3863
64+ # otherwise "cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]"
65+ hardeningDisable = stdenv.lib.optional stdenv.hostPlatform.isWindows "format";
66+
3967 meta = with stdenv.lib; {
4068 homepage = https://rocksdb.org;
4169 description = "A library that provides an embeddable, persistent key-value store for fast storage";