From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id ZLnkCM9Cw2IwhgAAbAwnHQ (envelope-from ) for ; Mon, 04 Jul 2022 21:43:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id ECi7B89Cw2IsFAAAauVa8A (envelope-from ) for ; Mon, 04 Jul 2022 21:43:11 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9F9C9EE4F for ; Mon, 4 Jul 2022 21:43:10 +0200 (CEST) Received: from localhost ([::1]:42380 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o8RyP-0000QS-Qi for larch@yhetil.org; Mon, 04 Jul 2022 15:43:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:44128) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o8RyI-0000No-EW for guix-patches@gnu.org; Mon, 04 Jul 2022 15:43:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54793) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o8RyI-0007P5-5k for guix-patches@gnu.org; Mon, 04 Jul 2022 15:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1o8RyI-0007rz-4Q for guix-patches@gnu.org; Mon, 04 Jul 2022 15:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#56386] [PATCH 1/3] gnu: Add mecab. References: <20220704210911.699b4697@sybil.lepiller.eu> In-Reply-To: <20220704210911.699b4697@sybil.lepiller.eu> Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 04 Jul 2022 19:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 56386 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 56386@debbugs.gnu.org Received: via spool by 56386-submit@debbugs.gnu.org id=B56386.165696375030197 (code B ref 56386); Mon, 04 Jul 2022 19:43:02 +0000 Received: (at 56386) by debbugs.gnu.org; 4 Jul 2022 19:42:30 +0000 Received: from localhost ([127.0.0.1]:48687 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o8Rxg-0007qn-0X for submit@debbugs.gnu.org; Mon, 04 Jul 2022 15:42:30 -0400 Received: from lepiller.eu ([89.234.186.109]:42872) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1o8RxZ-0007qI-9C for 56386@debbugs.gnu.org; Mon, 04 Jul 2022 15:42:22 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 4663012b for <56386@debbugs.gnu.org>; Mon, 4 Jul 2022 19:42:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=from:to :subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=dkim; bh=48aO4dvjfqaBnCWsMcTAX54LI x+MwOiBbW2jkfqqGOY=; b=dPcYDucOQ8gQliv2bQGwg0ZMuc3KmyKbdP545lSlh gtwEw8mds7RCTHQmncoS1sSe69K4WSTKgkHx/mXEBU3RCNQsEvFu5vmxy0Cyesjv bMc64Kt8OrwbpuiVkVowJ3o+dDNm14Fil6GWHl0eOD6b0RCn5eHEwbhkigqYyzh0 j2T1wJAUNdg8ETCkfg244mbNndY9fTYKQfV9MpPrWc85lABAe/QPcFCY0ILFoBm/ qyOv5v1k4U9bN/OI4j/0k8a1MTcBBBy+iTwWqpsf7DyDO7LeEAOoeaHVccAMccJv z91w5npqFHa7HjPBPZiD4DUkFIxOXeB7W3PGTy+IQo5RQ== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 4273e627 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO) for <56386@debbugs.gnu.org>; Mon, 4 Jul 2022 19:42:14 +0000 (UTC) From: Julien Lepiller Date: Mon, 4 Jul 2022 21:42:00 +0200 Message-Id: <20220704194202.30958-1-julien@lepiller.eu> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1656963790; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=eZU0yMqeD7N3gwo8KyQDZTgiUiOrae08tCfl88daQdc=; b=PL6BQUXof3amWjoDXOoxNP2iD/qr+GrLreyyP7F4WeAaKih5WMElMUKWipirtcqqxWPp/2 T+yqyOPT9zFxxJqJMqg2MupG8FD7n5JrcTQyesCOPPPgU7UdEQbIUuHgmK++an3V+0IHQh QjECixIaUOQ0pk3LdvEf2yjzHx9tecx3adsIHRMoGsGWxD4wWd3R2vsS23JM5iiCeW1maJ SAXqGCTud36xVsrf9hghs+yUU+ZqDldaUQtaNS4ugcIa7U8qPfKOYht+WINxUy1+9JdUmS fdtwi9kE1XxSN0k5WejWN8xN4PyJrUSfpBVWvJ0Ik2zgQ6p5Ew2CwiL8DoNJ6Q== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1656963790; a=rsa-sha256; cv=none; b=diIV6X4Qz4Z1GSWLm1iJzGaMkDpWsUuPzcR6/6U2/quAmOMLlPmntt3v7an/YK1c3ZBuzF mUuOB/VP4G3mv0uidSyQvp/dMCBCf1QgEGAjaZCIJ3M1cqium1SEAnMCZ6UdMg0Az+7ec0 3U8Zj4pRCGZPHZsaQaNwxPVDoB4okC2GbSEij4Mal857ii6OAzyNq9OUiXgTLOaEm3TYj8 8xKXF1J2LO+yP5sZjlYfWYh3oykLv0I0XQlqE6T5J5Yc//rduraNPBZ5pS62zfO7rZiuZI YDYeS+fSiOFhNmVXF6+3Z4wKWhVrSdNS8J+zu7FQFknx4LzEOECy3pVg7DAy6A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=dPcYDucO; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 6.75 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=dPcYDucO; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9F9C9EE4F X-Spam-Score: 6.75 X-Migadu-Scanner: scn0.migadu.com X-TUID: MpnKnmEfCyle * gnu/packages/language.scm (mecab): New variable. * gnu/packages/patches/mecab-variable-param.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. --- gnu/local.mk | 1 + gnu/packages/language.scm | 51 ++++++++++++++++++- .../patches/mecab-variable-param.patch | 30 +++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/mecab-variable-param.patch diff --git a/gnu/local.mk b/gnu/local.mk index faad6cc6b2..87fe75082c 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1490,6 +1490,7 @@ dist_patch_DATA = \ %D%/packages/patches/libmemcached-build-with-gcc7.patch \ %D%/packages/patches/libmhash-hmac-fix-uaf.patch \ %D%/packages/patches/libsigrokdecode-python3.9-fix.patch \ + %D%/packages/patches/mecab-variable-param.patch \ %D%/packages/patches/mercurial-hg-extension-path.patch \ %D%/packages/patches/mesa-opencl-all-targets.patch \ %D%/packages/patches/mesa-skip-tests.patch \ diff --git a/gnu/packages/language.scm b/gnu/packages/language.scm index 61c9e682ed..3ffe115b51 100644 --- a/gnu/packages/language.scm +++ b/gnu/packages/language.scm @@ -4,7 +4,7 @@ ;;; Copyright © 2018 Nikita ;;; Copyright © 2019 Alex Vong ;;; Copyright © 2020 Ricardo Wurmus -;;; Copyright © 2020 Julien Lepiller +;;; Copyright © 2020, 2022 Julien Lepiller ;;; ;;; This file is part of GNU Guix. ;;; @@ -921,3 +921,52 @@ (define-public praat analysis (pitch, formant, intensity, ...), speech synthesis, labelling, segmenting and manipulation.") (license license:gpl2+))) + +(define-public mecab + (package + (name "mecab") + (version "0.996") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/taku910/mecab") + ;; latest commit + (commit "046fa78b2ed56fbd4fac312040f6d62fc1bc31e3"))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1hdv7rgn8j0ym9gsbigydwrbxa8cx2fb0qngg1ya15vvbw0lk4aa")) + (patches + (search-patches + "mecab-variable-param.patch")))) + (build-system gnu-build-system) + (native-search-paths + (list (search-path-specification + (variable "MECAB_DICDIR") + (separator #f) + (files '("lib/mecab/dic"))))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ + (chdir "mecab"))) + (add-before 'build 'add-mecab-dicdir-variable + (lambda _ + (substitute* "mecabrc.in" + (("dicdir = .*") + "dicdir = $MECAB_DICDIR")) + (substitute* "mecab-config.in" + (("echo @libdir@/mecab/dic") + "if [ -z \"$MECAB_DICDIR\" ]; then + echo @libdir@/mecab/dic +else + echo \"$MECAB_DICDIR\" +fi"))))))) + (inputs (list libiconv)) + (home-page "https://taku910.github.io/mecab") + (synopsis "Morphological analysis engine for texts") + (description "Mecab is a morphological analysis engine developped as a +collaboration between the Kyoto university and Nippon Telegraph and Telephone +Corporation. The engine is independent of any language, dictionary or corpus.") + (license (list license:gpl2+ license:lgpl2.1+ license:bsd-3)))) diff --git a/gnu/packages/patches/mecab-variable-param.patch b/gnu/packages/patches/mecab-variable-param.patch new file mode 100644 index 0000000000..4457cf3f44 --- /dev/null +++ b/gnu/packages/patches/mecab-variable-param.patch @@ -0,0 +1,30 @@ +From 2396e90056706ef897acab3aaa081289c7336483 Mon Sep 17 00:00:00 2001 +From: LEPILLER Julien +Date: Fri, 19 Apr 2019 11:48:39 +0200 +Subject: [PATCH] Allow variable parameters + +--- + mecab/src/param.cpp | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/mecab/src/param.cpp b/mecab/src/param.cpp +index 65328a2..006b1b5 100644 +--- a/mecab/src/param.cpp ++++ b/mecab/src/param.cpp +@@ -79,8 +79,12 @@ bool Param::load(const char *filename) { + size_t s1, s2; + for (s1 = pos+1; s1 < line.size() && isspace(line[s1]); s1++); + for (s2 = pos-1; static_cast(s2) >= 0 && isspace(line[s2]); s2--); +- const std::string value = line.substr(s1, line.size() - s1); ++ std::string value = line.substr(s1, line.size() - s1); + const std::string key = line.substr(0, s2 + 1); ++ ++ if(value.find('$') == 0) { ++ value = std::getenv(value.substr(1).c_str()); ++ } + set(key.c_str(), value, false); + } + +-- +2.20.1 + -- 2.36.1