nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 184 lines 5.6 kB view raw
1{ 2 stdenv, 3 fetchFromGitHub, 4 lib, 5 fetchpatch, 6 cmake, 7 ninja, 8 python3, 9 openjdk, 10 mono, 11 openssl, 12 boost186, 13 pkg-config, 14 msgpack-cxx, 15 toml11, 16 jemalloc, 17 doctest, 18 zlib, 19}: 20let 21 boost = boost186; 22 # Only even numbered versions compile on aarch64; odd numbered versions have avx enabled. 23 avxEnabled = 24 version: 25 let 26 isOdd = n: lib.trivial.mod n 2 != 0; 27 patch = lib.toInt (lib.versions.patch version); 28 in 29 isOdd patch; 30in 31stdenv.mkDerivation rec { 32 pname = "foundationdb"; 33 version = "7.3.68"; 34 35 src = fetchFromGitHub { 36 owner = "apple"; 37 repo = "foundationdb"; 38 tag = version; 39 hash = "sha256-OaV7YyBggeX3vrnI2EYwlWdIGRHOAeP5OZN0Rmd/dnw="; 40 }; 41 42 patches = [ 43 ./disable-flowbench.patch 44 ./don-t-use-static-boost-libs.patch 45 # <https://github.com/apple/foundationdb/pull/12373> 46 ./fix-toml11-4.0.patch 47 # GetMsgpack: add 4+ versions of upstream 48 # https://github.com/apple/foundationdb/pull/10935 49 (fetchpatch { 50 url = "https://github.com/apple/foundationdb/commit/c35a23d3f6b65698c3b888d76de2d93a725bff9c.patch"; 51 hash = "sha256-bneRoZvCzJp0Hp/G0SzAyUyuDrWErSpzv+ickZQJR5w="; 52 }) 53 # Add a dependency that prevents bindingtester to run before the python bindings are generated 54 # https://github.com/apple/foundationdb/pull/11859 55 (fetchpatch { 56 url = "https://github.com/apple/foundationdb/commit/8d04c97a74c6b83dd8aa6ff5af67587044c2a572.patch"; 57 hash = "sha256-ZLIcmcfirm1+96DtTIr53HfM5z38uTLZrRNHAmZL6rc="; 58 }) 59 ]; 60 61 hardeningDisable = [ "fortify" ]; 62 63 postPatch = '' 64 # allow using any msgpack-cxx version 65 substituteInPlace cmake/GetMsgpack.cmake \ 66 --replace-warn 'find_package(msgpack-cxx 6 QUIET CONFIG)' 'find_package(msgpack-cxx QUIET CONFIG)' 67 68 # Use our doctest package 69 substituteInPlace bindings/c/test/unit/third_party/CMakeLists.txt \ 70 --replace-fail '/opt/doctest_proj_2.4.8' '${doctest}/include' 71 72 # Upstream upgraded to Boost 1.86 with no code changes; see: 73 # <https://github.com/apple/foundationdb/pull/11788> 74 substituteInPlace cmake/CompileBoost.cmake \ 75 --replace-fail 'find_package(Boost 1.78.0 EXACT ' 'find_package(Boost ' 76 ''; 77 78 buildInputs = [ 79 boost 80 jemalloc 81 msgpack-cxx 82 openssl 83 toml11 84 zlib 85 ]; 86 87 checkInputs = [ doctest ]; 88 89 nativeBuildInputs = [ 90 cmake 91 mono 92 ninja 93 openjdk 94 pkg-config 95 python3 96 ]; 97 98 separateDebugInfo = true; 99 100 cmakeFlags = [ 101 "-DFDB_RELEASE=TRUE" 102 103 # Disable CMake warnings for project developers. 104 "-Wno-dev" 105 106 # CMake Error at fdbserver/CMakeLists.txt:332 (find_library): 107 # > Could not find lz4_STATIC_LIBRARIES using the following names: liblz4.a 108 "-DSSD_ROCKSDB_EXPERIMENTAL=FALSE" 109 110 "-DBUILD_DOCUMENTATION=FALSE" 111 112 # Disable the default static linking to libc++, libstdc++ and libgcc. 113 # 114 # This leads to various, non-obvious problems as our dependencies bring in 115 # their own copies of these libraries. 116 "-DSTATIC_LINK_LIBCXX=FALSE" 117 118 # LTO brings up overall build time, but results in much smaller 119 # binaries for all users and the cache. 120 "-DUSE_LTO=ON" 121 122 # Gold helps alleviate the link time, especially when LTO is 123 # enabled. But even then, it still takes a majority of the time. 124 "-DUSE_LD=GOLD" 125 126 # FIXME: why can't openssl be found automatically? 127 "-DOPENSSL_USE_STATIC_LIBS=FALSE" 128 "-DOPENSSL_CRYPTO_LIBRARY=${openssl.out}/lib/libcrypto.so" 129 "-DOPENSSL_SSL_LIBRARY=${openssl.out}/lib/libssl.so" 130 ]; 131 132 # the install phase for cmake is pretty wonky right now since it's not designed to 133 # coherently install packages as most linux distros expect -- it's designed to build 134 # packaged artifacts that are shipped in RPMs, etc. we need to add some extra code to 135 # cmake upstream to fix this, and if we do, i think most of this can go away. 136 postInstall = '' 137 mv $out/sbin/fdbmonitor $out/bin/fdbmonitor 138 mkdir $out/libexec && mv $out/usr/lib/foundationdb/backup_agent/backup_agent $out/libexec/backup_agent 139 mv $out/sbin/fdbserver $out/bin/fdbserver 140 141 rm -rf $out/etc $out/lib/foundationdb $out/lib/systemd $out/log $out/sbin $out/usr $out/var 142 143 # move results into multi outputs 144 mkdir -p $dev $lib 145 mv $out/include $dev/include 146 mv $out/lib $lib/lib 147 148 # python bindings 149 # NB: use the original setup.py.in, so we can substitute VERSION correctly 150 cp ../LICENSE ./bindings/python 151 substitute ../bindings/python/setup.py.in ./bindings/python/setup.py \ 152 --replace 'VERSION' "${version}" 153 rm -f ./bindings/python/setup.py.* ./bindings/python/CMakeLists.txt 154 rm -f ./bindings/python/fdb/*.pth # remove useless files 155 rm -f ./bindings/python/*.rst ./bindings/python/*.mk 156 157 cp -R ./bindings/python/ tmp-pythonsrc/ 158 tar -zcf $pythonsrc --transform s/tmp-pythonsrc/python-foundationdb/ ./tmp-pythonsrc/ 159 160 # java bindings 161 mkdir -p $lib/share/java 162 mv lib/fdb-java-*.jar $lib/share/java/fdb-java.jar 163 ''; 164 165 outputs = [ 166 "out" 167 "dev" 168 "lib" 169 "pythonsrc" 170 ]; 171 172 meta = { 173 description = "Open source, distributed, transactional key-value store"; 174 homepage = "https://www.foundationdb.org"; 175 license = lib.licenses.asl20; 176 platforms = [ "x86_64-linux" ] ++ lib.optionals (!(avxEnabled version)) [ "aarch64-linux" ]; 177 # Fails when cross-compiling with "/bin/sh: gcc-ar: not found" 178 broken = stdenv.buildPlatform != stdenv.hostPlatform; 179 maintainers = with lib.maintainers; [ 180 thoughtpolice 181 kornholi 182 ]; 183 }; 184}