<commit_before>{ lib, stdenv, fetchurl, apfel, apfelgrid, applgrid, blas, gfortran, lhapdf, lapack, libyaml, lynx
, mela, root5, qcdnum, which, libtirpc
}:

stdenv.mkDerivation rec {
  pname = "xfitter";
  version = "2.0.1";

  src = fetchurl {
    name = "${pname}-${version}.tgz";
    url = "https://www.xfitter.org/xFitter/xFitter/DownloadPage?action=AttachFile&do=get&target=${pname}-${version}.tgz";
    sha256 = "0kmgc67nw5flp92yw5x6l2vsnhwsfi5z2a20404anisdgdjs8zc6";
  };

  patches = [
    ./undefined_behavior.patch
  ];

  # patch needs to updated due to version bump
  #CXXFLAGS = "-Werror=return-type";

  preConfigure =
  # Fix F77LD to workaround for a following build error:
  #
  #   gfortran: error: unrecognized command line option '-stdlib=libc++'
  #
    lib.optionalString stdenv.isDarwin ''
      substituteInPlace src/Makefile.in \
        --replace "F77LD = \$(F77)" "F77LD = \$(CXXLD)" \
    '';

  configureFlags = [
    "--enable-apfel"
    "--enable-apfelgrid"
    "--enable-applgrid"
    "--enable-mela"
    "--enable-lhapdf"
  ];

  nativeBuildInputs = [ gfortran which ];
  buildInputs =
    [ apfel apfelgrid applgrid blas lhapdf lapack mela root5 qcdnum ]
    # pdf2yaml requires fmemopen and open_memstream which are not readily available on Darwin
    ++ lib.optional (!stdenv.isDarwin) libyaml
    ++ lib.optional (stdenv.hostPlatform.libc == "glibc") libtirpc
    ;
  propagatedBuildInputs = [ lynx ];

  enableParallelBuilding = true;

  hardeningDisable = [ "format" ];

  NIX_CFLAGS_COMPILE = lib.optional (stdenv.hostPlatform.libc == "glibc") "-I${libtirpc.dev}/include/tirpc";
  NIX_LDFLAGS = lib.optional (stdenv.hostPlatform.libc == "glibc") "-ltirpc";

  meta = with lib; {
    description = "The xFitter project is an open source QCD fit framework ready to extract PDFs and assess the impact of new data";
    license     = licenses.gpl3;
    homepage    = "https://www.xfitter.org/xFitter";
    platforms   = platforms.unix;
    maintainers = with maintainers; [ veprbl ];
  };
}<commit_msg>xfitter: remove `hardeningDisable = [ "format" ];`<commit_after>{ lib, stdenv, fetchurl, apfel, apfelgrid, applgrid, blas, gfortran, lhapdf, lapack, libyaml, lynx
, mela, root5, qcdnum, which, libtirpc
}:

stdenv.mkDerivation rec {
  pname = "xfitter";
  version = "2.0.1";

  src = fetchurl {
    name = "${pname}-${version}.tgz";
    url = "https://www.xfitter.org/xFitter/xFitter/DownloadPage?action=AttachFile&do=get&target=${pname}-${version}.tgz";
    sha256 = "0kmgc67nw5flp92yw5x6l2vsnhwsfi5z2a20404anisdgdjs8zc6";
  };

  patches = [
    ./undefined_behavior.patch
  ];

  preConfigure =
  # Fix F77LD to workaround for a following build error:
  #
  #   gfortran: error: unrecognized command line option '-stdlib=libc++'
  #
    lib.optionalString stdenv.isDarwin ''
      substituteInPlace src/Makefile.in \
        --replace "F77LD = \$(F77)" "F77LD = \$(CXXLD)" \
    '';

  configureFlags = [
    "--enable-apfel"
    "--enable-apfelgrid"
    "--enable-applgrid"
    "--enable-mela"
    "--enable-lhapdf"
  ];

  nativeBuildInputs = [ gfortran which ];
  buildInputs =
    [ apfel apfelgrid applgrid blas lhapdf lapack mela root5 qcdnum ]
    # pdf2yaml requires fmemopen and open_memstream which are not readily available on Darwin
    ++ lib.optional (!stdenv.isDarwin) libyaml
    ++ lib.optional (stdenv.hostPlatform.libc == "glibc") libtirpc
    ;
  propagatedBuildInputs = [ lynx ];

  enableParallelBuilding = true;

  NIX_CFLAGS_COMPILE = lib.optional (stdenv.hostPlatform.libc == "glibc") "-I${libtirpc.dev}/include/tirpc";
  NIX_LDFLAGS = lib.optional (stdenv.hostPlatform.libc == "glibc") "-ltirpc";

  meta = with lib; {
    description = "The xFitter project is an open source QCD fit framework ready to extract PDFs and assess the impact of new data";
    license     = licenses.gpl3;
    homepage    = "https://www.xfitter.org/xFitter";
    platforms   = platforms.unix;
    maintainers = with maintainers; [ veprbl ];
  };
}
{'fraction_non_alphanumeric': 0.13376753507014028, 'fraction_numerical': 0.018036072144288578, 'mean_word_length': 3.466442953020134, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1212380', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1425, 'n_words': 310}