lol
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 23.11-beta 133 lines 5.0 kB view raw
1# This builder is for FoundationDB CMake build system. 2 3{ lib, fetchFromGitHub 4, cmake, ninja, python3, openjdk8, mono, pkg-config 5, msgpack, toml11 6 7, gccStdenv, llvmPackages 8, useClang ? false 9, ... 10}: 11 12let 13 stdenv = if useClang then llvmPackages.libcxxStdenv else gccStdenv; 14 15 # Only even numbered versions compile on aarch64; odd numbered versions have avx enabled. 16 avxEnabled = version: 17 let 18 isOdd = n: lib.trivial.mod n 2 != 0; 19 patch = lib.toInt (lib.versions.patch version); 20 in isOdd patch; 21 22 makeFdb = 23 { version 24 , hash 25 , rev ? "refs/tags/${version}" 26 , officialRelease ? true 27 , patches ? [] 28 , boost 29 , ssl 30 }: stdenv.mkDerivation { 31 pname = "foundationdb"; 32 inherit version; 33 34 src = fetchFromGitHub { 35 owner = "apple"; 36 repo = "foundationdb"; 37 inherit rev hash; 38 }; 39 40 buildInputs = [ ssl boost msgpack toml11 ]; 41 42 nativeBuildInputs = [ pkg-config cmake ninja python3 openjdk8 mono ] 43 ++ lib.optionals useClang [ llvmPackages.lld ]; 44 45 separateDebugInfo = true; 46 dontFixCmake = true; 47 48 cmakeFlags = 49 [ (lib.optionalString officialRelease "-DFDB_RELEASE=TRUE") 50 51 # Disable CMake warnings for project developers. 52 "-Wno-dev" 53 54 # CMake Error at fdbserver/CMakeLists.txt:332 (find_library): 55 # > Could not find lz4_STATIC_LIBRARIES using the following names: liblz4.a 56 "-DSSD_ROCKSDB_EXPERIMENTAL=FALSE" 57 58 # FoundationDB's CMake is hardcoded to pull in jemalloc as an external 59 # project at build time. 60 "-DUSE_JEMALLOC=FALSE" 61 62 # LTO brings up overall build time, but results in much smaller 63 # binaries for all users and the cache. 64 (lib.optionalString (!useClang) "-DUSE_LTO=ON") 65 66 # Gold helps alleviate the link time, especially when LTO is 67 # enabled. But even then, it still takes a majority of the time. 68 # Same with LLD when Clang is available. 69 (lib.optionalString useClang "-DUSE_LD=LLD") 70 (lib.optionalString (!useClang) "-DUSE_LD=GOLD") 71 ] ++ lib.optionals (lib.versionOlder version "7.2.0") 72 [ # FIXME: why can't openssl be found automatically? 73 "-DOPENSSL_USE_STATIC_LIBS=FALSE" 74 "-DOPENSSL_CRYPTO_LIBRARY=${ssl.out}/lib/libcrypto.so" 75 "-DOPENSSL_SSL_LIBRARY=${ssl.out}/lib/libssl.so" 76 ]; 77 78 hardeningDisable = [ "fortify" ]; 79 80 env.NIX_CFLAGS_COMPILE = toString [ 81 # Needed with GCC 12 82 "-Wno-error=missing-template-keyword" 83 # Needed to compile on aarch64 84 (lib.optionalString stdenv.isAarch64 "-march=armv8-a+crc") 85 ]; 86 87 inherit patches; 88 89 # the install phase for cmake is pretty wonky right now since it's not designed to 90 # coherently install packages as most linux distros expect -- it's designed to build 91 # packaged artifacts that are shipped in RPMs, etc. we need to add some extra code to 92 # cmake upstream to fix this, and if we do, i think most of this can go away. 93 postInstall = '' 94 mv $out/sbin/fdbmonitor $out/bin/fdbmonitor 95 mkdir $out/libexec && mv $out/usr/lib/foundationdb/backup_agent/backup_agent $out/libexec/backup_agent 96 mv $out/sbin/fdbserver $out/bin/fdbserver 97 98 rm -rf $out/etc $out/lib/foundationdb $out/lib/systemd $out/log $out/sbin $out/usr $out/var 99 100 # move results into multi outputs 101 mkdir -p $dev $lib 102 mv $out/include $dev/include 103 mv $out/lib $lib/lib 104 105 # python bindings 106 # NB: use the original setup.py.in, so we can substitute VERSION correctly 107 cp ../LICENSE ./bindings/python 108 substitute ../bindings/python/setup.py.in ./bindings/python/setup.py \ 109 --replace 'VERSION' "${version}" 110 rm -f ./bindings/python/setup.py.* ./bindings/python/CMakeLists.txt 111 rm -f ./bindings/python/fdb/*.pth # remove useless files 112 rm -f ./bindings/python/*.rst ./bindings/python/*.mk 113 114 cp -R ./bindings/python/ tmp-pythonsrc/ 115 tar -zcf $pythonsrc --transform s/tmp-pythonsrc/python-foundationdb/ ./tmp-pythonsrc/ 116 117 # java bindings 118 mkdir -p $lib/share/java 119 mv lib/fdb-java-*.jar $lib/share/java/fdb-java.jar 120 ''; 121 122 outputs = [ "out" "dev" "lib" "pythonsrc" ]; 123 124 meta = with lib; { 125 description = "Open source, distributed, transactional key-value store"; 126 homepage = "https://www.foundationdb.org"; 127 license = licenses.asl20; 128 platforms = [ "x86_64-linux" ] 129 ++ lib.optionals (!(avxEnabled version)) [ "aarch64-linux" ]; 130 maintainers = with maintainers; [ thoughtpolice lostnet ]; 131 }; 132 }; 133in makeFdb