diff --git a/pkgs/servers/foundationdb/default.nix b/pkgs/servers/foundationdb/default.nix index f6a6329adb5..b9b091f8476 100644 --- a/pkgs/servers/foundationdb/default.nix +++ b/pkgs/servers/foundationdb/default.nix @@ -6,23 +6,54 @@ }@args: let - vsmake = import ./vsmake.nix args; + vsmakeBuild = import ./vsmake.nix args; + + 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"; + }; + in with builtins; { - foundationdb51 = vsmake rec { + foundationdb51 = vsmakeBuild rec { version = "5.1.7"; branch = "release-5.1"; sha256 = "1rc472ih24f9s5g3xmnlp3v62w206ny0pvvw02bzpix2sdrpbp06"; + + patches = [ + ./patches/ldflags-5.1.patch + ./patches/fix-scm-version.patch + python3-six-patch + python3-print-patch + ]; }; - foundationdb52 = vsmake rec { + foundationdb52 = vsmakeBuild rec { version = "5.2.8"; branch = "release-5.2"; sha256 = "1kbmmhk2m9486r4kyjlc7bb3wd50204i0p6dxcmvl6pbp1bs0wlb"; + + patches = [ + ./patches/ldflags-5.2.patch + ./patches/fix-scm-version.patch + python3-six-patch + python3-print-patch + ]; }; - foundationdb60 = vsmake rec { + foundationdb60 = vsmakeBuild rec { version = "6.0.18"; branch = "release-6.0"; sha256 = "0q1mscailad0z7zf1nypv4g7gx3damfp45nf8nzyq47nsw5gz69p"; + + patches = [ + ./patches/ldflags-6.0.patch + ]; }; } diff --git a/pkgs/servers/foundationdb/fix-scm-version.patch b/pkgs/servers/foundationdb/patches/fix-scm-version.patch similarity index 100% rename from pkgs/servers/foundationdb/fix-scm-version.patch rename to pkgs/servers/foundationdb/patches/fix-scm-version.patch diff --git a/pkgs/servers/foundationdb/ldflags-5.1.patch b/pkgs/servers/foundationdb/patches/ldflags-5.1.patch similarity index 100% rename from pkgs/servers/foundationdb/ldflags-5.1.patch rename to pkgs/servers/foundationdb/patches/ldflags-5.1.patch diff --git a/pkgs/servers/foundationdb/ldflags-5.2.patch b/pkgs/servers/foundationdb/patches/ldflags-5.2.patch similarity index 100% rename from pkgs/servers/foundationdb/ldflags-5.2.patch rename to pkgs/servers/foundationdb/patches/ldflags-5.2.patch diff --git a/pkgs/servers/foundationdb/ldflags-6.0.patch b/pkgs/servers/foundationdb/patches/ldflags-6.0.patch similarity index 100% rename from pkgs/servers/foundationdb/ldflags-6.0.patch rename to pkgs/servers/foundationdb/patches/ldflags-6.0.patch diff --git a/pkgs/servers/foundationdb/vsmake.nix b/pkgs/servers/foundationdb/vsmake.nix index c782e0e9831..a834f04a086 100644 --- a/pkgs/servers/foundationdb/vsmake.nix +++ b/pkgs/servers/foundationdb/vsmake.nix @@ -1,8 +1,7 @@ # This builder is for FoundationDB's original, somewhat strange visual studio + # make build system. In FoundationDB 6.1 and later, there's a new CMake system # (which will eventually become the default version.) -{ stdenv49 -, lib, fetchurl, fetchpatch, fetchFromGitHub +{ stdenv49, lib, fetchurl, fetchFromGitHub , which, findutils, m4, gawk , python, openjdk, mono, libressl @@ -43,6 +42,8 @@ let # if an release is unofficial/a prerelease, then make sure this is set , officialRelease ? true + + , patches ? [] }: stdenv.mkDerivation rec { name = "foundationdb-${version}"; inherit version; @@ -56,32 +57,7 @@ let nativeBuildInputs = [ python openjdk gawk which m4 findutils mono ]; buildInputs = [ libressl boost ]; - patches = - [ # For 5.2+, we need a slightly adjusted patch to fix all the ldflags - (if lib.versionAtLeast version "5.2" - then (if lib.versionAtLeast version "6.0" - then ./ldflags-6.0.patch - else ./ldflags-5.2.patch) - 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) - # Versions less than 6.0 have a busted Python 3 build due to an outdated - # use of 'print'. Also apply an update to the six module with many bugfixes, - # which is in 6.0+ as well - ++ (lib.optional (!lib.versionAtLeast version "6.0") (fetchpatch { - name = "update-python-six.patch"; - url = "https://github.com/apple/foundationdb/commit/4bd9efc4fc74917bc04b07a84eb065070ea7edb2.patch"; - sha256 = "030679lmc86f1wzqqyvxnwjyfrhh54pdql20ab3iifqpp9i5mi85"; - })) - ++ (lib.optional (!lib.versionAtLeast version "6.0") (fetchpatch { - name = "import-for-python-print.patch"; - url = "https://github.com/apple/foundationdb/commit/ded17c6cd667f39699cf663c0e87fe01e996c153.patch"; - sha256 = "11y434w68cpk7shs2r22hyrpcrqi8vx02cw7v5x79qxvnmdxv2an"; - })) - ; - + inherit patches; postPatch = '' # note: this does not do anything for 6.0+ substituteInPlace ./build/scver.mk \