Patchwork kakasi + perl-kakasi -- dependencies for namazu

login
register
mail settings
Submitter ng0
Date Sept. 24, 2016, 2:45 p.m.
Message ID <878tuh5pc3.fsf@we.make.ritual.n0.is>
Download mbox | patch
Permalink /patch/15973/
State New
Headers show

Comments

ng0 - Sept. 24, 2016, 2:45 p.m.
Those are in namazu.scm because they are needed for namazu. Tests for
kakasi require some fixes, however I will not fix this.
Leo Famulari - Sept. 25, 2016, 5:17 p.m.
On Sat, Sep 24, 2016 at 02:45:16PM +0000, ng0 wrote:
> Subject: [PATCH 1/2] gnu: Add kakasi.
> 
> * gnu/packages/namazu.scm: New file.
> * gnu/local.mk (GNU_SYSTEM_MODULES): Add it.

Could it go in (gnu packages textutils)?

> +(define-public kakasi

> +   (arguments
> +    `(;; kakasi-4 /bin/echo fails to get substituted, we need to replace
> +      ;; /bin/echo with (which echo) in tests/kakasi-{1,4,5,6,7}
> +      #:tests? #f))

$ which echo
echo: shell built-in command

What happens if we substitute the "/bin/" out and let it call "echo"?

> Subject: [PATCH 2/2] gnu: Add perl-text-kakasi.
> 
> * gnu/packages/namazu.scm (perl-text-kakasi): New variable.

> +    (arguments
> +     `(#:tests? #f)) ; Requires kakasi in -lkakasi , fixme.

I understand you aren't interested in fixing the tests. Would anyone
else like to take a look?
Danny Milosavljevic - Sept. 25, 2016, 5:37 p.m.
> > +     `(#:tests? #f)) ; Requires kakasi in -lkakasi , fixme.  

If you like the easy way, just set the environment variable LIBRARY_PATH (or LD_LIBRARY_PATH) before running the tests so it finds the library "kakasi".

Something like

(arguments
 ...
 #phases
 (modify-phases %standard-phases
   (add-before 'check 'check-set-library-path
      (lambda x
        (setenv "LIBRARY_PATH" (getcwd)) ; or wherever the library is; maybe extend the existing LIBRARY_PATH instead if needed.
        (apply (assoc-ref %standard-phases 'check) x)))

It's not like the tests will be installed or anything...
Danny Milosavljevic - Sept. 25, 2016, 5:39 p.m.
Oops, I meant

(arguments
 ...
 #phases
 (modify-phases %standard-phases
   (add-before 'check 'check-set-library-path
      (lambda _
        (setenv "LIBRARY_PATH" (getcwd)))))) ; or wherever the library is; maybe extend the existing LIBRARY_PATH instead if needed.

Since setenv's environment variables survive phase switches it's fine to just set it beforehand...

Patch

From 2d81d97daa68000192c8c6a2bed3150c39d7957f Mon Sep 17 00:00:00 2001
From: ng0 <ng0@we.make.ritual.n0.is>
Date: Sun, 18 Sep 2016 01:22:42 +0000
Subject: [PATCH 2/2] gnu: Add perl-text-kakasi.

* gnu/packages/namazu.scm (perl-text-kakasi): New variable.
---
 gnu/packages/namazu.scm | 33 ++++++++++++++++++++++++++++++++-
 1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/namazu.scm b/gnu/packages/namazu.scm
index bec61df..858254c 100644
--- a/gnu/packages/namazu.scm
+++ b/gnu/packages/namazu.scm
@@ -20,10 +20,12 @@ 
   #:use-module (gnu packages)
   #:use-module (gnu packages autotools)
   #:use-module (gnu packages base)
+  #:use-module (gnu packages perl)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix download)
-  #:use-module (guix build-system gnu))
+  #:use-module (guix build-system gnu)
+  #:use-module (guix build-system perl))
 
 (define-public kakasi
   (package
@@ -51,3 +53,32 @@  to Hiragana, Katakana or Romaji and may be helpful to read Japanese
 documents.")
    (license license:gpl2+)
    (home-page "http://kakasi.namazu.org")))
+
+(define-public perl-text-kakasi
+  (package
+    (name "perl-text-kakasi")
+    (version "2.04")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "mirror://cpan/authors/id/D/DA/"
+                           "DANKOGAI/Text-Kakasi-" version ".tar.gz"))
+       (sha256
+        (base32
+         "186v4ibdafag1spyfx8anhlprpl8yj35m6820yfbigx4igkh2k44"))))
+    (build-system perl-build-system)
+    (native-inputs
+     `(("perl-test-harness" ,perl-test-harness)))
+    (inputs
+     `(("kakasi" ,kakasi)))
+    (arguments
+     `(#:tests? #f)) ; Requires kakasi in -lkakasi , fixme.
+    (home-page "http://search.cpan.org/dist/Text-Kakasi")
+    (synopsis "Perl frontend to kakasi")
+    (description
+     "@code{Text::Kakasi} provides an interface to kakasi.
+Kakasi is a set of programs and libraries which does what
+Japanese input methods do in reverse order.  You feed Japanese
+and kakasi converts it to phonetic representation thereof.
+Kakasi can also be used to tokenizing Japanese text.")
+    (license license:gpl2)))
-- 
2.10.0