at 23.05-pre 77 lines 2.3 kB view raw
1{ lib, stdenv 2, fetchFromGitHub 3, fetchpatch 4, cmake 5, ninja 6, bzip2 7, lz4 8, snappy 9, zlib 10, zstd 11, enableJemalloc ? false, jemalloc 12, enableLite ? false 13, enableShared ? !stdenv.hostPlatform.isStatic 14}: 15 16stdenv.mkDerivation rec { 17 pname = "rocksdb"; 18 version = "7.7.3"; 19 20 src = fetchFromGitHub { 21 owner = "facebook"; 22 repo = pname; 23 rev = "v${version}"; 24 sha256 = "sha256-Np3HPTZYzyoPOKL0xgsLzcvOkceFiEQd+1nyGbg4BHo="; 25 }; 26 27 nativeBuildInputs = [ cmake ninja ]; 28 29 propagatedBuildInputs = [ bzip2 lz4 snappy zlib zstd ]; 30 31 buildInputs = lib.optional enableJemalloc jemalloc; 32 33 NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-Wno-error=deprecated-copy -Wno-error=pessimizing-move" 34 + lib.optionalString stdenv.cc.isClang "-Wno-error=unused-private-field -faligned-allocation"; 35 36 cmakeFlags = [ 37 "-DPORTABLE=1" 38 "-DWITH_JEMALLOC=${if enableJemalloc then "1" else "0"}" 39 "-DWITH_JNI=0" 40 "-DWITH_BENCHMARK_TOOLS=0" 41 "-DWITH_TESTS=1" 42 "-DWITH_TOOLS=0" 43 "-DWITH_BZ2=1" 44 "-DWITH_LZ4=1" 45 "-DWITH_SNAPPY=1" 46 "-DWITH_ZLIB=1" 47 "-DWITH_ZSTD=1" 48 "-DWITH_GFLAGS=0" 49 "-DUSE_RTTI=1" 50 "-DROCKSDB_INSTALL_ON_WINDOWS=YES" # harmless elsewhere 51 (lib.optional 52 (stdenv.hostPlatform.isx86 && stdenv.hostPlatform.isLinux) 53 "-DFORCE_SSE42=1") 54 (lib.optional enableLite "-DROCKSDB_LITE=1") 55 "-DFAIL_ON_WARNINGS=${if stdenv.hostPlatform.isMinGW then "NO" else "YES"}" 56 ] ++ lib.optional (!enableShared) "-DROCKSDB_BUILD_SHARED=0"; 57 58 # otherwise "cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]" 59 hardeningDisable = lib.optional stdenv.hostPlatform.isWindows "format"; 60 61 # Old version doesn't ship the .pc file, new version puts wrong paths in there. 62 postFixup = '' 63 if [ -f "$out"/lib/pkgconfig/rocksdb.pc ]; then 64 substituteInPlace "$out"/lib/pkgconfig/rocksdb.pc \ 65 --replace '="''${prefix}//' '="/' 66 fi 67 ''; 68 69 meta = with lib; { 70 homepage = "https://rocksdb.org"; 71 description = "A library that provides an embeddable, persistent key-value store for fast storage"; 72 changelog = "https://github.com/facebook/rocksdb/raw/v${version}/HISTORY.md"; 73 license = licenses.asl20; 74 platforms = platforms.all; 75 maintainers = with maintainers; [ adev magenbluten ]; 76 }; 77}