14
14
# see: https://github.com/NixOS/nixpkgs/issues/216479
15
15
, enableJemalloc ? ! stdenv . hostPlatform . isWindows && ! stdenv . hostPlatform . isStatic
16
16
, jemalloc
17
- , enableLite ? false
18
17
, enableShared ? ! stdenv . hostPlatform . isStatic
19
18
, sse42Support ? stdenv . hostPlatform . sse4_2Support
20
19
} :
21
20
22
- stdenv . mkDerivation rec {
21
+ stdenv . mkDerivation ( finalAttrs : {
23
22
pname = "rocksdb" ;
24
- version = "8.1.1 " ;
23
+ version = "8.11.3 " ;
25
24
26
25
src = fetchFromGitHub {
27
26
owner = "facebook" ;
28
- repo = pname ;
29
- rev = "v${ version } " ;
30
- sha256 = "sha256-79hRtc5QSWLLyjRGCmuYZSoIc9IcIsnl8UCinz2sVw4 =" ;
27
+ repo = finalAttrs . pname ;
28
+ rev = "v${ finalAttrs . version } " ;
29
+ hash = "sha256-OpEiMwGxZuxb9o3RQuSrwZMQGLhe9xLT1aa3HpI4KPs =" ;
31
30
} ;
32
31
33
32
nativeBuildInputs = [ cmake ninja ] ;
@@ -42,16 +41,9 @@ stdenv.mkDerivation rec {
42
41
"tools"
43
42
] ;
44
43
45
- NIX_CFLAGS_COMPILE = lib . optionals stdenv . cc . isGNU [
46
- "-Wno-error=deprecated-copy"
47
- "-Wno-error=pessimizing-move"
48
- # Needed with GCC 12
49
- "-Wno-error=format-truncation"
50
- "-Wno-error=maybe-uninitialized"
51
- ] ++ lib . optionals stdenv . cc . isClang [
52
- "-Wno-error=unused-private-field"
44
+ env . NIX_CFLAGS_COMPILE = toString ( lib . optionals stdenv . cc . isClang [
53
45
"-faligned-allocation"
54
- ] ;
46
+ ] ) ;
55
47
56
48
cmakeFlags = [
57
49
"-DPORTABLE=1"
@@ -70,18 +62,38 @@ stdenv.mkDerivation rec {
70
62
"-DUSE_RTTI=1"
71
63
"-DROCKSDB_INSTALL_ON_WINDOWS=YES" # harmless elsewhere
72
64
( lib . optional sse42Support "-DFORCE_SSE42=1" )
73
- ( lib . optional enableLite "-DROCKSDB_LITE=1" )
74
- "-DFAIL_ON_WARNINGS=${ if stdenv . hostPlatform . isMinGW then "NO" else "YES" } "
65
+ "-DFAIL_ON_WARNINGS=NO"
75
66
] ++ lib . optional ( ! enableShared ) "-DROCKSDB_BUILD_SHARED=0" ;
76
67
77
68
# otherwise "cc1: error: -Wformat-security ignored without -Wformat [-Werror=format-security]"
78
69
hardeningDisable = lib . optional stdenv . hostPlatform . isWindows "format" ;
79
70
71
+ postPatch = lib . optionalString ( lib . versionOlder finalAttrs . version "9" ) ''
72
+ # Fix gcc-13 build failures due to missing <cstdint> and
73
+ # <system_error> includes, fixed upstream since 9.x
74
+ sed -e '1i #include <cstdint>' -i options/offpeak_time_info.h
75
+ '' + lib . optionalString ( lib . versionOlder finalAttrs . version "8" ) ''
76
+ # Fix gcc-13 build failures due to missing <cstdint> and
77
+ # <system_error> includes, fixed upstream since 8.x
78
+ sed -e '1i #include <cstdint>' -i db/compaction/compaction_iteration_stats.h
79
+ sed -e '1i #include <cstdint>' -i table/block_based/data_block_hash_index.h
80
+ sed -e '1i #include <cstdint>' -i util/string_util.h
81
+ sed -e '1i #include <cstdint>' -i include/rocksdb/utilities/checkpoint.h
82
+ '' + lib . optionalString ( lib . versionOlder finalAttrs . version "7" ) ''
83
+ # Fix gcc-13 build failures due to missing <cstdint> and
84
+ # <system_error> includes, fixed upstream since 7.x
85
+ sed -e '1i #include <system_error>' -i third-party/folly/folly/synchronization/detail/ProxyLockable-inl.h
86
+ '' + ''
87
+ # fixed in https://github.com/facebook/rocksdb/pull/12309
88
+ sed -e 's/ZSTD_INCLUDE_DIRS/zstd_INCLUDE_DIRS/' -i cmake/modules/Findzstd.cmake
89
+ sed -e 's/ZSTD_INCLUDE_DIRS/zstd_INCLUDE_DIRS/' -i CMakeLists.txt
90
+ '' ;
91
+
80
92
preInstall = ''
81
93
mkdir -p $tools/bin
82
94
cp tools/{ldb,sst_dump}${ stdenv . hostPlatform . extensions . executable } $tools/bin/
83
95
'' + lib . optionalString stdenv . isDarwin ''
84
- ls -1 $tools/bin/* | xargs -I{} ${ stdenv . cc . bintools . targetPrefix } install_name_tool -change "@rpath/librocksdb.${ lib . versions . major version } .dylib" $out/lib/librocksdb.dylib {}
96
+ ls -1 $tools/bin/* | xargs -I{} ${ stdenv . cc . bintools . targetPrefix } install_name_tool -change "@rpath/librocksdb.${ lib . versions . major finalAttrs . version } .dylib" $out/lib/librocksdb.dylib {}
85
97
'' + lib . optionalString ( stdenv . isLinux && enableShared ) ''
86
98
ls -1 $tools/bin/* | xargs -I{} patchelf --set-rpath $out/lib:${ stdenv . cc . cc . lib } /lib {}
87
99
'' ;
@@ -94,15 +106,15 @@ stdenv.mkDerivation rec {
94
106
fi
95
107
'' + lib . optionalString stdenv . isDarwin ''
96
108
${ stdenv . cc . targetPrefix } install_name_tool -change "@rpath/libsnappy.1.dylib" "${ snappy } /lib/libsnappy.1.dylib" $out/lib/librocksdb.dylib
97
- ${ stdenv . cc . targetPrefix } install_name_tool -change "@rpath/librocksdb.${ lib . versions . major version } .dylib" "$out/lib/librocksdb.${ lib . versions . major version } .dylib" $out/lib/librocksdb.dylib
109
+ ${ stdenv . cc . targetPrefix } install_name_tool -change "@rpath/librocksdb.${ lib . versions . major finalAttrs . version } .dylib" "$out/lib/librocksdb.${ lib . versions . major finalAttrs . version } .dylib" $out/lib/librocksdb.dylib
98
110
'' ;
99
111
100
112
meta = with lib ; {
101
113
homepage = "https://rocksdb.org" ;
102
114
description = "A library that provides an embeddable, persistent key-value store for fast storage" ;
103
- changelog = "https://github.com/facebook/rocksdb/raw/v${ version } /HISTORY.md" ;
115
+ changelog = "https://github.com/facebook/rocksdb/raw/v${ finalAttrs . version } /HISTORY.md" ;
104
116
license = licenses . asl20 ;
105
117
platforms = platforms . all ;
106
118
maintainers = with maintainers ; [ adev magenbluten ] ;
107
119
} ;
108
- }
120
+ } )
0 commit comments