<commit_before>{ stdenv, fetchFromGitHub, cmake, fetchpatch, staticOnly ? false }:

# ?TODO: there's also python lib in there

stdenv.mkDerivation rec {
  pname = "brotli";
  version = "1.0.7";

  src = fetchFromGitHub {
    owner = "google";
    repo = "brotli";
    rev = "v" + version;
    sha256 = "1811b55wdfg4kbsjcgh1kc938g118jpvif97ilgrmbls25dfpvvw";
  };

  nativeBuildInputs = [ cmake ];

  patches = stdenv.lib.optional staticOnly (fetchpatch {
    # from https://github.com/google/brotli/pull/655
    url = "https://github.com/google/brotli/commit/7289e5a378ba13801996a84d89d8fe95c3fc4c11.patch";
    sha256 = "1bghbdvj24jrvb0sqfdif9vwg7wx6pn8dvl6flkrcjkhpj0gi0jg";
  });

  cmakeFlags = []
    ++ stdenv.lib.optional staticOnly "-DBUILD_SHARED_LIBS=OFF";

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

  doCheck = true;

  checkTarget = "test";

  # This breaks on Darwin because our cmake hook tries to make a build folder
  # and the wonderful bazel BUILD file is already there (yay case-insensitivity?)
  prePatch = "rm BUILD";

  # Don't bother with "man" output for now,
  # it currently only makes the manpages hard to use.
  postInstall = ''
    mkdir -p $out/share/man/man{1,3}
    cp ../docs/*.1 $out/share/man/man1/<commit_msg>brotli: 1.0.7 -> 1.0.9 (PR #100436)<commit_after>{ stdenv, fetchFromGitHub, cmake, fetchpatch, staticOnly ? false }:

# ?TODO: there's also python lib in there

stdenv.mkDerivation rec {
  pname = "brotli";
  version = "1.0.9";

  src = fetchFromGitHub {
    owner = "google";
    repo = "brotli";
    rev = "v" + version;
    sha256 = "z6Dhrabav1MDQ4rAcXaDv0aN+qOoh9cvoXZqEWBB13c=";
  };

  nativeBuildInputs = [ cmake ];

  patches = stdenv.lib.optional staticOnly (fetchpatch {
    # from https://github.com/google/brotli/pull/655
    url = "https://github.com/google/brotli/commit/7289e5a378ba13801996a84d89d8fe95c3fc4c11.patch";
    sha256 = "1bghbdvj24jrvb0sqfdif9vwg7wx6pn8dvl6flkrcjkhpj0gi0jg";
  });

  cmakeFlags = []
    ++ stdenv.lib.optional staticOnly "-DBUILD_SHARED_LIBS=OFF";

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

  doCheck = true;

  checkTarget = "test";

  # This breaks on Darwin because our cmake hook tries to make a build folder
  # and the wonderful bazel BUILD file is already there (yay case-insensitivity?)
  prePatch = ''
      rm BUILD

      # Upstream fixed this reference to runtime-path after the release
      # and with this references g++ complains about invalid option -R
      sed -i 's/ -R''${libdir}//' scripts/libbrotli*.pc.in
      cat scripts/libbrotli*.pc.in
    '';

  # Don't bother with "man" output for now,
  # it currently only makes the manpages hard to use.
  postInstall = ''
    mkdir -p $out/share/man/man{1,3}
    cp ../docs/*.1 $out/share/man/man1/
{'fraction_non_alphanumeric': 0.1260932944606414, 'fraction_numerical': 0.05284256559766764, 'mean_word_length': 3.420289855072464, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, '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': '4428641', 'n_tokens_mistral': 1140, 'n_tokens_neox': 1046, 'n_words': 241}