1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 python3,
7 opencc,
8 rapidjson,
9 gitUpdater,
10}:
11
12stdenv.mkDerivation rec {
13 pname = "opencc";
14 version = "1.1.9";
15
16 src = fetchFromGitHub {
17 owner = "BYVoid";
18 repo = "OpenCC";
19 rev = "ver.${version}";
20 sha256 = "sha256-JBTegQs9ALp4LdKKYMNp9GYEgqR9O8IkX6LqatvaTic=";
21 };
22
23 nativeBuildInputs = [
24 cmake
25 python3
26 ]
27 ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
28 opencc # opencc_dict
29 ];
30
31 buildInputs = [
32 rapidjson
33 ];
34
35 # TODO use more system dependencies
36 cmakeFlags = [
37 (lib.cmakeBool "USE_SYSTEM_RAPIDJSON" true)
38 ];
39
40 passthru = {
41 updateScript = gitUpdater { rev-prefix = "ver."; };
42 };
43
44 meta = with lib; {
45 homepage = "https://github.com/BYVoid/OpenCC";
46 license = licenses.asl20;
47 description = "Project for conversion between Traditional and Simplified Chinese";
48 longDescription = ''
49 Open Chinese Convert (OpenCC) is an opensource project for conversion between
50 Traditional Chinese and Simplified Chinese, supporting character-level conversion,
51 phrase-level conversion, variant conversion and regional idioms among Mainland China,
52 Taiwan and Hong kong.
53 '';
54 maintainers = with maintainers; [ sifmelcara ];
55 platforms = with platforms; linux ++ darwin;
56 };
57}