@@ -19,7 +19,7 @@
1919, zfs ? null
2020
2121# Version specific arguments
22−, version, src, patches ? []
22+, version, src, patches ? [], buildInputs ? []
2323, ...
2424}:
2525
@@ -35,9 +35,6 @@ let
3535 mkWith = mkFlag "with-" "without-";
3636 mkOther = mkFlag "" "" true;
3737
38− # TODO: Backport patches to support xio
39− accelio = null;
40−
4138 hasServer = snappy != null && leveldb != null;
4239 hasMon = hasServer;
4340 hasMds = hasServer;
@@ -45,9 +42,14 @@ let
4542 hasRadosgw = fcgi != null && expat != null && curl != null && libedit != null;
4643
4744 hasXio = (stdenv.isLinux || stdenv.isFreebsd) &&
48− stdenv.lib.versionAtLeast version "0.94" &&
45+ versionAtLeast version "0.95" &&
4946 accelio != null && libibverbs != null && librdmacm != null;
5047
48+ hasRocksdb = versionAtLeast version "0.95" && rocksdb != null;
49+
50+ # TODO: Reenable when kinetic support is fixed
51+ hasKinetic = versionAtLeast version "0.95" && kinetic-cpp-client != null && false;
52+
5153 # Malloc implementation (can be jemalloc, tcmalloc or null)
5254 malloc = if jemalloc != null then jemalloc else gperftools;
5355
@@ -60,11 +62,6 @@ let
6062 none = [ ];
6163 };
6264
63− # TODO: Fix Rocksdb which is currently too new
64− rocksdb = null;
65− # TODO: Fix Kinetic which is also in a mismatched state
66− kinetic-cpp-client = null;
67−
6865 wrapArgs = "--prefix PYTHONPATH : \"$(toPythonPath $lib)\""
6966 + " --prefix PYTHONPATH : \"$(toPythonPath ${python.modules.readline})\""
7067 + " --prefix PYTHONPATH : \"$(toPythonPath ${pythonPackages.flask})\""
@@ -80,16 +77,22 @@ stdenv.mkDerivation {
8077 ];
8178
8279 nativeBuildInputs = [ autoconf automake makeWrapper pkgconfig libtool which ];
83− buildInputs = cryptoLibsMap.${cryptoStr} ++ [
84− boost python libxml2 yasm libatomic_ops kinetic-cpp-client rocksdb libs3 malloc
85− ] ++ stdenv.lib.optional stdenv.isLinux [
80+ buildInputs = buildInputs ++ cryptoLibsMap.${cryptoStr} ++ [
81+ boost python libxml2 yasm libatomic_ops libs3 malloc pythonPackages.flask
82+ ] ++ optional (versionAtLeast version "0.95") [
83+ pythonPackages.sphinx
84+ ] ++ optional stdenv.isLinux [
8685 linuxHeaders libuuid udev keyutils libaio libxfs zfs
87− ] ++ stdenv.lib.optional hasServer [
86+ ] ++ optional hasServer [
8887 snappy leveldb
89− ] ++ stdenv.lib.optional hasRadosgw [
88+ ] ++ optional hasRadosgw [
9089 fcgi expat curl fuse libedit
91− ] ++ stdenv.lib.optional hasXio [
90+ ] ++ optional hasXio [
9291 accelio libibverbs librdmacm
92+ ] ++ optional hasRocksdb [
93+ rocksdb
94+ ] ++ optional hasKinetic [
95+ kinetic-cpp-client
9396 ];
9497
9598 postPatch = ''
@@ -145,8 +148,8 @@ stdenv.mkDerivation {
145148 (mkEnable hasXio "xio" null)
146149 (mkWith (libatomic_ops != null) "libatomic-ops" null)
147150 (mkWith true "ocf" null)
148− (mkWith (kinetic-cpp-client != null) "kinetic" null)
149− (mkWith (rocksdb != null) "librocksdb" null)
151+ (mkWith hasKinetic "kinetic" null)
152+ (mkWith hasRocksdb "librocksdb" null)
150153 (mkWith false "librocksdb-static" null)
151154 (mkWith (libs3 != null) "system-libs3" null)
152155 (mkWith true "rest-bench" null)
@@ -175,9 +178,13 @@ stdenv.mkDerivation {
175178 # Fix the python library loading
176179 find $lib/lib -name \*.pyc -or -name \*.pyd -exec rm {} \;
177180 for PY in $(find $lib/lib -name \*.py); do
178− LIB="$(sed -n "s/.*find_library('\([^)]*\)').*/\1/p" "$PY")"
179− REALLIB="$lib/lib/lib$LIB.so"
180− sed -i "s,\(library_path[ ]*=[ ]*\).*,\1'$REALLIB',g" "$PY"
181+ LIBS="$(sed -n "s/.*find_library('\([^)]*\)').*/\1/p" "$PY")"
182+
183+ # Fix each find_library call
184+ for LIB in $LIBS; do
185+ REALLIB="$lib/lib/lib$LIB.so"
186+ sed -i "s,find_library('$LIB'),'$REALLIB',g" "$PY"
187+ done
181188
182189 # Reapply compilation optimizations
183190 NAME=$(basename -s .py "$PY")