rocksdb: Fix MinGW Build

This commit is contained in:
John Ericson 2019-11-15 23:19:04 +00:00
parent c9453387da
commit 069e9fd449

View file

@ -1,4 +1,8 @@
{ stdenv, fetchFromGitHub, lib, bzip2, cmake, lz4, snappy, zlib, zstd, enableLite ? false }:
{ stdenv, fetchFromGitHub, fetchpatch
, cmake
, bzip2, lz4, snappy, zlib, zstd
, enableLite ? false
}:
stdenv.mkDerivation rec {
pname = "rocksdb";
@ -14,6 +18,25 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ cmake ];
buildInputs = [ bzip2 lz4 snappy zlib zstd ];
patches = [
(fetchpatch {
url = "https://github.com/facebook/rocksdb/commit/6a376fc709e9d289c1be4a7d479eb460cd27a87f.diff";
sha256 = "1rsc1nagwica0krfkvjv21jhgfxpl9359aqqaaxqfnbvfds43ljs";
})
(fetchpatch {
url = "https://github.com/facebook/rocksdb/commit/3b860886c01bd880158e9a63ff970dfe9aa966cb.diff";
sha256 = "1b6p2ghmbawcafv4w9m8g4xv1f9xjijdbm4hj4rg3f8mylqcv7i1";
})
(fetchpatch {
url = "https://github.com/facebook/rocksdb/commit/31ac949de35c0e21440f851a6811304de964d22a.diff";
sha256 = "1316cw74cdfll51gacr9qshrwdg4j8w9n75bvfxiir8v57xaipzj";
})
(fetchpatch {
url = "https://github.com/facebook/rocksdb/commit/c585211cec1211ad9b977211ba5aa69853a20348.diff";
sha256 = "01kwnm0r4msc3b6fwx2j14p68ii7z2d6abig2093izcvbm6hq6p1";
})
];
postPatch = ''
substituteInPlace CMakeLists.txt --replace "find_package(zlib " "find_package(ZLIB "
'';
@ -30,12 +53,17 @@ stdenv.mkDerivation rec {
"-DWITH_ZLIB=1"
"-DWITH_ZSTD=1"
"-DWITH_GFLAGS=0"
(lib.optional
"-DROCKSDB_INSTALL_ON_WINDOWS=YES" # harmless elsewhere
(stdenv.lib.optional
(stdenv.hostPlatform.isx86 && stdenv.hostPlatform.isLinux)
"-DFORCE_SSE42=1")
(lib.optional enableLite "-DROCKSDB_LITE=1")
(stdenv.lib.optional enableLite "-DROCKSDB_LITE=1")
"-DFAIL_ON_WARNINGS=${if stdenv.hostPlatform.isMinGW then "NO" else "YES"}"
];
# otherwise "cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]"
hardeningDisable = stdenv.lib.optional stdenv.hostPlatform.isWindows "format";
meta = with stdenv.lib; {
homepage = https://rocksdb.org;
description = "A library that provides an embeddable, persistent key-value store for fast storage";