nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 19.03 74 lines 2.5 kB view raw
1{ stdenv, fetchFromGitHub, automake, autoconf, libtool 2 3# Optional Dependencies 4, lz4 ? null, snappy ? null, zlib ? null, bzip2 ? null, db ? null 5, gperftools ? null, leveldb ? null 6}: 7 8with stdenv.lib; 9let 10 mkFlag = trueStr: falseStr: cond: name: val: "--" 11 + (if cond then trueStr else falseStr) 12 + name 13 + optionalString (val != null && cond != false) "=${val}"; 14 mkEnable = mkFlag "enable-" "disable-"; 15 mkWith = mkFlag "with-" "without-"; 16 17 shouldUsePkg = pkg: if pkg != null && stdenv.lib.any (stdenv.lib.meta.platformMatch stdenv.hostPlatform) pkg.meta.platforms then pkg else null; 18 19 optLz4 = shouldUsePkg lz4; 20 optSnappy = shouldUsePkg snappy; 21 optZlib = shouldUsePkg zlib; 22 optBzip2 = shouldUsePkg bzip2; 23 optDb = shouldUsePkg db; 24 optGperftools = shouldUsePkg gperftools; 25 optLeveldb = shouldUsePkg leveldb; 26in 27stdenv.mkDerivation rec { 28 name = "wiredtiger-${version}"; 29 version = "2.6.1"; 30 31 src = fetchFromGitHub { 32 repo = "wiredtiger"; 33 owner = "wiredtiger"; 34 rev = version; 35 sha256 = "1nj319w3hvkq3za2dz9m0p1w683gycdb392v1jb910bhzpsq30pd"; 36 }; 37 38 nativeBuildInputs = [ automake autoconf libtool ]; 39 buildInputs = [ optLz4 optSnappy optZlib optBzip2 optDb optGperftools optLeveldb ]; 40 41 configureFlags = [ 42 (mkWith false "attach" null) 43 (mkWith true "builtins" "") 44 (mkEnable (optBzip2 != null) "bzip2" null) 45 (mkEnable false "diagnostic" null) 46 (mkEnable false "java" null) 47 (mkEnable (optLeveldb != null) "leveldb" null) 48 (mkEnable false "python" null) 49 (mkEnable (optSnappy != null) "snappy" null) 50 (mkEnable (optLz4 != null) "lz4" null) 51 (mkEnable (optGperftools != null) "tcmalloc" null) 52 (mkEnable (optZlib != null) "zlib" null) 53 (mkWith (optDb != null) "berkeleydb" optDb) 54 (mkWith false "helium" null) 55 ]; 56 57 preConfigure = '' 58 ./autogen.sh 59 ''; 60 61 prePatch = stdenv.lib.optionalString stdenv.isDarwin '' 62 substituteInPlace api/leveldb/leveldb_wt.h --replace \ 63 '#include "wiredtiger.h"' \ 64 ''$'#include "wiredtiger.h"\n#include "pthread.h"' 65 ''; 66 67 meta = { 68 homepage = http://wiredtiger.com/; 69 description = ""; 70 license = licenses.gpl2; 71 platforms = intersectLists platforms.unix platforms.x86_64; 72 broken = true; # Broken by f689a6d1c6796c4a4f116ffec6c4624379e04bc9. 73 }; 74}