11{ stdenv
22, fetchFromGitHub
33, fixDarwinDylibNames
4- , hostPlatform , lib
5- , which , perl , cmake
4+ , which , perl
65
76# Optional Arguments
87, snappy ? null , google-gflags ? null , zlib ? null , bzip2 ? null , lz4 ? null
1211, jemalloc ? null , gperftools ? null
1312
1413, enableLite ? false
15- , windows
1614} :
1715
1816let
@@ -32,58 +30,50 @@ stdenv.mkDerivation rec {
3230 sha256 = "15x2r7aib1xinwcchl32wghs8g96k4q5xgv6z97mxgp35475x01p" ;
3331 } ;
3432
35- nativeBuildInputs = [ which perl snappy google-gflags ] ;
36- buildInputs = [ zlib bzip2 malloc fixDarwinDylibNames ] # lz4 ];
37- ++ lib . optional ( hostPlatform . libc == "msvcrt" ) [ windows . mingw_w64_pthreads windows . mingw_w64_headers ] ;
38- crossAttrs = {
39- nativeBuildInputs = [ which perl snappy google-gflags cmake ] ;
40- } ;
41-
42- # cmakeFlags = "-DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++ ";
43- cmakeFlags = "-DCMAKE_SYSTEM_NAME=Windows -DCMAKE_CXX_FLAGS=-std=c++11 -DCMAKE_CXX_FLAGS=-pthread" ;
44- buildFlags = "rocksdb VERBOSE=1 -j1" ;
33+ nativeBuildInputs = [ which perl ] ;
34+ buildInputs = [ snappy google-gflags zlib bzip2 lz4 malloc fixDarwinDylibNames ] ;
4535
46- # postPatch = ''
47- # # Hack to fix typos
48- # sed -i 's,#inlcude,#include,g' build_tools/build_detect_platform
49- # '';
36+ postPatch = ''
37+ # Hack to fix typos
38+ sed -i 's,#inlcude,#include,g' build_tools/build_detect_platform
39+ '' ;
5040
51- # # Environment vars used for building certain configurations
41+ # Environment vars used for building certain configurations
5242 PORTABLE = "1" ;
5343 USE_SSE = "1" ;
54- # CMAKE_CXX_FLAGS = "-std=c ++11 -pthread -pthreads ";
55- # JEMALLOC_LIB = stdenv.lib.optionalString (malloc == jemalloc) "-ljemalloc";
56-
57- # LIBNAME = "librocksdb${stdenv.lib.optionalString enableLite "_lite"}";
58- # ${if enableLite then "CXXFLAGS" else null} = "-DROCKSDB_LITE=1";
59-
60- # buildAndInstallFlags = [
61- # "USE_RTTI=1"
62- # "DEBUG_LEVEL=0"
63- # "DISABLE_WARNING_AS_ERROR=1"
64- # ];
65-
66- # buildFlags = buildAndInstallFlags ++ [
67- # "shared_lib"
68- # "static_lib"
69- # ] ++ tools ;
70-
71- # installFlags = buildAndInstallFlags ++ [
72- # "INSTALL_PATH=\${out}"
73- # "install-shared"
74- # "install-static"
75- # ];
76-
77- # postInstall = ''
78- # # Might eventually remove this when we are confident in the build process
79- # echo "BUILD CONFIGURATION FOR SANITY CHECKING"
80- # cat make_config.mk
81- # mkdir -pv $static/lib/
82- # mv -vi $out/lib/${LIBNAME}.a $static/lib/
83-
84- # install -d ''${!outputBin}/bin
85- # install -D ${stdenv.lib.concatStringsSep " " tools} ''${!outputBin}/bin
86- # '';
44+ CMAKE_CXX_FLAGS = "-std=gnu ++11" ;
45+ JEMALLOC_LIB = stdenv . lib . optionalString ( malloc == jemalloc ) "-ljemalloc" ;
46+
47+ LIBNAME = "librocksdb${ stdenv . lib . optionalString enableLite "_lite" } " ;
48+ ${ if enableLite then "CXXFLAGS" else null } = "-DROCKSDB_LITE=1" ;
49+
50+ buildAndInstallFlags = [
51+ "USE_RTTI=1"
52+ "DEBUG_LEVEL=0"
53+ "DISABLE_WARNING_AS_ERROR=1"
54+ ] ;
55+
56+ buildFlags = buildAndInstallFlags ++ [
57+ "shared_lib"
58+ "static_lib"
59+ ] ++ tools ;
60+
61+ installFlags = buildAndInstallFlags ++ [
62+ "INSTALL_PATH=\ ${out}"
63+ "install-shared"
64+ "install-static"
65+ ] ;
66+
67+ postInstall = ''
68+ # Might eventually remove this when we are confident in the build process
69+ echo "BUILD CONFIGURATION FOR SANITY CHECKING"
70+ cat make_config.mk
71+ mkdir -pv $static/lib/
72+ mv -vi $out/lib/${ LIBNAME } .a $static/lib/
73+
74+ install -d '' ${!outputBin}/bin
75+ install -D ${ stdenv . lib . concatStringsSep " " tools } '' ${!outputBin}/bin
76+ '' ;
8777
8878 enableParallelBuilding = true ;
8979
0 commit comments