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