gnu: libpinyin: Update to 2.2.0.
[jackhill/guix/guix.git] / gnu / packages / ibus.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017, 2018 Ricardo Wurmus <rekado@elephly.net>
3 ;;; Copyright © 2015 Andreas Enge <andreas@enge.fr>
4 ;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
5 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
6 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages ibus)
24 #:use-module (guix licenses)
25 #:use-module (guix packages)
26 #:use-module (guix download)
27 #:use-module (guix build-system gnu)
28 #:use-module (guix build-system glib-or-gtk)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages anthy)
31 #:use-module (gnu packages autotools)
32 #:use-module (gnu packages base)
33 #:use-module (gnu packages databases)
34 #:use-module (gnu packages freedesktop)
35 #:use-module (gnu packages gettext)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages gnome)
38 #:use-module (gnu packages gtk)
39 #:use-module (gnu packages iso-codes)
40 #:use-module (gnu packages pkg-config)
41 #:use-module (gnu packages python)
42 #:use-module (gnu packages xorg))
43
44 (define-public ibus
45 (package
46 (name "ibus")
47 (version "1.5.17")
48 (source (origin
49 (method url-fetch)
50 (uri (string-append "https://github.com/ibus/ibus/"
51 "releases/download/"
52 version "/ibus-" version ".tar.gz"))
53 (sha256
54 (base32
55 "06fj7lawww5d5w73pk249191lvmpz7shlxfxia74bjkpb42shiq3"))))
56 (build-system glib-or-gtk-build-system)
57 (arguments
58 `(#:tests? #f ; tests fail because there's no connection to dbus
59 #:configure-flags '("--disable-emoji-dict" ; cannot find emoji.json path
60 "--enable-wayland")
61 #:make-flags
62 (list "CC=gcc"
63 (string-append "pyoverridesdir="
64 (assoc-ref %outputs "out")
65 "/lib/python2.7/site-packages/gi/overrides/")
66 (string-append "py2overridesdir="
67 (assoc-ref %outputs "out")
68 "/lib/python2.7/site-packages/gi/overrides/"))
69 #:phases
70 (modify-phases %standard-phases
71 (add-before 'configure 'disable-dconf-update
72 (lambda _
73 (substitute* "data/dconf/Makefile.in"
74 (("dconf update") "echo dconf update"))
75 #t))
76 (add-after 'unpack 'delete-generated-files
77 (lambda _
78 (for-each (lambda (file)
79 (let ((c (string-append (string-drop-right file 4) "c")))
80 (when (file-exists? c)
81 (format #t "deleting ~a\n" c)
82 (delete-file c))))
83 (find-files "." "\\.vala"))
84 #t))
85 (add-after 'unpack 'fix-paths
86 (lambda* (#:key inputs #:allow-other-keys)
87 (substitute* "src/ibusenginesimple.c"
88 (("/usr/share/X11/locale")
89 (string-append (assoc-ref inputs "libx11")
90 "/share/X11/locale")))
91 (substitute* "ui/gtk3/xkblayout.vala"
92 (("\"(setxkbmap|xmodmap)\"" _ prog)
93 (string-append "\"" (assoc-ref inputs prog) "\"")))
94 #t))
95 (add-after 'wrap-program 'wrap-with-additional-paths
96 (lambda* (#:key outputs #:allow-other-keys)
97 ;; Make sure 'ibus-setup' runs with the correct PYTHONPATH and
98 ;; GI_TYPELIB_PATH.
99 (let ((out (assoc-ref outputs "out")))
100 (wrap-program (string-append out "/bin/ibus-setup")
101 `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))
102 `("GI_TYPELIB_PATH" ":" prefix
103 (,(getenv "GI_TYPELIB_PATH")
104 ,(string-append out "/lib/girepository-1.0")))))
105 #t)))))
106 (inputs
107 `(("dbus" ,dbus)
108 ("dconf" ,dconf)
109 ("gconf" ,gconf)
110 ("gtk2" ,gtk+-2)
111 ("gtk+" ,gtk+)
112 ("intltool" ,intltool)
113 ("json-glib" ,json-glib)
114 ("libnotify" ,libnotify)
115 ("libx11" ,libx11)
116 ("setxkbmap" ,setxkbmap)
117 ("wayland" ,wayland)
118 ("xmodmap" ,xmodmap)
119 ("iso-codes" ,iso-codes)
120 ("pygobject2" ,python2-pygobject)
121 ("python2" ,python-2)))
122 (native-inputs
123 `(("glib" ,glib "bin") ; for glib-genmarshal
124 ("gobject-introspection" ,gobject-introspection) ; for g-ir-compiler
125 ("vala" ,vala)
126 ("pkg-config" ,pkg-config)))
127 (native-search-paths
128 (list (search-path-specification
129 (variable "IBUS_COMPONENT_PATH")
130 (files '("share/ibus/component")))))
131 (synopsis "Input method framework")
132 (description
133 "IBus is an input framework providing a full-featured and user-friendly
134 input method user interface. It comes with multilingual input support. It
135 may also simplify input method development.")
136 (home-page "https://github.com/ibus/ibus/wiki")
137 (license lgpl2.1+)))
138
139 (define-public ibus-libpinyin
140 (package
141 (name "ibus-libpinyin")
142 (version "1.9.2")
143 (source (origin
144 (method url-fetch)
145 (uri (string-append "https://github.com/libpinyin/"
146 "ibus-libpinyin/archive/" version ".tar.gz"))
147 (file-name (string-append name "-" version ".tar.gz"))
148 (sha256
149 (base32
150 "0wpgs0m62l4zlis9f11b7xknhgnw2xw485nc2xrzk880s17pp1mr"))))
151 (build-system glib-or-gtk-build-system)
152 (arguments
153 `(#:phases
154 (modify-phases %standard-phases
155 (add-after 'unpack 'autogen
156 (lambda _ (and (zero? (system* "intltoolize"))
157 (zero? (system* "autoreconf" "-vif")))))
158 (add-after 'wrap-program 'wrap-with-additional-paths
159 (lambda* (#:key inputs outputs #:allow-other-keys)
160 ;; Make sure 'ibus-setup-libpinyin' runs with the correct
161 ;; PYTHONPATH and GI_TYPELIB_PATH.
162 (let ((out (assoc-ref outputs "out")))
163 (wrap-program (string-append out "/libexec/ibus-setup-libpinyin")
164 `("PYTHONPATH" ":" prefix
165 (,(getenv "PYTHONPATH")
166 ,(string-append (assoc-ref inputs "ibus")
167 "/lib/girepository-1.0")))
168 `("GI_TYPELIB_PATH" ":" prefix
169 (,(string-append (assoc-ref inputs "ibus")
170 "/lib/girepository-1.0"))))
171 #t))))))
172 (inputs
173 `(("ibus" ,ibus)
174 ("libpinyin" ,libpinyin)
175 ("bdb" ,bdb)
176 ("sqlite" ,sqlite)
177 ("python" ,python)
178 ("pyxdg" ,python-pyxdg)
179 ("gtk+" ,gtk+)))
180 (native-inputs
181 `(("pkg-config" ,pkg-config)
182 ("intltool" ,intltool)
183 ("autoconf" ,autoconf)
184 ("automake" ,automake)
185 ("glib" ,glib "bin")
186 ("libtool" ,libtool)))
187 (synopsis "Chinese pinyin and ZhuYin input methods for IBus")
188 (description
189 "This package includes a Chinese pinyin input method and a Chinese
190 ZhuYin (Bopomofo) input method based on libpinyin for IBus.")
191 (home-page "https://github.com/libpinyin/ibus-libpinyin")
192 (license gpl2+)))
193
194 (define-public libpinyin
195 (package
196 (name "libpinyin")
197 (version "2.2.0")
198 (source (origin
199 (method url-fetch)
200 (uri (string-append "https://github.com/libpinyin/libpinyin/"
201 "releases/download/" version
202 "/libpinyin-2.2.0.tar.gz"))
203 (sha256
204 (base32
205 "1c4wxvcvjxvk23mcwqvsfsv4nhimx4kpjhabxa28gx1ih10l88gj"))))
206 (build-system gnu-build-system)
207 (inputs
208 `(("glib" ,glib)
209 ("bdb" ,bdb)))
210 (native-inputs
211 `(("pkg-config" ,pkg-config)))
212 (synopsis "Library to handle Chinese pinyin")
213 (description
214 "The libpinyin C++ library provides algorithms needed for sentence-based
215 Chinese pinyin input methods.")
216 (home-page "https://github.com/libpinyin/libpinyin")
217 (license gpl2+)))
218
219 (define-public ibus-anthy
220 (package
221 (name "ibus-anthy")
222 (version "1.5.9")
223 (source (origin
224 (method url-fetch)
225 (uri (string-append
226 "https://github.com/ibus/ibus-anthy/releases/download/"
227 version "/ibus-anthy-" version ".tar.gz"))
228 (sha256
229 (base32
230 "1y8sf837rmp662bv6zakny0xcm7c9c5qda7f9kq9riv9ywpcbw6x"))))
231 (build-system gnu-build-system)
232 (arguments
233 '(#:configure-flags
234 ;; Use absolute exec path in the anthy.xml.
235 (list (string-append "--libexecdir=" %output "/libexec"))
236 #:phases
237 (modify-phases %standard-phases
238 (add-after 'install 'wrap-programs
239 (lambda* (#:key outputs #:allow-other-keys)
240 (let ((out (assoc-ref outputs "out")))
241 (for-each
242 (lambda (prog)
243 (wrap-program (string-append out "/libexec/" prog)
244 `("PYTHONPATH" ":" prefix
245 (,(getenv "PYTHONPATH")))
246 `("GI_TYPELIB_PATH" ":" prefix
247 (,(getenv "GI_TYPELIB_PATH")
248 ,(string-append out "/lib/girepository-1.0")))))
249 '("ibus-engine-anthy" "ibus-setup-anthy"))
250 #t))))))
251 (native-inputs
252 `(("gettext" ,gettext-minimal)
253 ("intltool" ,intltool)
254 ("pkg-config" ,pkg-config)
255 ("python" ,python)))
256 (inputs
257 `(("anthy" ,anthy)
258 ("gtk+" ,gtk+)
259 ("ibus" ,ibus)
260 ("gobject-introspection" ,gobject-introspection)
261 ("python-pygobject" ,python-pygobject)))
262 (synopsis "Anthy Japanese language input method for IBus")
263 (description "IBus-Anthy is an engine for the input bus \"IBus\"). It
264 adds the Anthy Japanese language input method to IBus. Because most graphical
265 applications allow text input via IBus, installing this package will enable
266 Japanese language input in most graphical applications.")
267 (home-page "https://github.com/fujiwarat/ibus-anthy")
268 (license gpl2+)))