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