2018-04-16 12:15:14 +00:00
|
|
|
{ stdenv
|
2018-02-06 13:40:09 +00:00
|
|
|
, fetchFromGitHub
|
|
|
|
, fixDarwinDylibNames
|
|
|
|
, which, perl
|
2015-04-21 18:01:44 +00:00
|
|
|
|
|
|
|
# Optional Arguments
|
|
|
|
, snappy ? null, google-gflags ? null, zlib ? null, bzip2 ? null, lz4 ? null
|
|
|
|
, numactl ? null
|
|
|
|
|
|
|
|
# Malloc implementation
|
|
|
|
, jemalloc ? null, gperftools ? null
|
2017-07-25 01:45:33 +00:00
|
|
|
|
|
|
|
, enableLite ? false
|
2015-04-21 18:01:44 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
malloc = if jemalloc != null then jemalloc else gperftools;
|
2018-04-16 10:46:31 +00:00
|
|
|
tools = [ "sst_dump" "ldb" "rocksdb_dump" "rocksdb_undump" "blob_dump" ];
|
2015-04-21 18:01:44 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "rocksdb-${version}";
|
2018-03-15 11:40:57 +00:00
|
|
|
version = "5.11.3";
|
2015-04-21 18:01:44 +00:00
|
|
|
|
2018-04-16 10:46:31 +00:00
|
|
|
outputs = [ "dev" "out" "static" "bin" ];
|
2018-03-11 15:41:57 +00:00
|
|
|
|
2015-04-21 18:01:44 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "facebook";
|
|
|
|
repo = "rocksdb";
|
2015-11-06 02:20:18 +00:00
|
|
|
rev = "v${version}";
|
2018-03-15 11:40:57 +00:00
|
|
|
sha256 = "15x2r7aib1xinwcchl32wghs8g96k4q5xgv6z97mxgp35475x01p";
|
2015-04-21 18:01:44 +00:00
|
|
|
};
|
2018-04-04 01:23:24 +00:00
|
|
|
|
2018-02-06 13:40:09 +00:00
|
|
|
nativeBuildInputs = [ which perl ];
|
2017-01-03 22:07:02 +00:00
|
|
|
buildInputs = [ snappy google-gflags zlib bzip2 lz4 malloc fixDarwinDylibNames ];
|
2015-04-21 18:01:44 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
# Hack to fix typos
|
|
|
|
sed -i 's,#inlcude,#include,g' build_tools/build_detect_platform
|
|
|
|
'';
|
|
|
|
|
|
|
|
# Environment vars used for building certain configurations
|
|
|
|
PORTABLE = "1";
|
|
|
|
USE_SSE = "1";
|
2015-07-09 13:00:31 +00:00
|
|
|
CMAKE_CXX_FLAGS = "-std=gnu++11";
|
2015-04-21 18:01:44 +00:00
|
|
|
JEMALLOC_LIB = stdenv.lib.optionalString (malloc == jemalloc) "-ljemalloc";
|
|
|
|
|
2018-04-04 01:23:24 +00:00
|
|
|
LIBNAME = "librocksdb${stdenv.lib.optionalString enableLite "_lite"}";
|
2017-07-25 01:45:33 +00:00
|
|
|
${if enableLite then "CXXFLAGS" else null} = "-DROCKSDB_LITE=1";
|
2018-04-04 01:23:24 +00:00
|
|
|
|
2018-02-06 13:40:09 +00:00
|
|
|
buildAndInstallFlags = [
|
|
|
|
"USE_RTTI=1"
|
2016-12-29 13:38:51 +00:00
|
|
|
"DEBUG_LEVEL=0"
|
2018-04-04 01:23:24 +00:00
|
|
|
"DISABLE_WARNING_AS_ERROR=1"
|
2018-02-06 13:40:09 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
buildFlags = buildAndInstallFlags ++ [
|
2016-12-28 18:55:36 +00:00
|
|
|
"shared_lib"
|
2016-12-16 11:01:00 +00:00
|
|
|
"static_lib"
|
2018-04-16 10:46:31 +00:00
|
|
|
] ++ tools ;
|
2015-04-21 18:01:44 +00:00
|
|
|
|
2018-02-06 13:40:09 +00:00
|
|
|
installFlags = buildAndInstallFlags ++ [
|
2016-12-29 13:38:51 +00:00
|
|
|
"INSTALL_PATH=\${out}"
|
2016-12-28 18:55:36 +00:00
|
|
|
"install-shared"
|
|
|
|
"install-static"
|
2015-04-21 18:01:44 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# Might eventually remove this when we are confident in the build process
|
|
|
|
echo "BUILD CONFIGURATION FOR SANITY CHECKING"
|
|
|
|
cat make_config.mk
|
2018-03-11 15:41:57 +00:00
|
|
|
mkdir -pv $static/lib/
|
2018-04-04 01:23:24 +00:00
|
|
|
mv -vi $out/lib/${LIBNAME}.a $static/lib/
|
2018-04-16 10:46:31 +00:00
|
|
|
|
|
|
|
install -d ''${!outputBin}/bin
|
2018-04-16 12:15:14 +00:00
|
|
|
install -D ${stdenv.lib.concatStringsSep " " tools} ''${!outputBin}/bin
|
2015-04-21 18:01:44 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
2018-06-27 20:12:57 +00:00
|
|
|
homepage = https://rocksdb.org;
|
2015-04-21 18:01:44 +00:00
|
|
|
description = "A library that provides an embeddable, persistent key-value store for fast storage";
|
|
|
|
license = licenses.bsd3;
|
2018-04-04 15:08:14 +00:00
|
|
|
platforms = platforms.x86_64;
|
2018-02-06 13:40:09 +00:00
|
|
|
maintainers = with maintainers; [ adev wkennington ];
|
2015-04-21 18:01:44 +00:00
|
|
|
};
|
|
|
|
}
|