<commit_before>{ stdenv, fetchurl, cmake, python }:

stdenv.mkDerivation {
  name = "opencc-1.0.5";
  src = fetchurl {
    url = "https://github.com/BYVoid/OpenCC/archive/ver.1.0.5.tar.gz";
    sha256 = "1ce1649ba280cfc88bb76e740be5f54b29a9c034400c97a3ae211c37d7030705";
  };

  buildInputs = [ cmake python ];

  cmakeFlags = [
    "-DBUILD_SHARED_LIBS=OFF"
  ];

  meta = with stdenv.lib; {
    homepage = https://github.com/BYVoid/OpenCC;
    license = licenses.asl20;
    description = "A project for conversion between Traditional and Simplified Chinese";
    longDescription = ''
      Open Chinese Convert (OpenCC) is an opensource project for conversion between
      Traditional Chinese and Simplified Chinese, supporting character-level conversion,
      phrase-level conversion, variant conversion and regional idioms among Mainland China,
      Taiwan and Hong kong.
    '';
    maintainers = [ maintainers.mingchuan ];
    platforms = platforms.linux;
  };<commit_msg>opencc: build shared library and programs<commit_after>{ stdenv, fetchurl, cmake, python }:

stdenv.mkDerivation {
  name = "opencc-1.0.5";
  src = fetchurl {
    url = "https://github.com/BYVoid/OpenCC/archive/ver.1.0.5.tar.gz";
    sha256 = "1ce1649ba280cfc88bb76e740be5f54b29a9c034400c97a3ae211c37d7030705";
  };

  buildInputs = [ cmake python ];

  makeFlags = [
    # let intermediate tools find intermediate library
    "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$(CURDIR)/src"
  ];

  # Parallel building occasionaly fails with: Error copying file "/tmp/nix-build-opencc-1.0.5.drv-0/OpenCC-ver.1.0.5/build/src/libopencc.so.1.0.0" to "/tmp/nix-build-opencc-1.0.5.drv-0/OpenCC-ver.1.0.5/build/src/tools".
  enableParallelBuilding = false;

  meta = with stdenv.lib; {
    homepage = https://github.com/BYVoid/OpenCC;
    license = licenses.asl20;
    description = "A project for conversion between Traditional and Simplified Chinese";
    longDescription = ''
      Open Chinese Convert (OpenCC) is an opensource project for conversion between
      Traditional Chinese and Simplified Chinese, supporting character-level conversion,
      phrase-level conversion, variant conversion and regional idioms among Mainland China,
      Taiwan and Hong kong.
    '';
    maintainers = [ maintainers.mingchuan ];
    platforms = platforms.linux;
  };
{'fraction_non_alphanumeric': 0.10852713178294573, 'fraction_numerical': 0.05297157622739018, 'mean_word_length': 3.6274900398406373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1667650', 'n_tokens_mistral': 824, 'n_tokens_neox': 771, 'n_words': 172}