<commit_before>{ lib, stdenv, fetchFromGitHub
, talloc
, pkg-config
, libarchive
, git
, ncurses
, docutils, swig, python3, coreutils, enablePython ? true }:

stdenv.mkDerivation rec {
  pname = "proot";
  version = "5.3.0";

  src = fetchFromGitHub {
    repo = "proot";
    owner = "proot-me";
    rev = "v${version}";
    sha256 = "sha256-89d1a5QBusra0vd3Ph0lQalXrblBwogi6bNgvvpQL+Q=";
  };

  postPatch = ''
    substituteInPlace src/GNUmakefile \
      --replace /bin/echo ${coreutils}/bin/echo
    # our cross machinery defines $CC and co just right
    sed -i /CROSS_COMPILE/d src/GNUmakefile
  '';

  buildInputs = [ ncurses libarchive talloc ] ++ lib.optional enablePython python3;
  nativeBuildInputs = [ pkg-config docutils ] ++ lib.optional enablePython swig;

  enableParallelBuilding = true;

  makeFlags = [ "-C src" ];

  postBuild = ''
    make -C doc proot/man.1
  '';

  installFlags = [ "PREFIX=${placeholder "out"}" ];

  postInstall = ''
    install -Dm644 doc/proot/man.1 $out/share/man/man1/proot.1
  '';

  # proot provides tests with `make -C test` however they do not run in the sandbox<commit_msg>proot: 5.3.0 -> 5.3.1, drop libarchive dependency (#183747)<commit_after>{ lib, stdenv, fetchFromGitHub
, talloc
, pkg-config
, git
, ncurses
, docutils, swig, python3, coreutils, enablePython ? true }:

stdenv.mkDerivation rec {
  pname = "proot";
  version = "5.3.1";

  src = fetchFromGitHub {
    repo = "proot";
    owner = "proot-me";
    rev = "v${version}";
    sha256 = "sha256-uN31wDJjuQmDWeHaZ<KEY>Q/TYeS9HNYWEC0shaA=";
  };

  postPatch = ''
    substituteInPlace src/GNUmakefile \
      --replace /bin/echo ${coreutils}/bin/echo
    # our cross machinery defines $CC and co just right
    sed -i /CROSS_COMPILE/d src/GNUmakefile
  '';

  buildInputs = [ ncurses talloc ] ++ lib.optional enablePython python3;
  nativeBuildInputs = [ pkg-config docutils ] ++ lib.optional enablePython swig;

  enableParallelBuilding = true;

  makeFlags = [ "-C src" ];

  postBuild = ''
    make -C doc proot/man.1
  '';

  installFlags = [ "PREFIX=${placeholder "out"}" ];

  postInstall = ''
    install -Dm644 doc/proot/man.1 $out/share/man/man1/proot.1
  '';

  # proot provides tests with `make -C test` however they do not run in the sandbox
{'fraction_non_alphanumeric': 0.13486117232260908, 'fraction_numerical': 0.026443367122080213, 'mean_word_length': 3.291115311909263, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '2630239', 'n_tokens_mistral': 877, 'n_tokens_neox': 827, 'n_words': 195}