<commit_before>{ stdenv, lib, makeWrapper, fetchurl, curl, sasl, openssh, autoconf
, automake115x, libtool, unzip, gnutar, jdk, maven, python, wrapPython
, setuptools, boto, pythonProtobuf, apr, subversion, gzip, systemd
, leveldb, glog, perf, utillinux, libnl, iproute, openssl, libevent
, ethtool, coreutils, which, iptables
, bash
}:

let
  mavenRepo = import ./mesos-deps.nix { inherit stdenv curl; };
  soext = if stdenv.system == "x86_64-darwin" then "dylib" else "so";
  # `tar -z` requires gzip on $PATH, so wrap tar.
  # At some point, we should try to patch mesos so we add gzip to the PATH when
  # tar is invoked. I think that only needs to be done here:
  #   src/common/command_utils.cpp
  # https://github.com/NixOS/nixpkgs/issues/13783
  tarWithGzip = lib.overrideDerivation gnutar (oldAttrs: {
    buildInputs = (oldAttrs.buildInputs or []) ++ [ makeWrapper ];
    postInstall = (oldAttrs.postInstall or "") + ''
      wrapProgram $out/bin/tar --prefix PATH ":" "${gzip}/bin"
    '';
  });

in stdenv.mkDerivation rec {
  version = "1.1.0";
  name = "mesos-${version}";

  enableParallelBuilding = true;
  dontDisableStatic = true;

  src = fetchurl {
    url = "mirror://apache/mesos/${version}/${name}.tar.gz";
    sha256 = "1hdjd4syyp88l0bnh88bhzvn9466ad2ysfp9pq3kwj3qzwg5jv8g";
  };

  patches = [
    # https://reviews.apache.org/r/36610/
    # TODO: is this still needed?
    ./rb36610.patch

    # see https://github.com/cstrahan/mesos/tree/nixos-${version}
    ./nixos.patch
  ];

  buildInputs = [
    makeWrapper autoconf automake115x libtool curl sasl jdk maven
    python wrapPython boto setuptools leveldb
    subversion apr glog openssl libevent
  ] ++ lib.optionals stdenv.isLinux [
    libnl
  ];

  propagatedBuildInputs = [
    pythonProtobuf
  ];

  # note that we *must* statically link libprotobuf.
  # if we dynamically link the lib, we get these errors:
  # https://github.com/NixOS/nixpkgs/pull/19064#issuecomment-255082684
  preConfigure = ''
    # https://issues.apache.org/jira/browse/MESOS-6616
    configureFlagsArray+=(
      "CXXFLAGS=-O2 -Wno-error=strict-aliasing"<commit_msg>mesos: 1.1.0 -> 1.1.1<commit_after>{ stdenv, lib, makeWrapper, fetchurl, curl, sasl, openssh, autoconf
, automake115x, libtool, unzip, gnutar, jdk, maven, python, wrapPython
, setuptools, boto, pythonProtobuf, apr, subversion, gzip, systemd
, leveldb, glog, perf, utillinux, libnl, iproute, openssl, libevent
, ethtool, coreutils, which, iptables
, bash
}:

let
  mavenRepo = import ./mesos-deps.nix { inherit stdenv curl; };
  soext = if stdenv.system == "x86_64-darwin" then "dylib" else "so";
  # `tar -z` requires gzip on $PATH, so wrap tar.
  # At some point, we should try to patch mesos so we add gzip to the PATH when
  # tar is invoked. I think that only needs to be done here:
  #   src/common/command_utils.cpp
  # https://github.com/NixOS/nixpkgs/issues/13783
  tarWithGzip = lib.overrideDerivation gnutar (oldAttrs: {
    buildInputs = (oldAttrs.buildInputs or []) ++ [ makeWrapper ];
    postInstall = (oldAttrs.postInstall or "") + ''
      wrapProgram $out/bin/tar --prefix PATH ":" "${gzip}/bin"
    '';
  });

in stdenv.mkDerivation rec {
  version = "1.1.1";
  name = "mesos-${version}";

  enableParallelBuilding = true;
  dontDisableStatic = true;

  src = fetchurl {
    url = "mirror://apache/mesos/${version}/${name}.tar.gz";
    sha256 = "0f46ebb130d2d4a9732f95d0a71d80c8c5967f3c172b110f2ece316e05922115";
  };

  patches = [
    # https://reviews.apache.org/r/36610/
    # TODO: is this still needed?
    ./rb36610.patch

    # see https://github.com/cstrahan/mesos/tree/nixos-${version}
    ./nixos.patch
  ];

  buildInputs = [
    makeWrapper autoconf automake115x libtool curl sasl jdk maven
    python wrapPython boto setuptools leveldb
    subversion apr glog openssl libevent
  ] ++ lib.optionals stdenv.isLinux [
    libnl
  ];

  propagatedBuildInputs = [
    pythonProtobuf
  ];

  # note that we *must* statically link libprotobuf.
  # if we dynamically link the lib, we get these errors:
  # https://github.com/NixOS/nixpkgs/pull/19064#issuecomment-255082684
  preConfigure = ''
    # https://issues.apache.org/jira/browse/MESOS-6616
    configureFlagsArray+=(
      "CXXFLAGS=-O2 -Wno-error=strict-aliasing"
{'fraction_non_alphanumeric': 0.1275749063670412, 'fraction_numerical': 0.03885767790262172, 'mean_word_length': 3.5216931216931218, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 10, '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': '975915', 'n_tokens_mistral': 1679, 'n_tokens_neox': 1566, 'n_words': 367}