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

main
Pavol Rusnak 2 years ago
parent daa8d8b42c
commit b912253a5d
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
  1. 33
      pkgs/development/libraries/wiredtiger/default.nix

@ -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 = ''

Loading…
Cancel
Save