2018-07-02 12:02:23 +01:00
|
|
|
{ stdenv49
|
|
|
|
, lib, fetchurl, fetchFromGitHub
|
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
, which, findutils, m4, gawk
|
2018-07-02 12:02:23 +01:00
|
|
|
, python, openjdk, mono58, libressl
|
2018-04-20 12:35:35 +01:00
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2018-07-02 12:02:23 +01:00
|
|
|
# hysterical raisins dictate a version of boost this old. however,
|
|
|
|
# we luckily do not need to build anything, we just need the header
|
|
|
|
# files.
|
|
|
|
boost152 = stdenv49.mkDerivation rec {
|
|
|
|
name = "boost-headers-1.52.0";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "mirror://sourceforge/boost/boost_1_52_0.tar.bz2";
|
|
|
|
sha256 = "14mc7gsnnahdjaxbbslzk79rc0d12h1i681cd3srdwr3fzynlar2";
|
|
|
|
};
|
|
|
|
|
|
|
|
configurePhase = ":";
|
|
|
|
buildPhase = ":";
|
|
|
|
installPhase = "mkdir -p $out/include && cp -R boost $out/include/";
|
|
|
|
};
|
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
makeFdb =
|
|
|
|
{ version
|
|
|
|
, branch
|
2018-07-02 12:02:23 +01:00
|
|
|
, sha256
|
|
|
|
|
|
|
|
# the revision can be inferred from the fdb tagging policy
|
|
|
|
, rev ? "refs/tags/${version}"
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-07-02 12:02:23 +01:00
|
|
|
# in theory newer versions of fdb support newer compilers, but they
|
|
|
|
# don't :( maybe one day
|
|
|
|
, stdenv ? stdenv49
|
|
|
|
|
|
|
|
# in theory newer versions of fdb support newer boost versions, but they
|
|
|
|
# don't :( maybe one day
|
|
|
|
, boost ? boost152
|
2018-05-01 08:17:46 +01:00
|
|
|
}: stdenv.mkDerivation rec {
|
|
|
|
name = "foundationdb-${version}";
|
|
|
|
inherit version;
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "apple";
|
|
|
|
repo = "foundationdb";
|
|
|
|
inherit rev sha256;
|
|
|
|
};
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
nativeBuildInputs = [ gawk which m4 findutils mono58 ];
|
2018-07-02 12:02:23 +01:00
|
|
|
buildInputs = [ python openjdk libressl boost ];
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
patches =
|
2018-07-02 12:02:23 +01:00
|
|
|
[ # For 5.2+, we need a slightly adjusted patch to fix all the ldflags
|
|
|
|
(if lib.versionAtLeast version "5.2"
|
2018-07-20 23:50:08 +01:00
|
|
|
then (if lib.versionAtLeast version "6.0"
|
|
|
|
then ./ldflags-6.0.patch
|
|
|
|
else ./ldflags-5.2.patch)
|
2018-07-02 12:02:23 +01:00
|
|
|
else ./ldflags-5.1.patch)
|
|
|
|
] ++
|
|
|
|
# for 6.0+, we do NOT need to apply this version fix, since we can specify
|
|
|
|
# it ourselves. see configurePhase
|
|
|
|
(lib.optional (!lib.versionAtLeast version "6.0") ./fix-scm-version.patch);
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
postPatch = ''
|
2018-07-02 12:02:23 +01:00
|
|
|
# note: this does not do anything for 6.0+
|
2018-05-01 08:17:46 +01:00
|
|
|
substituteInPlace ./build/scver.mk \
|
|
|
|
--subst-var-by NIXOS_FDB_VERSION_ID "${rev}" \
|
|
|
|
--subst-var-by NIXOS_FDB_SCBRANCH "${branch}"
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
substituteInPlace ./Makefile \
|
|
|
|
--replace 'shell which ccache' 'shell true' \
|
|
|
|
--replace -Werror ""
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
substituteInPlace ./Makefile \
|
|
|
|
--replace libstdc++_pic libstdc++
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
substituteInPlace ./build/link-validate.sh \
|
|
|
|
--replace 'exit 1' '#exit 1'
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
patchShebangs .
|
2018-07-20 23:50:08 +01:00
|
|
|
'' + lib.optionalString (lib.versionAtLeast version "6.0") ''
|
|
|
|
substituteInPlace ./Makefile \
|
|
|
|
--replace 'TLS_LIBS +=' '#TLS_LIBS +=' \
|
|
|
|
--replace 'LDFLAGS :=' 'LDFLAGS := -ltls -lssl -lcrypto'
|
2018-05-01 08:17:46 +01:00
|
|
|
'';
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-07-27 00:43:45 +01:00
|
|
|
separateDebugInfo = true;
|
2018-05-01 08:17:46 +01:00
|
|
|
enableParallelBuilding = true;
|
2018-07-20 23:50:08 +01:00
|
|
|
|
2018-08-04 22:15:20 +01:00
|
|
|
makeFlags = [ "all" "fdb_java" "fdb_python" ]
|
2018-07-20 23:50:08 +01:00
|
|
|
# Don't compile FDBLibTLS if we don't need it in 6.0 or later;
|
|
|
|
# it gets statically linked in
|
|
|
|
++ lib.optional (!lib.versionAtLeast version "6.0") [ "fdb_c" ]
|
|
|
|
# Needed environment overrides
|
2018-07-27 00:43:45 +01:00
|
|
|
++ [ "KVRELEASE=1"
|
|
|
|
"NOSTRIP=1"
|
|
|
|
];
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-07-02 12:02:23 +01:00
|
|
|
# on 6.0 and later, we can specify all this information manually
|
|
|
|
configurePhase = lib.optionalString (lib.versionAtLeast version "6.0") ''
|
|
|
|
export SOURCE_CONTROL=GIT
|
|
|
|
export SCBRANCH="${branch}"
|
|
|
|
export VERSION_ID="${rev}"
|
|
|
|
'';
|
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
installPhase = ''
|
|
|
|
mkdir -vp $out/{bin,libexec/plugins} $lib/{lib,share/java} $dev/include/foundationdb
|
2018-08-04 22:15:20 +01:00
|
|
|
mkdir -vp $python/lib/${python.libPrefix}/site-packages
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-07-20 23:50:08 +01:00
|
|
|
'' + lib.optionalString (!lib.versionAtLeast version "6.0") ''
|
2018-08-04 22:15:20 +01:00
|
|
|
# we only copy the TLS library on < 6.0, since it's compiled-in otherwise
|
2018-05-01 08:17:46 +01:00
|
|
|
cp -v ./lib/libFDBLibTLS.so $out/libexec/plugins/FDBLibTLS.so
|
2018-07-20 23:50:08 +01:00
|
|
|
'' + ''
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-08-04 22:15:20 +01:00
|
|
|
# C API
|
|
|
|
cp -v ./lib/libfdb_c.so $lib/lib
|
2018-05-01 08:17:46 +01:00
|
|
|
cp -v ./bindings/c/foundationdb/fdb_c.h $dev/include/foundationdb
|
|
|
|
cp -v ./bindings/c/foundationdb/fdb_c_options.g.h $dev/include/foundationdb
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-08-04 22:15:20 +01:00
|
|
|
# java
|
2018-05-05 07:29:39 +01:00
|
|
|
cp -v ./bindings/java/foundationdb-client.jar $lib/share/java/fdb-java.jar
|
2018-05-01 05:35:12 +01:00
|
|
|
|
2018-08-04 22:15:20 +01:00
|
|
|
# python
|
|
|
|
rm -f ./bindings/python/fdb/*.pth # remove useless files
|
|
|
|
cp -R ./bindings/python/fdb $python/lib/${python.libPrefix}/site-packages/fdb
|
|
|
|
# symlink a copy of the shared object into place, so that impl.py can load it
|
|
|
|
ln -sv $lib/lib/libfdb_c.so $python/lib/${python.libPrefix}/site-packages/fdb/libfdb_c.so
|
|
|
|
|
|
|
|
# binaries
|
2018-05-01 08:17:46 +01:00
|
|
|
for x in fdbbackup fdbcli fdbserver fdbmonitor; do
|
|
|
|
cp -v "./bin/$x" $out/bin;
|
|
|
|
done
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
ln -sfv $out/bin/fdbbackup $out/bin/dr_agent
|
|
|
|
ln -sfv $out/bin/fdbbackup $out/bin/fdbrestore
|
|
|
|
ln -sfv $out/bin/fdbbackup $out/bin/fdbdr
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
ln -sfv $out/bin/fdbbackup $out/libexec/backup_agent
|
|
|
|
'';
|
2018-05-01 05:35:12 +01:00
|
|
|
|
2018-08-04 22:15:20 +01:00
|
|
|
outputs = [ "out" "lib" "dev" "python" ];
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Open source, distributed, transactional key-value store";
|
|
|
|
homepage = https://www.foundationdb.org;
|
|
|
|
license = licenses.asl20;
|
|
|
|
platforms = platforms.linux;
|
|
|
|
maintainers = with maintainers; [ thoughtpolice ];
|
|
|
|
};
|
|
|
|
};
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
in with builtins; {
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-07-02 12:02:23 +01:00
|
|
|
foundationdb51 = makeFdb rec {
|
2018-05-01 08:17:46 +01:00
|
|
|
version = "5.1.7";
|
|
|
|
branch = "release-5.1";
|
|
|
|
sha256 = "1rc472ih24f9s5g3xmnlp3v62w206ny0pvvw02bzpix2sdrpbp06";
|
|
|
|
};
|
|
|
|
|
|
|
|
foundationdb52 = makeFdb rec {
|
2018-08-04 15:42:44 +01:00
|
|
|
version = "5.2.8";
|
2018-07-02 12:02:23 +01:00
|
|
|
branch = "release-5.2";
|
2018-08-04 15:42:44 +01:00
|
|
|
sha256 = "1kbmmhk2m9486r4kyjlc7bb3wd50204i0p6dxcmvl6pbp1bs0wlb";
|
2018-05-01 08:17:46 +01:00
|
|
|
};
|
2018-04-20 12:35:35 +01:00
|
|
|
|
2018-05-01 08:17:46 +01:00
|
|
|
foundationdb60 = makeFdb rec {
|
2018-08-04 15:45:49 +01:00
|
|
|
version = "6.0.4pre2497_${substring 0 8 rev}";
|
2018-07-20 23:50:08 +01:00
|
|
|
branch = "release-6.0";
|
2018-08-04 15:45:49 +01:00
|
|
|
rev = "73d64cb244714c19bcc651122f6e7a9236aa11b5";
|
|
|
|
sha256 = "1jzmrf9kj0brqddlmxvzhj27r6843790jnqwkv1s3ri21fqb3hs7";
|
2018-04-20 12:35:35 +01:00
|
|
|
};
|
|
|
|
}
|