2020-01-18 15:41:59 +00:00
|
|
|
{ gcc6Stdenv, stdenv, gccStdenv, llvmPackages
|
foundationdb: rework python bindings, build system
FoundationDB uses Python at build time for some code generation.
However, it also has the official python bindings inside the source code
too, and the code for the Python bindings has some of it auto-generated
at compile time.
This made building python packages unattractive: we want to use the
source code generated from the FoundationDB build, but we don't want to
rebuild it. Previously we would override the 'python' input to the
FoundationDB module, but this meant we would do a complete rebuild, as
it was a necessary build time dependency, even though the resulting
generated code itself would not change. Furthermore, FoundationDB
versions < 6.0 don't properly support Python 3 *for the build system*,
though the bindings supported it, so that caused build failures. But the
first effect is the worst: it meant building separate python2 and
python3 packages implied two complete rebuilds of a single FoundationDB
version. This meant rather than 3 FDB builds, we'd do 3*N where N = the
number of major Python versions we support.
Finally, because we did not use pip to generate a wheel that we install
with metadata recorded for the installation, the FoundationDB python
package couldn't be used as an input to other setup.py-based packages:
there would be no recorded metadata in the dist-info folder which would
say this is the foundationdb package. This greatly limits its utility.
To fix all this, we do a few things:
- Apply some patches to fix the build system with Python 3.x for
older FoundationDB versions. (This is nice if end-users have
overridden the global Python version for some reason.)
- Move python directly into nativeBuildInputs, so it is only a
build time dependency.
- Take the python source code from the ./bindings directory and
tar it up use later after the build is done, so we get to keep
the generated code. This is the new 'pythonsrc' output from the
build. This code doesn't change based on whether or not the input
or resulting package is using Python 2 or 3, it's totally
deterministic.
- The build system also patches up the python source code a little,
so it can be installed directly with setup.py (it needs a little
stuff that it normally expects the build system to do.)
- Rework the python package to a separate file that uses
buildPythonPackage directly. Because the source code is already
prepared, it needs almost nothing else. Furthermore, this kills
the override itself for the foundationdb package, meaning rebuilds
are no longer needed.
- This package is very simple and just uses foundationdb.pythonsrc
as its source input. It also ensures a link to libfdb_c.so can
be found by ctypes (using substituteInPlace)
- python-packages.nix now just uses callPackage directly.
The net effect of this is, most importantly, that python packages do not
imply a full rebuild of the server source code: building python2 and
python3 packages from a version of FoundationDB now does not need to
override the foundationdb python input, reducing the number of needless
builds. They instead just run setup.py with the given version as input.
The second biggest effect is that wheel metadata is recorded correctly,
meaning dependent-python-packages that want to use the FoundationDB
bindings e.g. from PyPi should now work fine with buildPythonPackage.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2018-11-15 23:03:31 +00:00
|
|
|
, lib, fetchurl, fetchpatch, fetchFromGitHub
|
2018-07-02 11:02:23 +00:00
|
|
|
|
2019-05-03 02:44:11 +00:00
|
|
|
, cmake, ninja, which, findutils, m4, gawk
|
|
|
|
, python, python3, openjdk, mono, libressl, boost
|
2019-05-03 00:46:55 +00:00
|
|
|
}@args:
|
2018-04-20 11:35:35 +00:00
|
|
|
|
|
|
|
let
|
2019-05-12 18:21:41 +00:00
|
|
|
vsmakeBuild = import ./vsmake.nix args;
|
2019-05-03 02:44:11 +00:00
|
|
|
cmakeBuild = import ./cmake.nix (args // {
|
2019-10-29 20:26:20 +00:00
|
|
|
gccStdenv = gccStdenv;
|
|
|
|
llvmPackages = llvmPackages;
|
2019-05-03 02:44:11 +00:00
|
|
|
});
|
2019-05-12 18:21:41 +00:00
|
|
|
|
|
|
|
python3-six-patch = fetchpatch {
|
|
|
|
name = "update-python-six.patch";
|
|
|
|
url = "https://github.com/apple/foundationdb/commit/4bd9efc4fc74917bc04b07a84eb065070ea7edb2.patch";
|
|
|
|
sha256 = "030679lmc86f1wzqqyvxnwjyfrhh54pdql20ab3iifqpp9i5mi85";
|
|
|
|
};
|
|
|
|
|
|
|
|
python3-print-patch = fetchpatch {
|
|
|
|
name = "import-for-python-print.patch";
|
|
|
|
url = "https://github.com/apple/foundationdb/commit/ded17c6cd667f39699cf663c0e87fe01e996c153.patch";
|
|
|
|
sha256 = "11y434w68cpk7shs2r22hyrpcrqi8vx02cw7v5x79qxvnmdxv2an";
|
|
|
|
};
|
|
|
|
|
2020-01-23 08:33:34 +00:00
|
|
|
glibc230-fix = fetchpatch {
|
|
|
|
url = "https://github.com/Ma27/foundationdb/commit/e133cb974b9a9e4e1dc2d4ac15881d31225c0197.patch";
|
|
|
|
sha256 = "1v9q2fyc73msigcykjnbmfig45zcrkrzcg87b0r6mxpnby8iryl1";
|
|
|
|
};
|
|
|
|
|
2018-05-01 07:17:46 +00:00
|
|
|
in with builtins; {
|
2019-05-03 02:44:11 +00:00
|
|
|
|
|
|
|
# Older versions use the bespoke 'vsmake' build system
|
|
|
|
# ------------------------------------------------------
|
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
foundationdb51 = vsmakeBuild {
|
2018-05-01 07:17:46 +00:00
|
|
|
version = "5.1.7";
|
|
|
|
branch = "release-5.1";
|
|
|
|
sha256 = "1rc472ih24f9s5g3xmnlp3v62w206ny0pvvw02bzpix2sdrpbp06";
|
2019-05-12 18:21:41 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./patches/ldflags-5.1.patch
|
|
|
|
./patches/fix-scm-version.patch
|
2020-01-18 15:41:59 +00:00
|
|
|
./patches/gcc-fixes.patch
|
2019-05-12 18:21:41 +00:00
|
|
|
python3-six-patch
|
|
|
|
python3-print-patch
|
|
|
|
];
|
2018-05-01 07:17:46 +00:00
|
|
|
};
|
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
foundationdb52 = vsmakeBuild {
|
2018-08-04 14:42:44 +00:00
|
|
|
version = "5.2.8";
|
2018-07-02 11:02:23 +00:00
|
|
|
branch = "release-5.2";
|
2018-08-04 14:42:44 +00:00
|
|
|
sha256 = "1kbmmhk2m9486r4kyjlc7bb3wd50204i0p6dxcmvl6pbp1bs0wlb";
|
2019-05-12 18:21:41 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./patches/ldflags-5.2.patch
|
|
|
|
./patches/fix-scm-version.patch
|
2020-01-18 15:41:59 +00:00
|
|
|
./patches/gcc-fixes.patch
|
2019-05-12 18:21:41 +00:00
|
|
|
python3-six-patch
|
|
|
|
python3-print-patch
|
|
|
|
];
|
2018-05-01 07:17:46 +00:00
|
|
|
};
|
2018-04-20 11:35:35 +00:00
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
foundationdb60 = vsmakeBuild {
|
2019-02-13 04:59:45 +00:00
|
|
|
version = "6.0.18";
|
2018-07-20 22:50:08 +00:00
|
|
|
branch = "release-6.0";
|
2019-02-13 04:59:45 +00:00
|
|
|
sha256 = "0q1mscailad0z7zf1nypv4g7gx3damfp45nf8nzyq47nsw5gz69p";
|
2019-05-12 18:21:41 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./patches/ldflags-6.0.patch
|
|
|
|
];
|
2018-04-20 11:35:35 +00:00
|
|
|
};
|
2019-05-03 02:44:11 +00:00
|
|
|
|
|
|
|
# 6.1 and later versions should always use CMake
|
|
|
|
# ------------------------------------------------------
|
|
|
|
|
2019-08-13 21:52:01 +00:00
|
|
|
foundationdb61 = cmakeBuild {
|
2019-10-29 19:58:59 +00:00
|
|
|
version = "6.1.12";
|
2019-05-03 02:44:11 +00:00
|
|
|
branch = "release-6.1";
|
2019-10-29 19:58:59 +00:00
|
|
|
sha256 = "1yh5hx6rim41m0dwhnb2pcwz67wlnk0zwvyw845d36b29gwy58ab";
|
2019-05-03 02:44:11 +00:00
|
|
|
|
|
|
|
patches = [
|
|
|
|
./patches/clang-libcxx.patch
|
|
|
|
./patches/suppress-clang-warnings.patch
|
2020-01-23 08:33:34 +00:00
|
|
|
glibc230-fix
|
2019-05-03 02:44:11 +00:00
|
|
|
];
|
|
|
|
};
|
|
|
|
|
2018-04-20 11:35:35 +00:00
|
|
|
}
|