Unverified Commit b912253a authored by Pavol Rusnak's avatar Pavol Rusnak
Browse files

wiredtiger: replace mkFlag with lib.enableFeature and lib.withFeature

parent daa8d8b4
Loading
Loading
Loading
Loading
+13 −20
Original line number Diff line number Diff line
@@ -7,13 +7,6 @@

with lib;
let
  mkFlag = trueStr: falseStr: cond: name: val: "--"
    + (if cond then trueStr else falseStr)
    + name
    + optionalString (val != null && cond != false) "=${val}";
  mkEnable = mkFlag "enable-" "disable-";
  mkWith = mkFlag "with-" "without-";

  shouldUsePkg = pkg: if pkg != null && lib.meta.availableOn stdenv.hostPlatform pkg then pkg else null;

  optLz4 = shouldUsePkg lz4;
@@ -39,19 +32,19 @@ stdenv.mkDerivation rec {
  buildInputs = [ optLz4 optSnappy optZlib optBzip2 optDb optGperftools optLeveldb ];

  configureFlags = [
    (mkWith   false                   "attach"     null)
    (mkWith   true                    "builtins"   "")
    (mkEnable (optBzip2 != null)      "bzip2"      null)
    (mkEnable false                   "diagnostic" null)
    (mkEnable false                   "java"       null)
    (mkEnable (optLeveldb != null)    "leveldb"    null)
    (mkEnable false                   "python"     null)
    (mkEnable (optSnappy != null)     "snappy"     null)
    (mkEnable (optLz4 != null)        "lz4"        null)
    (mkEnable (optGperftools != null) "tcmalloc"   null)
    (mkEnable (optZlib != null)       "zlib"       null)
    (mkWith   (optDb != null)         "berkeleydb" optDb)
    (mkWith   false                   "helium"     null)
    (withFeature   false                   "attach")
    (withFeatureAs true                    "builtins" "")
    (enableFeature (optBzip2 != null)      "bzip2")
    (enableFeature false                   "diagnostic")
    (enableFeature false                   "java")
    (enableFeature (optLeveldb != null)    "leveldb")
    (enableFeature false                   "python")
    (enableFeature (optSnappy != null)     "snappy")
    (enableFeature (optLz4 != null)        "lz4")
    (enableFeature (optGperftools != null) "tcmalloc")
    (enableFeature (optZlib != null)       "zlib")
    (withFeatureAs (optDb != null)         "berkeleydb" optDb)
    (withFeature   false                   "helium")
  ];

  preConfigure = ''