2017-01-03 23:07:02 +01:00
|
|
|
{ stdenv, fetchFromGitHub, fixDarwinDylibNames
|
2015-04-21 20:01:44 +02: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 03:45:33 +02:00
|
|
|
|
|
|
|
, enableLite ? false
|
2015-04-21 20:01:44 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
|
|
|
malloc = if jemalloc != null then jemalloc else gperftools;
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "rocksdb-${version}";
|
2017-02-19 01:42:12 +01:00
|
|
|
version = "5.1.2";
|
2015-04-21 20:01:44 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "facebook";
|
|
|
|
repo = "rocksdb";
|
2015-11-06 03:20:18 +01:00
|
|
|
rev = "v${version}";
|
2017-02-19 01:42:12 +01:00
|
|
|
sha256 = "1smahz67gcd86nkdqaml78lci89dza131mlj5472r4sxjdxsx277";
|
2015-04-21 20:01:44 +02:00
|
|
|
};
|
|
|
|
|
2017-01-03 23:07:02 +01:00
|
|
|
buildInputs = [ snappy google-gflags zlib bzip2 lz4 malloc fixDarwinDylibNames ];
|
2015-04-21 20:01:44 +02: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 15:00:31 +02:00
|
|
|
CMAKE_CXX_FLAGS = "-std=gnu++11";
|
2015-04-21 20:01:44 +02:00
|
|
|
JEMALLOC_LIB = stdenv.lib.optionalString (malloc == jemalloc) "-ljemalloc";
|
|
|
|
|
2017-07-25 03:45:33 +02:00
|
|
|
${if enableLite then "LIBNAME" else null} = "librocksdb_lite";
|
|
|
|
${if enableLite then "CXXFLAGS" else null} = "-DROCKSDB_LITE=1";
|
|
|
|
|
2015-04-21 20:01:44 +02:00
|
|
|
buildFlags = [
|
2016-12-29 14:38:51 +01:00
|
|
|
"DEBUG_LEVEL=0"
|
2016-12-28 19:55:36 +01:00
|
|
|
"shared_lib"
|
2016-12-16 12:01:00 +01:00
|
|
|
"static_lib"
|
2015-04-21 20:01:44 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
installFlags = [
|
2016-12-29 14:38:51 +01:00
|
|
|
"INSTALL_PATH=\${out}"
|
|
|
|
"DEBUG_LEVEL=0"
|
2016-12-28 19:55:36 +01:00
|
|
|
"install-shared"
|
|
|
|
"install-static"
|
2015-04-21 20:01:44 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
# Might eventually remove this when we are confident in the build process
|
|
|
|
echo "BUILD CONFIGURATION FOR SANITY CHECKING"
|
|
|
|
cat make_config.mk
|
|
|
|
'';
|
|
|
|
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
homepage = http://rocksdb.org;
|
|
|
|
description = "A library that provides an embeddable, persistent key-value store for fast storage";
|
|
|
|
license = licenses.bsd3;
|
2015-08-26 18:48:51 +02:00
|
|
|
platforms = platforms.allBut [ "i686-linux" ];
|
2015-04-21 20:01:44 +02:00
|
|
|
maintainers = with maintainers; [ wkennington ];
|
|
|
|
};
|
|
|
|
}
|