<commit_before>{ stdenv, fetchFromGitHub, cmake, zlib, netcdf, nifticlib, hdf5 }:

stdenv.mkDerivation rec {
  pname = "libminc";
  name  = "${pname}-2018-01-17";

  owner = "BIC-MNI";

  # current master is significantly ahead of most recent release, so use Git version:
  src = fetchFromGitHub {
    inherit owner;
    repo   = pname;
    rev    = "a9cbe1353eae9791b7d5b03af16e0f86922ce40b";
    sha256 = "0mn4n3ihzcr1jw2g1vy6c8p4lkc88jwljk04argmj7k4djrgpxpa";
  };

  nativeBuildInputs = [ cmake ];
  buildInputs = [ zlib netcdf nifticlib hdf5 ];

  cmakeFlags = [ "-DBUILD_TESTING=${if doCheck then "TRUE" else "FALSE"}"
                 "-DLIBMINC_MINC1_SUPPORT=TRUE"
                 "-DLIBMINC_BUILD_SHARED_LIBS=TRUE"
                 "-DLIBMINC_USE_SYSTEM_NIFTI=TRUE" ];


  checkPhase = ''
    export LD_LIBRARY_PATH="$(pwd)"  # see #22060
    ctest -E 'ezminc_rw_test|minc_conversion' --output-on-failure
    # ezminc_rw_test can't find libminc_io.so.5.2.0; minc_conversion hits netcdf compilation issue
  '';
  doCheck = true;

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    homepage = "https://github.com/${owner}/${pname}";
    description = "Medical imaging library based on HDF5";
    maintainers = with maintainers; [ bcdarwin ];
    platforms = platforms.unix;
    license   = licenses.free;
  };<commit_msg>libminc: cleanup tests<commit_after>{ stdenv, fetchFromGitHub, cmake, zlib, netcdf, nifticlib, hdf5 }:

stdenv.mkDerivation rec {
  pname = "libminc";
  name  = "${pname}-2018-01-17";

  owner = "BIC-MNI";

  # current master is significantly ahead of most recent release, so use Git version:
  src = fetchFromGitHub {
    inherit owner;
    repo   = pname;
    rev    = "a9cbe1353eae9791b7d5b03af16e0f86922ce40b";
    sha256 = "0mn4n3ihzcr1jw2g1vy6c8p4lkc88jwljk04argmj7k4djrgpxpa";
  };

  postPatch = ''
    patchShebangs .
  '';

  nativeBuildInputs = [ cmake ];
  buildInputs = [ zlib netcdf nifticlib hdf5 ];

  cmakeFlags = [
    "-DBUILD_TESTING=${if doCheck then "ON" else "OFF"}"
    "-DLIBMINC_MINC1_SUPPORT=ON"
    "-DLIBMINC_BUILD_SHARED_LIBS=ON"
    "-DLIBMINC_USE_SYSTEM_NIFTI=ON"
  ];

  doCheck = stdenv.buildPlatform == stdenv.hostPlatform;
  checkPhase = ''
    export LD_LIBRARY_PATH="$(pwd)"  # see #22060
    ctest -E 'ezminc_rw_test|minc_conversion' --output-on-failure
    # ezminc_rw_test can't find libminc_io.so.5.2.0; minc_conversion hits netcdf compilation issue
  '';

  enableParallelBuilding = true;

  meta = with stdenv.lib; {
    homepage = "https://github.com/${owner}/${pname}";
    description = "Medical imaging library based on HDF5";
    maintainers = with maintainers; [ bcdarwin ];
    platforms = platforms.unix;
    license   = licenses.free;
  };
{'fraction_non_alphanumeric': 0.11842105263157894, 'fraction_numerical': 0.0445906432748538, 'mean_word_length': 3.5239669421487605, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2004022', 'n_tokens_mistral': 1126, 'n_tokens_neox': 1052, 'n_words': 201}