From 3042d6245baa46a8cc5d51a417613050cacb21d0 Mon Sep 17 00:00:00 2001 From: Pavel Sobolev Date: Tue, 26 Sep 2023 20:56:22 +0300 Subject: mecab: refactor --- pkgs/tools/text/mecab/base.nix | 19 ++++++++----------- pkgs/tools/text/mecab/default.nix | 28 ++++++++++++++-------------- pkgs/tools/text/mecab/ipadic.nix | 8 ++++---- pkgs/tools/text/mecab/nodic.nix | 7 +++---- 4 files changed, 29 insertions(+), 33 deletions(-) (limited to 'pkgs/tools/text') diff --git a/pkgs/tools/text/mecab/base.nix b/pkgs/tools/text/mecab/base.nix index 181eb405cbd..c44c899b82b 100644 --- a/pkgs/tools/text/mecab/base.nix +++ b/pkgs/tools/text/mecab/base.nix @@ -1,16 +1,13 @@ { fetchurl }: -{ - version = "0.996"; +finalAttrs: { + version = "0.996"; - src = fetchurl { - url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE"; - name = "mecab-0.996.tar.gz"; - sha256 = "0ncwlqxl1hdn1x4v4kr2sn1sbbcgnhdphp0lcvk74nqkhdbk4wz0"; - }; + src = fetchurl { + url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7cENtOXlicTFaRUE"; + name = "mecab-${finalAttrs.version}.tar.gz"; + hash = "sha256-4HMyV4MTW3LmZhRceBu0j62lg9UiT7JJD7bBQDumnFk="; + }; - buildPhase = '' - make - make check - ''; + doCheck = true; } diff --git a/pkgs/tools/text/mecab/default.nix b/pkgs/tools/text/mecab/default.nix index 04293d29efb..58396d2aa46 100644 --- a/pkgs/tools/text/mecab/default.nix +++ b/pkgs/tools/text/mecab/default.nix @@ -3,19 +3,19 @@ let mecab-base = import ./base.nix { inherit fetchurl; }; in -stdenv.mkDerivation (mecab-base // { - pname = "mecab"; - version = mecab-base.version; +stdenv.mkDerivation (finalAttrs: ((mecab-base finalAttrs) // { + pname = "mecab"; - postInstall = '' - sed -i 's|^dicdir = .*$|dicdir = ${mecab-ipadic}|' "$out/etc/mecabrc" - ''; + postInstall = '' + sed -i 's|^dicdir = .*$|dicdir = ${mecab-ipadic}|' "$out/etc/mecabrc" + ''; - meta = with lib; { - description = "Japanese morphological analysis system"; - homepage = "http://taku910.github.io/mecab/"; - license = licenses.bsd3; - platforms = platforms.unix; - maintainers = with maintainers; [ auntie ]; - }; -}) + meta = with lib; { + description = "Japanese morphological analysis system"; + homepage = "http://taku910.github.io/mecab"; + license = licenses.bsd3; + platforms = platforms.unix; + mainProgram = "mecab"; + maintainers = with maintainers; [ auntie paveloom ]; + }; +})) diff --git a/pkgs/tools/text/mecab/ipadic.nix b/pkgs/tools/text/mecab/ipadic.nix index 026e385e7c2..654d4928ee5 100644 --- a/pkgs/tools/text/mecab/ipadic.nix +++ b/pkgs/tools/text/mecab/ipadic.nix @@ -1,13 +1,13 @@ { stdenv, fetchurl, mecab-nodic }: -stdenv.mkDerivation { +stdenv.mkDerivation (finalAttrs: { pname = "mecab-ipadic"; version = "2.7.0-20070801"; src = fetchurl { url = "https://drive.google.com/uc?export=download&id=0B4y35FiV1wh7MWVlSDBCSXZMTXM"; - name = "mecab-ipadic-2.7.0-20070801.tar.gz"; - sha256 = "08rmkvj0f0x6jq0axrjw2y5nam0mavv6x77dp9v4al0wi1ym4bxn"; + name = "mecab-ipadic-${finalAttrs.version}.tar.gz"; + hash = "sha256-ti9SfYgcUEV2uu2cbvZWFVRlixdc5q4AlqYDB+SeNSM="; }; buildInputs = [ mecab-nodic ]; @@ -15,4 +15,4 @@ stdenv.mkDerivation { configurePhase = '' ./configure --with-dicdir="$out" ''; -} +}) diff --git a/pkgs/tools/text/mecab/nodic.nix b/pkgs/tools/text/mecab/nodic.nix index be9003623e0..5e33b09db14 100644 --- a/pkgs/tools/text/mecab/nodic.nix +++ b/pkgs/tools/text/mecab/nodic.nix @@ -3,7 +3,6 @@ let mecab-base = import ./base.nix { inherit fetchurl; }; in -stdenv.mkDerivation (mecab-base // { - pname = "mecab-nodic"; - version = mecab-base.version; -}) +stdenv.mkDerivation (finalAttrs: ((mecab-base finalAttrs) // { + pname = "mecab-nodic"; +})) -- cgit 1.4.1 From a5d66a9fab1074ad16edeabe8b275f48d3be842c Mon Sep 17 00:00:00 2001 From: Pavel Sobolev Date: Tue, 26 Sep 2023 21:02:51 +0300 Subject: mecab: add support for the UTF-8 charset --- pkgs/tools/text/mecab/base.nix | 4 ++++ pkgs/tools/text/mecab/ipadic.nix | 7 ++++--- 2 files changed, 8 insertions(+), 3 deletions(-) (limited to 'pkgs/tools/text') diff --git a/pkgs/tools/text/mecab/base.nix b/pkgs/tools/text/mecab/base.nix index c44c899b82b..d52d4e90773 100644 --- a/pkgs/tools/text/mecab/base.nix +++ b/pkgs/tools/text/mecab/base.nix @@ -9,5 +9,9 @@ finalAttrs: { hash = "sha256-4HMyV4MTW3LmZhRceBu0j62lg9UiT7JJD7bBQDumnFk="; }; + configureFlags = [ + "--with-charset=utf8" + ]; + doCheck = true; } diff --git a/pkgs/tools/text/mecab/ipadic.nix b/pkgs/tools/text/mecab/ipadic.nix index 654d4928ee5..61d23f87a8c 100644 --- a/pkgs/tools/text/mecab/ipadic.nix +++ b/pkgs/tools/text/mecab/ipadic.nix @@ -12,7 +12,8 @@ stdenv.mkDerivation (finalAttrs: { buildInputs = [ mecab-nodic ]; - configurePhase = '' - ./configure --with-dicdir="$out" - ''; + configureFlags = [ + "--with-charset=utf8" + "--with-dicdir=${placeholder "out"}" + ]; }) -- cgit 1.4.1