at 18.09-beta 173 lines 6.1 kB view raw
1{ stdenv49 2, lib, fetchurl, fetchFromGitHub 3 4, which, findutils, m4, gawk 5, python, openjdk, mono58, libressl 6}: 7 8let 9 # hysterical raisins dictate a version of boost this old. however, 10 # we luckily do not need to build anything, we just need the header 11 # files. 12 boost152 = stdenv49.mkDerivation rec { 13 name = "boost-headers-1.52.0"; 14 15 src = fetchurl { 16 url = "mirror://sourceforge/boost/boost_1_52_0.tar.bz2"; 17 sha256 = "14mc7gsnnahdjaxbbslzk79rc0d12h1i681cd3srdwr3fzynlar2"; 18 }; 19 20 configurePhase = ":"; 21 buildPhase = ":"; 22 installPhase = "mkdir -p $out/include && cp -R boost $out/include/"; 23 }; 24 25 makeFdb = 26 { version 27 , branch 28 , sha256 29 30 # the revision can be inferred from the fdb tagging policy 31 , rev ? "refs/tags/${version}" 32 33 # in theory newer versions of fdb support newer compilers, but they 34 # don't :( maybe one day 35 , stdenv ? stdenv49 36 37 # in theory newer versions of fdb support newer boost versions, but they 38 # don't :( maybe one day 39 , boost ? boost152 40 }: stdenv.mkDerivation rec { 41 name = "foundationdb-${version}"; 42 inherit version; 43 44 src = fetchFromGitHub { 45 owner = "apple"; 46 repo = "foundationdb"; 47 inherit rev sha256; 48 }; 49 50 nativeBuildInputs = [ gawk which m4 findutils mono58 ]; 51 buildInputs = [ python openjdk libressl boost ]; 52 53 patches = 54 [ # For 5.2+, we need a slightly adjusted patch to fix all the ldflags 55 (if lib.versionAtLeast version "5.2" 56 then (if lib.versionAtLeast version "6.0" 57 then ./ldflags-6.0.patch 58 else ./ldflags-5.2.patch) 59 else ./ldflags-5.1.patch) 60 ] ++ 61 # for 6.0+, we do NOT need to apply this version fix, since we can specify 62 # it ourselves. see configurePhase 63 (lib.optional (!lib.versionAtLeast version "6.0") ./fix-scm-version.patch); 64 65 postPatch = '' 66 # note: this does not do anything for 6.0+ 67 substituteInPlace ./build/scver.mk \ 68 --subst-var-by NIXOS_FDB_VERSION_ID "${rev}" \ 69 --subst-var-by NIXOS_FDB_SCBRANCH "${branch}" 70 71 substituteInPlace ./Makefile \ 72 --replace 'shell which ccache' 'shell true' \ 73 --replace -Werror "" 74 75 substituteInPlace ./Makefile \ 76 --replace libstdc++_pic libstdc++ 77 78 substituteInPlace ./build/link-validate.sh \ 79 --replace 'exit 1' '#exit 1' 80 81 patchShebangs . 82 '' + lib.optionalString (lib.versionAtLeast version "6.0") '' 83 substituteInPlace ./Makefile \ 84 --replace 'TLS_LIBS +=' '#TLS_LIBS +=' \ 85 --replace 'LDFLAGS :=' 'LDFLAGS := -ltls -lssl -lcrypto' 86 ''; 87 88 separateDebugInfo = true; 89 enableParallelBuilding = true; 90 91 makeFlags = [ "all" "fdb_java" "fdb_python" ] 92 # Don't compile FDBLibTLS if we don't need it in 6.0 or later; 93 # it gets statically linked in 94 ++ lib.optional (!lib.versionAtLeast version "6.0") [ "fdb_c" ] 95 # Needed environment overrides 96 ++ [ "KVRELEASE=1" 97 "NOSTRIP=1" 98 ]; 99 100 # on 6.0 and later, we can specify all this information manually 101 configurePhase = lib.optionalString (lib.versionAtLeast version "6.0") '' 102 export SOURCE_CONTROL=GIT 103 export SCBRANCH="${branch}" 104 export VERSION_ID="${rev}" 105 ''; 106 107 installPhase = '' 108 mkdir -vp $out/{bin,libexec/plugins} $lib/{lib,share/java} $dev/include/foundationdb 109 mkdir -vp $python/lib/${python.libPrefix}/site-packages 110 111 '' + lib.optionalString (!lib.versionAtLeast version "6.0") '' 112 # we only copy the TLS library on < 6.0, since it's compiled-in otherwise 113 cp -v ./lib/libFDBLibTLS.so $out/libexec/plugins/FDBLibTLS.so 114 '' + '' 115 116 # C API 117 cp -v ./lib/libfdb_c.so $lib/lib 118 cp -v ./bindings/c/foundationdb/fdb_c.h $dev/include/foundationdb 119 cp -v ./bindings/c/foundationdb/fdb_c_options.g.h $dev/include/foundationdb 120 121 # java 122 cp -v ./bindings/java/foundationdb-client.jar $lib/share/java/fdb-java.jar 123 124 # python 125 rm -f ./bindings/python/fdb/*.pth # remove useless files 126 cp -R ./bindings/python/fdb $python/lib/${python.libPrefix}/site-packages/fdb 127 # symlink a copy of the shared object into place, so that impl.py can load it 128 ln -sv $lib/lib/libfdb_c.so $python/lib/${python.libPrefix}/site-packages/fdb/libfdb_c.so 129 130 # binaries 131 for x in fdbbackup fdbcli fdbserver fdbmonitor; do 132 cp -v "./bin/$x" $out/bin; 133 done 134 135 ln -sfv $out/bin/fdbbackup $out/bin/dr_agent 136 ln -sfv $out/bin/fdbbackup $out/bin/fdbrestore 137 ln -sfv $out/bin/fdbbackup $out/bin/fdbdr 138 139 ln -sfv $out/bin/fdbbackup $out/libexec/backup_agent 140 ''; 141 142 outputs = [ "out" "lib" "dev" "python" ]; 143 144 meta = with stdenv.lib; { 145 description = "Open source, distributed, transactional key-value store"; 146 homepage = https://www.foundationdb.org; 147 license = licenses.asl20; 148 platforms = platforms.linux; 149 maintainers = with maintainers; [ thoughtpolice ]; 150 }; 151 }; 152 153in with builtins; { 154 155 foundationdb51 = makeFdb rec { 156 version = "5.1.7"; 157 branch = "release-5.1"; 158 sha256 = "1rc472ih24f9s5g3xmnlp3v62w206ny0pvvw02bzpix2sdrpbp06"; 159 }; 160 161 foundationdb52 = makeFdb rec { 162 version = "5.2.8"; 163 branch = "release-5.2"; 164 sha256 = "1kbmmhk2m9486r4kyjlc7bb3wd50204i0p6dxcmvl6pbp1bs0wlb"; 165 }; 166 167 foundationdb60 = makeFdb rec { 168 version = "6.0.4pre2497_${substring 0 8 rev}"; 169 branch = "release-6.0"; 170 rev = "73d64cb244714c19bcc651122f6e7a9236aa11b5"; 171 sha256 = "1jzmrf9kj0brqddlmxvzhj27r6843790jnqwkv1s3ri21fqb3hs7"; 172 }; 173}