diff mbox series

[bug#48570,WIP] Add

Message ID 87v97ct5ii.fsf@guixSD.i-did-not-set--mail-host-address--so-tickle-me
State New
Headers show
Series [bug#48570,WIP] Add | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Nicolò Balzarotti May 21, 2021, 4:29 p.m. UTC
Hi!

I created a package for tagainijisho and its dependency (kanjivg).

I marked this as WIP because I have a few doubts:
- kanjivg distributes an xml file generated by joining xml files stored
  in the repo.  I'm not sure where this xml should be installed
  (under /share/something?)
- kanjivg: guix lint fails with: updater 'github' failed to find
  upstream releases, but I don't know why
- two other xml required by tagainijisho use non-versioned urls, is
  there something we can do about this?

It's the first time I use this program but it seems to be working ok.

Thanks,
Nicolò
diff mbox series

Patch

From aff1c570b2885f5c36810f5faddedd801ad55f0e Mon Sep 17 00:00:00 2001
From: nixo <nicolo@nixo.xyz>
Date: Fri, 21 May 2021 18:15:38 +0200
Subject: [PATCH 2/2] gnu: Add tagainijisho.

* gnu/packages/education.scm (tagainijisho): New variable.
---
 gnu/packages/education.scm | 94 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

diff --git a/gnu/packages/education.scm b/gnu/packages/education.scm
index 043933abe0..cd28e35b78 100644
--- a/gnu/packages/education.scm
+++ b/gnu/packages/education.scm
@@ -449,6 +449,100 @@  Using KanjiVG, it is possible to create stroke order diagrams or animations
 and kanji dictionaries.")
     (home-page "https://kanjivg.tagaini.net")
     (license license:cc-by-sa3.0)))
+
+(define-public tagainijisho
+  ;; latest release (1.0.3) requires qt4, using latest commit
+  (let ((commit "18078719be75b6b49cffb2f8a22978c635c6b617"))
+    (package
+      (name "tagainijisho")
+      (version (string-append "1.0.3." (string-take commit 7)))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/Gnurou/tagainijisho")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1i6vcj30q0427ggdjqrsyqb9dg8b8kd0vzmjdzrxabn9wv05vnz4"))))
+      (build-system qt-build-system)
+      (arguments
+       `(#:tests? #f                    ; no test target
+         #:configure-flags
+         `("-DEMBED_SQLITE=OFF"
+           ,(string-append "-DCMAKE_PREFIX_PATH=" (assoc-ref %outputs "out")))
+         #:phases
+         (modify-phases %standard-phases
+           (add-before 'build 'make-output-bin
+             (lambda* (#:key outputs #:allow-other-keys)
+               (mkdir-p (string-append (assoc-ref outputs "out") "/bin"))))
+           (add-after 'unpack 'add-extra-src
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let ((jmdict (assoc-ref inputs "jmdict"))
+                     (gunzip (which "gunzip"))
+                     (out "3rdparty/JMdict.gz"))
+                 (mkdir-p "3rdparty")
+                 (copy-file jmdict out)
+                 (invoke gunzip out))))
+           (add-after 'unpack 'add-kanjidic2
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let ((kanjidic2 (assoc-ref inputs "kanjidic2"))
+                     (gunzip (which "gunzip"))
+                     (out "3rdparty/kanjidic2.xml.gz"))
+                 (mkdir-p "3rdparty")
+                 (copy-file kanjidic2 out)
+                 (invoke gunzip out))))
+           (add-after 'unpack 'add-kanjivg
+             (lambda* (#:key inputs outputs #:allow-other-keys)
+               (let* ((fname "kanjivg.xml")
+                      (kanjivg
+                       (string-append (assoc-ref inputs "kanjivg") "/" fname))
+                      (out (string-append "3rdparty/" fname)))
+                 (mkdir-p "3rdparty")
+                 (copy-file kanjivg out))))
+           (add-after 'unpack 'make-source-writable
+             ;; build requires to modify a .cc file
+             (lambda _
+               (chmod "src/core/kanjidic2/DictionaryDescriptions.cc" #o600))))))
+      (inputs
+       `(("jmdict"
+          ;; URL is not versioned!
+          ;; https://github.com/Gnurou/tagainijisho/blob/master/src/core/jmdict/CMakeLists.txt#L5
+          ,(origin
+             (method url-fetch)
+             (uri
+              '("http://ftp.edrdg.org/pub/Nihongo/JMdict.gz"
+                "http://www.bcit-broadcast.com/monash/JMdict.gz"
+                "ftp://ftp.net.usf.edu/pub/ftp.monash.edu.au/pub/nihongo/JMdict.gz"))
+             (sha256
+              (base32
+               "0nw39gg2i485b85zx7a5isiims83dpmdchcks9974ryb3z0zackm"))))
+         ("kanjidic2"
+          ;; URL is not versioned!
+          ;; https://github.com/Gnurou/tagainijisho/blob/master/src/core/kanjidic2/CMakeLists.txt#L4
+          ,(origin
+             (method url-fetch)
+             (uri "http://www.edrdg.org/kanjidic/kanjidic2.xml.gz")
+             (sha256
+              (base32
+               "0l2n3bqcfz2x6xns7w02dv01xz3cssbfvbjhlymd88sqsdbfn456"))))
+         ("kanjivg" ,kanjivg)
+         ("qtbase" ,qtbase)
+         ("qttools" ,qttools)
+         ("sqlite" ,sqlite)))
+      (synopsis "Japanese dictionary and learning assistant")
+      (description "Tagaini Jisho is a Japanese dictionary and learning
+assistant.  It is designed to help you remember Japanese vocabulary and
+kanji (later referred as 'entries') by presenting them in a way that makes it
+easy to create connections between them.  It does so by keeping track of all
+the entries you already know and want to study, and letting you tag and annote
+them, in addition to providing easy navigation between related entries.  A
+powerful search engine also allows you to search for entries very precisely.
+Finally, Tagaini let you produce printed material (including a handy foldable
+pocket book) so let you study anywhere.")
+      (home-page "https://www.tagaini.net/")
+      (license license:gpl3+))))
+
 (define-public childsplay
   (package
     (name "childsplay")
-- 
2.31.1