(define-module (packages mecab) #:use-module (guix packages) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix build-system gnu) #:use-module (gnu packages) #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages guile) #:use-module (gnu packages guile-xyz) #:use-module (gnu packages pkg-config)) (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)))) (define-public mecab-ipadic (package (name "mecab-ipadic") (version "2.7.0") (source (package-source mecab)) (build-system gnu-build-system) (arguments `(#:configure-flags (list (string-append "--with-dicdir=" (assoc-ref %outputs "out") "/lib/mecab/dic") "--with-charset=utf8") #:phases (modify-phases %standard-phases (add-after 'unpack 'chdir (lambda _ (chdir "mecab-ipadic"))) (add-before 'configure 'set-mecab-dir (lambda* (#:key outputs #:allow-other-keys) (setenv "MECAB_DICDIR" (string-append (assoc-ref outputs "out") "/lib/mecab/dic"))))))) (native-inputs (list mecab)); for mecab-config (home-page "https://taku910.github.io/mecab") (synopsis "Dictionary data for MeCab") (description "This package contains dictionnary data derived from ipadic for use with MeCab.") (license (license:non-copyleft "mecab-ipadic/COPYING")))) (define-public guile-mecab (package (name "guile-mecab") (version "0") (source (origin (method git-fetch) (uri (git-reference (url "https://git.lepiller.eu/git/guile-mecab") (commit "a0cc754316ba84cb5fbf617795e7b28316442f82"))) (file-name (git-file-name name version)) (sha256 (base32 "0q9kb7yli7vvdd9y4xzaxdv654dr65f6gwjpc6qwb7q01npmjf5n")))) (build-system gnu-build-system) (arguments `(#:phases (modify-phases %standard-phases (add-after 'unpack 'set-writable (lambda _ (for-each (lambda (file) (chmod file #o644)) (find-files "." ".")))) (add-after 'set-writable 'clean (lambda _ (when (file-exists? "Makefile") (invoke "make" "distclean"))))))) (inputs `(("mecab" ,mecab))) (propagated-inputs `(("guile-bytestructures" ,guile-bytestructures))) (native-inputs `(("autoconf" ,autoconf) ("automake" ,automake) ("guile" ,guile-3.0) ("pkg-config" ,pkg-config))) (home-page "") (synopsis "") (description "") (license license:gpl3+)))