unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#62968] [PATCH] Add skktools.
@ 2023-04-20 14:06 gemmaro
  2023-05-29 22:14 ` bug#62968: " Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: gemmaro @ 2023-04-20 14:06 UTC (permalink / raw)
  To: 62968; +Cc: gemmaro

Hello,

This patch adds skktools, which are SKK dictionary maintenance tools.

Some notes about this patch:

* skktools has skkdic-* programs and a number of scripts.
* Some scripts were excluded from the installation target because they
  are not available on modern systems.
* To install Emacs Lisp file, emacs-build-system is partially used
  with reference to the guile-wisp package definition [1].

I submitted this package to the Guix-jp channel ([2], thanks ROCKTAKEY
for review!), and I thought it would be nice to have it on the
official channel too.

1: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/guile-xyz.scm?id=f3424ada316a9962818b60ae22236efce8bd9fb7#n2107
2: https://gitlab.com/guix-jp/channel/-/merge_requests/8

Regards,
gemmaro.

* gnu/packages/language.scm (skktools): New variable.
---
 gnu/packages/language.scm | 157 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 157 insertions(+)

diff --git a/gnu/packages/language.scm b/gnu/packages/language.scm
index 208fab4f5b..c53efd2fa0 100644
--- a/gnu/packages/language.scm
+++ b/gnu/packages/language.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2020 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2020, 2022 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2022 Milran <milranmike@protonmail.com>
+;;; Copyright © 2023 gemmaro <gemmaro.dev@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -29,6 +30,7 @@ (define-module (gnu packages language)
   #:use-module (gnu packages audio)
   #:use-module (gnu packages base)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages dbm)
   #:use-module (gnu packages docbook)
   #:use-module (gnu packages emacs)
   #:use-module (gnu packages freedesktop)
@@ -49,6 +51,8 @@ (define-module (gnu packages language)
   #:use-module (gnu packages python)
   #:use-module (gnu packages perl-check)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages ruby)
+  #:use-module (gnu packages scheme)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages swig)
@@ -931,6 +935,159 @@ (define-public libskk
      "libskk is a library to deal with Japanese kana-to-kanji conversion method.")
     (license license:gpl3+)))
 
+(define-public skktools
+  (package
+    (name "skktools")
+    (version "1.3.4")
+    (source (origin
+              (method git-fetch)
+              (uri (git-reference
+                    (url "https://github.com/skk-dev/skktools")
+                    (commit (string-append "skktools-"
+                                           (string-replace-substring version
+                                                                     "." "_")))))
+              (file-name (git-file-name name version))
+              (sha256
+               (base32
+                "1zway8jsm18279xq8zlpr84iqiw373x3v0ysay74n9bjqxbl234a"))
+              (modules '((guix build utils)))
+              (snippet '(begin
+                          ;; Maybe requires jgawk
+                          (delete-file "unannotation.awk")
+                          (delete-file "convert2skk/edict2skk.awk")
+                          (delete-file "convert2skk/wnn2skk.awk")
+                          (delete-file "convert2skk/wnn2skk.sed") ;Used with wnn2skk.awk
+                          (delete-file "convert2skk/wnn2skk.sh") ;Depends on 2 files above
+                          ;; Requires jperl
+                          (delete-file "convert2skk/alpha-kana.pl")
+                          (delete-file "convert2skk/atok2skk.pl")
+                          (delete-file "convert2skk/read.me") ;Readme for jperl scripts
+                          (delete-file "convert2skk/wx2skk.pl")
+                          (delete-file-recursively "dbm")
+                          ;; Needs a lot requirements
+                          (delete-file "convert2skk/doc2skk.sh")
+                          ;; Obsolete scripts
+                          (delete-file-recursively "convert2skk/obsolete")
+                          ;; Contains syntax error
+                          (delete-file "convert2skk/pubdic2list")))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:test-target "test"
+       #:modules ((guix build gnu-build-system)
+                  ((guix build emacs-build-system)
+                   #:prefix emacs:)
+                  (guix build utils)
+                  (guix build emacs-utils))
+       #:imported-modules (,@%gnu-build-system-modules
+                           (guix build emacs-build-system)
+                           (guix build emacs-utils))
+       #:phases (modify-phases %standard-phases
+                  (add-before 'install 'fix-library-loading
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (for-each (lambda (path)
+                                  (substitute* path
+                                    (("require 'skkdictools'")
+                                     "require_relative 'skkdictools'")))
+                                (list "filters/annotation-filter.rb"
+                                      "filters/asayaKe.rb"
+                                      "filters/complete-numerative.rb"
+                                      "filters/conjugation.rb"
+                                      "filters/make-tankan-dic.rb"))))
+                  (add-after 'install 'install-scripts
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((share (string-append (assoc-ref outputs "out")
+                                                  "/share/skktools")))
+                        (install-file "filters/skkdictools.rb" share)
+                        (for-each (lambda (file)
+                                    (invoke "chmod" "755" file)
+                                    (install-file file share))
+                                  (append (find-files "." "\\.rb$")
+                                          (find-files "." "\\.scm$")
+                                          (find-files "." "\\.py$")
+                                          (find-files "convert2skk" "\\.pl")
+                                          (find-files "convert2skk" "\\.rb")
+                                          (list "convert2skk/adddummy"
+                                                "convert2skk/list2skk"
+                                                "convert2skk/removedummy"
+                                                "convert2skk/skk2list")
+                                          (find-files "filters" "\\.rb$"))))))
+                  ;; Install and make autoloads for skk-xml.el.
+                  (add-after 'install 'install-emacs-files
+                    (assoc-ref emacs:%standard-phases
+                               'install))
+                  (add-after 'install-emacs-files 'compile-emacs-files
+                    (assoc-ref emacs:%standard-phases
+                               'build))
+                  (add-after 'compile-emacs-files 'make-autoloads
+                    (assoc-ref emacs:%standard-phases
+                               'make-autoloads))
+                  (add-after 'install 'install-docs
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((doc (string-append (assoc-ref outputs "out")
+                                                "/share/doc/"
+                                                ,name "-"
+                                                ,version)))
+                        (install-file "ChangeLog" doc)
+                        (for-each (lambda (file)
+                                    (install-file file doc))
+                                  (append (find-files "READMEs")))
+                        (copy-file "filters/README.md"
+                                   (string-append doc "/README.filters.md"))
+                        (copy-file "convert2skk/README.md"
+                                   (string-append doc "/README.convert2skk.md")))))
+                  (add-after 'wrap-scripts 'check-scripts
+                    ;; Skipped tests for:
+                    ;; * skk2cdb.py: Requires cdb file
+                    (lambda* (#:key outputs #:allow-other-keys)
+                      (let ((out (string-append (assoc-ref outputs "out")
+                                                "/share/skktools")))
+                        (for-each (lambda (args)
+                                    (apply invoke
+                                           (string-append out "/"
+                                                          (car args))
+                                           (cdr args)))
+                                  '(("abbrev-convert.rb")
+                                    ("abbrev-simplify-keys.rb")
+                                    ("adddummy")
+                                    ("annotation-filter.rb")
+                                    ("aozora2skk.rb")
+                                    ("asayaKe.rb")
+                                    ("canna2skk.rb" "/dev/null")
+                                    ("chasen2skk.rb")
+                                    ("complete-numerative.rb")
+                                    ("conjugation.rb")
+                                    ("ctdicconv.rb")
+                                    ("dic-it2skk.rb" "/dev/null")
+                                    ("ipadic2skk.rb")
+                                    ("list2skk")
+                                    ("make-tankan-dic.rb")
+                                    ("prime2skk.rb")
+                                    ("removedummy")
+                                    ("saihenkan.rb")
+                                    ("skk2list")
+                                    ("/skkdic-diff.scm" "/dev/null"
+                                     "/dev/null")
+                                    ("skk-wordpicker.rb")))))))))
+    (native-inputs (list
+                    ;; for skkdic-expr2
+                    pkg-config
+                    ;; for installing Emacs Lisp files
+                    emacs-minimal))
+    (inputs (list bdb-4.8
+                  glib ;for skkdic-expr2
+                  ;; For scripts
+                  gauche
+                  perl
+                  python-2
+                  ruby))
+    (home-page "https://github.com/skk-dev/skktools")
+    (synopsis "SKK dictionary maintenance tools")
+    (description
+     "The skktools are SKK dictionary maintenance tools.  Note that the
+scripts are located under the share directory, while there might be
+some missing interpreters and might not work.")
+    (license license:gpl2)))
+
 (define-public mecab
   (package
     (name "mecab")

base-commit: 61d15695752997427ed9c3491470dd76b11bd00a
-- 
2.39.2





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#62968: [PATCH] Add skktools.
  2023-04-20 14:06 [bug#62968] [PATCH] Add skktools gemmaro
@ 2023-05-29 22:14 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2023-05-29 22:14 UTC (permalink / raw)
  To: gemmaro; +Cc: 62968-done

[-- Attachment #1: Type: text/plain, Size: 1111 bytes --]

Hi,

gemmaro <gemmaro.dev@gmail.com> skribis:

> Hello,
>
> This patch adds skktools, which are SKK dictionary maintenance tools.
>
> Some notes about this patch:
>
> * skktools has skkdic-* programs and a number of scripts.
> * Some scripts were excluded from the installation target because they
>   are not available on modern systems.
> * To install Emacs Lisp file, emacs-build-system is partially used
>   with reference to the guile-wisp package definition [1].
>
> I submitted this package to the Guix-jp channel ([2], thanks ROCKTAKEY
> for review!), and I thought it would be nice to have it on the
> official channel too.
>
> 1: https://git.savannah.gnu.org/cgit/guix.git/tree/gnu/packages/guile-xyz.scm?id=f3424ada316a9962818b60ae22236efce8bd9fb7#n2107
> 2: https://gitlab.com/guix-jp/channel/-/merge_requests/8
>
> Regards,
> gemmaro.
>
> * gnu/packages/language.scm (skktools): New variable.

Sorry for the long delay.  Applied the changes below (license is ‘gpl2+’
because source file headers explicitly say “or any later version”).

Thanks!

Ludo’.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 795 bytes --]

diff --git a/gnu/packages/language.scm b/gnu/packages/language.scm
index 004a2df289..27a6ebf329 100644
--- a/gnu/packages/language.scm
+++ b/gnu/packages/language.scm
@@ -1070,10 +1070,10 @@ (define-public skktools
     (home-page "https://github.com/skk-dev/skktools")
     (synopsis "SKK dictionary maintenance tools")
     (description
-     "The skktools are SKK dictionary maintenance tools.  Note that the
-scripts are located under the share directory, while there might be
-some missing interpreters and might not work.")
-    (license license:gpl2)))
+     "The skktools are SKK dictionary maintenance tools.  This includes
+commands such as @command{skkdic-count}, @command{skkdic-expr}, and
+@command{skkdic-sort}.")
+    (license license:gpl2+)))
 
 (define-public mecab
   (package

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-05-29 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-20 14:06 [bug#62968] [PATCH] Add skktools gemmaro
2023-05-29 22:14 ` bug#62968: " Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).