Merge branch 'master' into core-updates
[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.10.0")
143 (source (origin
144 (method url-fetch)
145 (uri (string-append "https://github.com/libpinyin/ibus-libpinyin/"
146 "releases/download/" version
147 "/ibus-libpinyin-" version ".tar.gz"))
148 (sha256
149 (base32
150 "0yq8aw4lddiviag8cnik6fp52vvk8lxv6bym13a3xya84c6zii3c"))))
151 (build-system glib-or-gtk-build-system)
152 (arguments
153 `(#:phases
154 (modify-phases %standard-phases
155 (add-after 'wrap-program 'wrap-with-additional-paths
156 (lambda* (#:key inputs outputs #:allow-other-keys)
157 ;; Make sure 'ibus-setup-libpinyin' runs with the correct
158 ;; PYTHONPATH and GI_TYPELIB_PATH.
159 (let ((out (assoc-ref outputs "out")))
160 (wrap-program (string-append out "/libexec/ibus-setup-libpinyin")
161 `("PYTHONPATH" ":" prefix
162 (,(getenv "PYTHONPATH")
163 ,(string-append (assoc-ref inputs "ibus")
164 "/lib/girepository-1.0")))
165 `("GI_TYPELIB_PATH" ":" prefix
166 (,(string-append (assoc-ref inputs "ibus")
167 "/lib/girepository-1.0"))))
168 #t))))))
169 (inputs
170 `(("ibus" ,ibus)
171 ("libpinyin" ,libpinyin)
172 ("bdb" ,bdb)
173 ("sqlite" ,sqlite)
174 ("python" ,python)
175 ("pyxdg" ,python-pyxdg)
176 ("gtk+" ,gtk+)))
177 (native-inputs
178 `(("pkg-config" ,pkg-config)
179 ("intltool" ,intltool)
180 ("glib" ,glib "bin")))
181 (synopsis "Chinese pinyin and ZhuYin input methods for IBus")
182 (description
183 "This package includes a Chinese pinyin input method and a Chinese
184 ZhuYin (Bopomofo) input method based on libpinyin for IBus.")
185 (home-page "https://github.com/libpinyin/ibus-libpinyin")
186 (license gpl2+)))
187
188 (define-public libpinyin
189 (package
190 (name "libpinyin")
191 (version "2.2.0")
192 (source (origin
193 (method url-fetch)
194 (uri (string-append "https://github.com/libpinyin/libpinyin/"
195 "releases/download/" version
196 "/libpinyin-2.2.0.tar.gz"))
197 (sha256
198 (base32
199 "1c4wxvcvjxvk23mcwqvsfsv4nhimx4kpjhabxa28gx1ih10l88gj"))))
200 (build-system gnu-build-system)
201 (inputs
202 `(("glib" ,glib)
203 ("bdb" ,bdb)))
204 (native-inputs
205 `(("pkg-config" ,pkg-config)))
206 (synopsis "Library to handle Chinese pinyin")
207 (description
208 "The libpinyin C++ library provides algorithms needed for sentence-based
209 Chinese pinyin input methods.")
210 (home-page "https://github.com/libpinyin/libpinyin")
211 (license gpl2+)))
212
213 (define-public ibus-anthy
214 (package
215 (name "ibus-anthy")
216 (version "1.5.9")
217 (source (origin
218 (method url-fetch)
219 (uri (string-append
220 "https://github.com/ibus/ibus-anthy/releases/download/"
221 version "/ibus-anthy-" version ".tar.gz"))
222 (sha256
223 (base32
224 "1y8sf837rmp662bv6zakny0xcm7c9c5qda7f9kq9riv9ywpcbw6x"))))
225 (build-system gnu-build-system)
226 (arguments
227 '(#:configure-flags
228 ;; Use absolute exec path in the anthy.xml.
229 (list (string-append "--libexecdir=" %output "/libexec"))
230 #:phases
231 (modify-phases %standard-phases
232 (add-after 'install 'wrap-programs
233 (lambda* (#:key outputs #:allow-other-keys)
234 (let ((out (assoc-ref outputs "out")))
235 (for-each
236 (lambda (prog)
237 (wrap-program (string-append out "/libexec/" prog)
238 `("PYTHONPATH" ":" prefix
239 (,(getenv "PYTHONPATH")))
240 `("GI_TYPELIB_PATH" ":" prefix
241 (,(getenv "GI_TYPELIB_PATH")
242 ,(string-append out "/lib/girepository-1.0")))))
243 '("ibus-engine-anthy" "ibus-setup-anthy"))
244 #t))))))
245 (native-inputs
246 `(("gettext" ,gettext-minimal)
247 ("intltool" ,intltool)
248 ("pkg-config" ,pkg-config)
249 ("python" ,python)))
250 (inputs
251 `(("anthy" ,anthy)
252 ("gtk+" ,gtk+)
253 ("ibus" ,ibus)
254 ("gobject-introspection" ,gobject-introspection)
255 ("python-pygobject" ,python-pygobject)))
256 (synopsis "Anthy Japanese language input method for IBus")
257 (description "IBus-Anthy is an engine for the input bus \"IBus\"). It
258 adds the Anthy Japanese language input method to IBus. Because most graphical
259 applications allow text input via IBus, installing this package will enable
260 Japanese language input in most graphical applications.")
261 (home-page "https://github.com/fujiwarat/ibus-anthy")
262 (license gpl2+)))