<commit_before>{ stdenv, fetchurl, fetchFromGitHub
, which, findutils, m4, gawk
, python, openjdk, mono58, libressl_2_6
, boost16x
}:

let
  makeFdb =
    { version
    , branch
    , rev, sha256

    # fdb 6.0+ support boost 1.6x+, so default to it
    , boost ? boost16x
    }: stdenv.mkDerivation rec {
        name = "foundationdb-${version}";
        inherit version;

        src = fetchFromGitHub {
          owner = "apple";
          repo  = "foundationdb";
          inherit rev sha256;
        };

        nativeBuildInputs = [ gawk which m4 findutils mono58 ];
        buildInputs = [ python openjdk libressl_2_6 boost ];

        patches =
          [ ./fix-scm-version.patch
            ./ldflags.patch
          ];

        postPatch = ''
          substituteInPlace ./build/scver.mk \
            --subst-var-by NIXOS_FDB_VERSION_ID "${rev}" \
            --subst-var-by NIXOS_FDB_SCBRANCH   "${branch}"

          substituteInPlace ./Makefile \
            --replace 'shell which ccache' 'shell true' \
            --replace -Werror ""

          substituteInPlace ./Makefile \
            --replace libstdc++_pic libstdc++

          substituteInPlace ./build/link-validate.sh \
            --replace 'exit 1' '#exit 1'

          patchShebangs .
        '';

        enableParallelBuilding = true;
        makeFlags = [ "all" "fdb_c" "fdb_java" "KVRELEASE=1" ];

        configurePhase = ":";
        installPhase = ''
          mkdir -vp $out/{bin,libexec/plugins} $lib/{lib,share/java} $dev/include/foundationdb

          cp -v ./lib/libfdb_c.so     $lib/lib
          cp -v ./lib/libfdb_java.so  $lib/lib

          cp -v ./lib/libFDBLibTLS.so $out/libexec/plugins/FDBLibTLS.so

          cp -v ./bindings/c/foundationdb/fdb_c.h           $dev/include/foundationdb
          cp -v ./bindings/c/foundationdb/fdb_c_options.g.h $dev/include/foundationdb

          cp -v ./bindings/java/foundationdb-client.jar     $lib/share/java

          for x in fdbbackup fdbcli fdbserver fdbmonitor; do
            cp -v "./bin/$x" $out/bin;
          done

          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

          ln -sfv $out/bin/fdbbackup $out/libexec/backup_agent
        '';

        outputs = [ "out" "lib" "dev" ];

        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 ];
       };
    };

  # hysterical raisins dictate a version of boost this old. however,
  # we luckily do not need to build anything, we just need the header<commit_msg>foundationdb: rename jar file to match upstream<commit_after>{ stdenv, fetchurl, fetchFromGitHub
, which, findutils, m4, gawk
, python, openjdk, mono58, libressl_2_6
, boost16x
}:

let
  makeFdb =
    { version
    , branch
    , rev, sha256

    # fdb 6.0+ support boost 1.6x+, so default to it
    , boost ? boost16x
    }: stdenv.mkDerivation rec {
        name = "foundationdb-${version}";
        inherit version;

        src = fetchFromGitHub {
          owner = "apple";
          repo  = "foundationdb";
          inherit rev sha256;
        };

        nativeBuildInputs = [ gawk which m4 findutils mono58 ];
        buildInputs = [ python openjdk libressl_2_6 boost ];

        patches =
          [ ./fix-scm-version.patch
            ./ldflags.patch
          ];

        postPatch = ''
          substituteInPlace ./build/scver.mk \
            --subst-var-by NIXOS_FDB_VERSION_ID "${rev}" \
            --subst-var-by NIXOS_FDB_SCBRANCH   "${branch}"

          substituteInPlace ./Makefile \
            --replace 'shell which ccache' 'shell true' \
            --replace -Werror ""

          substituteInPlace ./Makefile \
            --replace libstdc++_pic libstdc++

          substituteInPlace ./build/link-validate.sh \
            --replace 'exit 1' '#exit 1'

          patchShebangs .
        '';

        enableParallelBuilding = true;
        makeFlags = [ "all" "fdb_c" "fdb_java" "KVRELEASE=1" ];

        configurePhase = ":";
        installPhase = ''
          mkdir -vp $out/{bin,libexec/plugins} $lib/{lib,share/java} $dev/include/foundationdb

          cp -v ./lib/libfdb_c.so     $lib/lib
          cp -v ./lib/libFDBLibTLS.so $out/libexec/plugins/FDBLibTLS.so

          cp -v ./bindings/c/foundationdb/fdb_c.h           $dev/include/foundationdb
          cp -v ./bindings/c/foundationdb/fdb_c_options.g.h $dev/include/foundationdb

          cp -v ./bindings/java/foundationdb-client.jar     $lib/share/java/fdb-java.jar

          for x in fdbbackup fdbcli fdbserver fdbmonitor; do
            cp -v "./bin/$x" $out/bin;
          done

          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

          ln -sfv $out/bin/fdbbackup $out/libexec/backup_agent
        '';

        outputs = [ "out" "lib" "dev" ];

        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 ];
       };
    };

  # hysterical raisins dictate a version of boost this old. however,
  # we luckily do not need to build anything, we just need the header
{'fraction_non_alphanumeric': 0.11530990641003001, 'fraction_numerical': 0.010241921243157337, 'mean_word_length': 1.834834834834835, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '233706', 'n_tokens_mistral': 1890, 'n_tokens_neox': 1810, 'n_words': 411}