Merge branch 'master' into staging
[jackhill/guix/guix.git] / gnu / packages / ibus.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015, 2016, 2017 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.1.91")
198 (source (origin
199 (method url-fetch)
200 (uri (string-append
201 "https://github.com/libpinyin/libpinyin/archive/"
202 version ".tar.gz"))
203 (file-name (string-append name "-" version ".tar.gz"))
204 (sha256
205 (base32
206 "1yr4zyz3rwvmvj6bh8pc54hbp4rd2xk3g06y38z220fshx2l8pwf"))))
207 (build-system gnu-build-system)
208 (arguments
209 `(#:phases
210 (modify-phases %standard-phases
211 (add-before 'configure 'autogen
212 (lambda _ (zero? (system* "autoreconf" "-vif"))))
213 (add-after 'unpack 'unpack-model
214 (lambda* (#:key inputs #:allow-other-keys)
215 (zero? (system* "tar" "-xvf"
216 (assoc-ref inputs "model")
217 "-C" "data")))))))
218 (inputs
219 `(("glib" ,glib)
220 ("bdb" ,bdb)
221 ("model"
222 ,(origin
223 (method url-fetch)
224 (uri (string-append "mirror://sourceforge/libpinyin/"
225 "models/model14.text.tar.gz"))
226 (sha256
227 (base32
228 "0qqk30nflj07zjhs231c95ln4yj4ipzwxxiwrxazrg4hb8bhypqq"))))))
229 (native-inputs
230 `(("pkg-config" ,pkg-config)
231 ("autoconf" ,autoconf)
232 ("automake" ,automake)
233 ("libtool" ,libtool)))
234 (synopsis "Library to handle Chinese pinyin")
235 (description
236 "The libpinyin C++ library provides algorithms needed for sentence-based
237 Chinese pinyin input methods.")
238 (home-page "https://github.com/libpinyin/libpinyin")
239 (license gpl2+)))
240
241 (define-public ibus-anthy
242 (package
243 (name "ibus-anthy")
244 (version "1.5.9")
245 (source (origin
246 (method url-fetch)
247 (uri (string-append
248 "https://github.com/ibus/ibus-anthy/releases/download/"
249 version "/ibus-anthy-" version ".tar.gz"))
250 (sha256
251 (base32
252 "1y8sf837rmp662bv6zakny0xcm7c9c5qda7f9kq9riv9ywpcbw6x"))))
253 (build-system gnu-build-system)
254 (arguments
255 '(#:configure-flags
256 ;; Use absolute exec path in the anthy.xml.
257 (list (string-append "--libexecdir=" %output "/libexec"))
258 #:phases
259 (modify-phases %standard-phases
260 (add-after 'install 'wrap-programs
261 (lambda* (#:key outputs #:allow-other-keys)
262 (let ((out (assoc-ref outputs "out")))
263 (for-each
264 (lambda (prog)
265 (wrap-program (string-append out "/libexec/" prog)
266 `("PYTHONPATH" ":" prefix
267 (,(getenv "PYTHONPATH")))
268 `("GI_TYPELIB_PATH" ":" prefix
269 (,(getenv "GI_TYPELIB_PATH")
270 ,(string-append out "/lib/girepository-1.0")))))
271 '("ibus-engine-anthy" "ibus-setup-anthy"))
272 #t))))))
273 (native-inputs
274 `(("gettext" ,gettext-minimal)
275 ("intltool" ,intltool)
276 ("pkg-config" ,pkg-config)
277 ("python" ,python)))
278 (inputs
279 `(("anthy" ,anthy)
280 ("gtk+" ,gtk+)
281 ("ibus" ,ibus)
282 ("gobject-introspection" ,gobject-introspection)
283 ("python-pygobject" ,python-pygobject)))
284 (synopsis "Anthy Japanese language input method for IBus")
285 (description "IBus-Anthy is an engine for the input bus \"IBus\"). It
286 adds the Anthy Japanese language input method to IBus. Because most graphical
287 applications allow text input via IBus, installing this package will enable
288 Japanese language input in most graphical applications.")
289 (home-page "https://github.com/fujiwarat/ibus-anthy")
290 (license gpl2+)))