2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv, fetchFromGitHub, cmake, python }:
|
2016-11-08 19:29:43 +01:00
|
|
|
|
2020-02-08 23:12:17 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "opencc";
|
2020-04-12 20:47:14 +02:00
|
|
|
version = "1.0.6";
|
2020-02-08 23:12:17 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "BYVoid";
|
|
|
|
repo = "OpenCC";
|
|
|
|
rev = "ver.${version}";
|
2020-04-12 20:47:14 +02:00
|
|
|
sha256 = "1ygj2ygxsva72hs6cm0a6wdd2rp71k4nm0pd7cb20y2srdlzvdqk";
|
2016-11-08 19:29:43 +01:00
|
|
|
};
|
|
|
|
|
2020-02-08 23:12:17 +01:00
|
|
|
nativeBuildInputs = [ cmake python ];
|
2016-11-08 19:29:43 +01:00
|
|
|
|
2020-02-08 23:12:17 +01:00
|
|
|
# let intermediate tools find intermediate library
|
2021-01-15 10:19:50 +01:00
|
|
|
preBuild = lib.optionalString stdenv.isLinux ''
|
2020-02-03 16:44:25 +01:00
|
|
|
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH''${LD_LIBRARY_PATH:+:}$(pwd)/src
|
2021-01-15 10:19:50 +01:00
|
|
|
'' + lib.optionalString stdenv.isDarwin ''
|
2020-02-08 23:12:17 +01:00
|
|
|
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH''${DYLD_LIBRARY_PATH:+:}$(pwd)/src
|
2020-02-03 16:44:25 +01:00
|
|
|
'';
|
2016-11-08 19:29:43 +01:00
|
|
|
|
2017-09-12 16:47:33 +02:00
|
|
|
# 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;
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-02-08 23:12:17 +01:00
|
|
|
homepage = "https://github.com/BYVoid/OpenCC";
|
2016-11-08 19:29:43 +01:00
|
|
|
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.
|
|
|
|
'';
|
2020-02-08 23:12:17 +01:00
|
|
|
maintainers = with maintainers; [ sifmelcara ];
|
|
|
|
platforms = with platforms; linux ++ darwin;
|
2016-11-08 19:29:43 +01:00
|
|
|
};
|
|
|
|
}
|