gnu: emacs-consult: Fix grammar.
[jackhill/guix/guix.git] / gnu / packages / fcitx5.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
3 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;;
5 ;;; This file is part of GNU Guix.
6 ;;;
7 ;;; GNU Guix is free software; you can redistribute it and/or modify it
8 ;;; under the terms of the GNU General Public License as published by
9 ;;; the Free Software Foundation; either version 3 of the License, or (at
10 ;;; your option) any later version.
11 ;;;
12 ;;; GNU Guix is distributed in the hope that it will be useful, but
13 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;;; GNU General Public License for more details.
16 ;;;
17 ;;; You should have received a copy of the GNU General Public License
18 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20 (define-module (gnu packages fcitx5)
21 #:use-module (guix packages)
22 #:use-module (guix download)
23 #:use-module (guix git-download)
24 #:use-module (guix build-system cmake)
25 #:use-module (guix build-system copy)
26 #:use-module ((guix licenses) #:prefix license:)
27 #:use-module (gnu packages boost)
28 #:use-module (gnu packages curl)
29 #:use-module (gnu packages datastructures)
30 #:use-module (gnu packages enchant)
31 #:use-module (gnu packages freedesktop)
32 #:use-module (gnu packages gcc)
33 #:use-module (gnu packages gettext)
34 #:use-module (gnu packages glib)
35 #:use-module (gnu packages gtk)
36 #:use-module (gnu packages iso-codes)
37 #:use-module (gnu packages kde-frameworks)
38 #:use-module (gnu packages libevent)
39 #:use-module (gnu packages linux)
40 #:use-module (gnu packages lua)
41 #:use-module (gnu packages pkg-config)
42 #:use-module (gnu packages pretty-print)
43 #:use-module (gnu packages python)
44 #:use-module (gnu packages qt)
45 #:use-module (gnu packages textutils)
46 #:use-module (gnu packages unicode)
47 #:use-module (gnu packages web)
48 #:use-module (gnu packages xdisorg)
49 #:use-module (gnu packages xml)
50 #:use-module (gnu packages xorg))
51
52 (define-public xcb-imdkit
53 (package
54 (name "xcb-imdkit")
55 (version "1.0.3")
56 (source
57 (origin
58 (method url-fetch)
59 (uri (string-append
60 "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
61 version ".tar.xz"))
62 (sha256
63 (base32 "1s58vjkdrgr8h183jz4b4mjn7pbvdc9cli01cn66mgczl9p65hh9"))
64 (modules '((guix build utils)))
65 (snippet
66 '(begin
67 ;; Remove bundled uthash.
68 (delete-file-recursively "uthash")
69 #t))))
70 (build-system cmake-build-system)
71 (inputs
72 `(("uthash" ,uthash)
73 ("libxcb" ,libxcb)
74 ("xcb-util" ,xcb-util)
75 ("xcb-util-keysyms" ,xcb-util-keysyms)))
76 (native-inputs
77 `(("extra-cmake-modules" ,extra-cmake-modules)
78 ("pkg-config" ,pkg-config)))
79 (home-page "https://github.com/fcitx/xcb-imdkit")
80 (synopsis "Input method development support for XCB")
81 (description "Xcb-imdkit is an implementation of xim protocol in XCB,
82 comparing with the implementation of IMDkit with Xlib, and xim inside Xlib, it
83 has less memory foot print, better performance, and safer on malformed
84 client.")
85 (license license:lgpl2.1)))
86
87 (define-public fcitx5
88 (package
89 (name "fcitx5")
90 (version "5.0.5")
91 (source
92 (origin
93 (method url-fetch)
94 (uri (string-append
95 "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
96 version "_dict.tar.xz"))
97 (sha256
98 (base32 "16j716xawbszkb3fxzpdza1a4czh0fvkysikjc9bfyvbwp72p6an"))))
99 (build-system cmake-build-system)
100 (arguments
101 `(#:configure-flags
102 (list (string-append "-DCLDR_DIR="
103 (assoc-ref %build-inputs "unicode-cldr-common")
104 "/share/unicode/cldr"))))
105 (inputs
106 `(("cairo" ,cairo)
107 ("cairo-xcb" ,cairo-xcb)
108 ("dbus" ,dbus)
109 ("enchant" ,enchant)
110 ("expat" ,expat)
111 ("fmt" ,fmt)
112 ("gdk-pixbuf" ,gdk-pixbuf)
113 ("gettext" ,gettext-minimal)
114 ("glib" ,glib)
115 ("iso-codes" ,iso-codes)
116 ("json-c" ,json-c)
117 ("libevent" ,libevent)
118 ("libpthread-stubs" ,libpthread-stubs)
119 ("libuuid" ,util-linux "lib")
120 ("libx11" ,libx11)
121 ("libxcb" ,libxcb)
122 ("libxfixes" ,libxfixes)
123 ("libxinerama" ,libxinerama)
124 ("libxkbcommon" ,libxkbcommon)
125 ("libxkbfile" ,libxkbfile)
126 ("pango" ,pango)
127 ("unicode-cldr-common" ,unicode-cldr-common)
128 ("wayland" ,wayland)
129 ("wayland-protocols" ,wayland-protocols)
130 ("xcb-imdkit" ,xcb-imdkit)
131 ("xcb-util" ,xcb-util)
132 ("xcb-util-keysyms" ,xcb-util-keysyms)
133 ("xcb-util-wm" ,xcb-util-wm)
134 ("xkeyboard-config" ,xkeyboard-config)))
135 (native-inputs
136 `(("extra-cmake-modules" ,extra-cmake-modules)
137 ("pkg-config" ,pkg-config)))
138 (native-search-paths
139 (list (search-path-specification
140 (variable "FCITX_ADDON_DIRS")
141 (files '("lib/fcitx5")))))
142 (home-page "https://github.com/fcitx/fcitx5")
143 (synopsis "Input method framework")
144 (description "Fcitx 5 is a generic input method framework.")
145 (license license:lgpl2.1+)))
146
147 (define-public fcitx5-lua
148 (package
149 (name "fcitx5-lua")
150 (version "5.0.2")
151 (source
152 (origin
153 (method url-fetch)
154 (uri (string-append
155 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
156 version ".tar.xz"))
157 (sha256
158 (base32 "0y5yc9102bz681f4wj6xqjxmfdmrshz3fhf39pa61718hkyy9lih"))))
159 (build-system cmake-build-system)
160 (inputs
161 `(("fcitx5" ,fcitx5)
162 ("lua" ,lua)
163 ("gettext" ,gettext-minimal)
164 ("libpthread-stubs" ,libpthread-stubs)))
165 (native-inputs
166 `(("extra-cmake-modules" ,extra-cmake-modules)))
167 (home-page "https://github.com/fcitx/fcitx5-lua")
168 (synopsis "Lua support for Fcitx 5")
169 (description "Fcitx5-lua allows writing Fcitx5 extension in Lua.")
170 (license license:lgpl2.1+)))
171
172 (define-public libime
173 (package
174 (name "libime")
175 (version "1.0.6")
176 (source
177 (origin
178 (method url-fetch)
179 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
180 version "_dict.tar.xz"))
181 (sha256
182 (base32 "1s8gzpzyn16pg9gm7kw1nhl09drdndi6j4mjam14ymqsrfsdqr1r"))))
183 (build-system cmake-build-system)
184 (inputs
185 `(("fcitx5" ,fcitx5)
186 ("boost" ,boost)))
187 (native-inputs
188 `(("gcc" ,gcc-9) ;for #include <filesystem> and ld support
189 ("extra-cmake-modules" ,extra-cmake-modules)
190 ("python" ,python))) ;needed to run test
191 (home-page "https://github.com/fcitx/libime")
192 (synopsis "Library for implementing generic input method")
193 (description "Libime is a library for implementing various input methods
194 editors.")
195 (license license:lgpl2.1+)))
196
197 (define-public fcitx5-gtk
198 (package
199 (name "fcitx5-gtk")
200 (version "5.0.3")
201 (source
202 (origin
203 (method url-fetch)
204 (uri (string-append "https://download.fcitx-im.org/fcitx5"
205 "/fcitx5-gtk/fcitx5-gtk-"
206 version ".tar.xz"))
207 (sha256
208 (base32 "18bwwj9a5v82c6ssc8560hd8vwykakvg6sfijwdb5jswk9mafvgj"))))
209 (build-system cmake-build-system)
210 (arguments
211 `(#:tests? #f ;No test
212 #:configure-flags
213 (list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
214 %output "/share/gir-1.0")
215 (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
216 %output "/lib/girepository-1.0")
217 ;; TODO: Enable it when Guix has GTK4.
218 "-DENABLE_GTK4_IM_MODULE=Off")
219 #:phases
220 (modify-phases %standard-phases
221 (add-before 'configure 'patch-install-prefix
222 (lambda* (#:key outputs #:allow-other-keys)
223 (let ((out (assoc-ref outputs "out"))
224 (gtk2 (assoc-ref outputs "gtk2")))
225 ;; Install GTK+ 2 input method module to its own output.
226 (substitute* "gtk2/CMakeLists.txt"
227 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
228 (string-append gtk2 "/lib")))))))))
229 (inputs
230 `(("fcitx5" ,fcitx5)
231 ("libxkbcommon" ,libxkbcommon)
232 ("gobject-introspection" ,gobject-introspection)
233 ("gtk2" ,gtk+-2)
234 ("gtk3" ,gtk+)
235 ("glib" ,glib)
236 ("libx11" ,libx11)
237 ("gettext" ,gettext-minimal)))
238 (native-inputs
239 `(("extra-cmake-modules" ,extra-cmake-modules)
240 ("pkg-config" ,pkg-config)
241 ("glib" ,glib "bin"))) ;for glib-genmarshal
242 ;; TODO: Add "lib" output to reduce the closure size of "gtk2".
243 (outputs '("out" "gtk2"))
244 (home-page "https://github.com/fcitx/fcitx5-gtk")
245 (synopsis "Glib based D-Bus client and GTK IM module for Fcitx 5")
246 (description "Fcitx5-gtk provides a Glib based D-Bus client and IM module
247 for GTK+2/GTK+3 application.")
248 (license license:lgpl2.1+)))
249
250 (define-public fcitx5-qt
251 (package
252 (name "fcitx5-qt")
253 (version "5.0.5")
254 (source
255 (origin
256 (method url-fetch)
257 (uri (string-append "https://download.fcitx-im.org/fcitx5"
258 "/fcitx5-qt/fcitx5-qt-"
259 version ".tar.xz"))
260 (sha256
261 (base32 "0vsvrfv0b21pfrz5n0v6p458vfr8k7km50h9bhjp1bnssampjfsb"))))
262 (build-system cmake-build-system)
263 (arguments
264 `(#:configure-flags
265 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
266 %output "/lib/qt5/plugins")
267 "-DENABLE_QT4=Off")))
268 (inputs
269 `(("fcitx5" ,fcitx5)
270 ("libxcb" ,libxcb)
271 ("libxkbcommon" ,libxkbcommon)
272 ("qtbase" ,qtbase)
273 ("gettext" ,gettext-minimal)))
274 (native-inputs
275 `(("extra-cmake-modules" ,extra-cmake-modules)))
276 (home-page "https://github.com/fcitx/fcitx5-qt")
277 (synopsis "Qt library and IM module for Fcitx 5")
278 (description "Fcitx5-qt provides Qt library for development and IM module
279 for Qt based application.")
280 (license (list license:lgpl2.1+
281 ;; Files under qt4(Fcitx5Qt4DBusAddons), qt5/dbusaddons
282 ;; and qt5/platforminputcontext.
283 license:bsd-3))))
284
285 (define-public fcitx5-chinese-addons
286 (package
287 (name "fcitx5-chinese-addons")
288 (version "5.0.3")
289 (source
290 (origin
291 (method url-fetch)
292 (uri (string-append "https://download.fcitx-im.org/fcitx5"
293 "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
294 version "_dict.tar.xz"))
295 (sha256
296 (base32 "1kmzbllk0g86m2z3piwn9j84ihxixyxzv7rzj832xfvwqgk7gixk"))))
297 (build-system cmake-build-system)
298 (arguments
299 `(#:phases
300 (modify-phases %standard-phases
301 (add-before 'configure 'split-outputs
302 ;; Build with GUI supports requires Qt and increase package closure
303 ;; by 800M on x86_64, so place it under another output.
304 (lambda* (#:key outputs #:allow-other-keys)
305 (substitute* "gui/pinyindictmanager/CMakeLists.txt"
306 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}" _)
307 (string-append (assoc-ref outputs "gui") "/lib"))))))))
308 (inputs
309 `(("fcitx5" ,fcitx5)
310 ("fcitx5-lua" ,fcitx5-lua)
311 ("boost" ,boost)
312 ("libime",libime)
313 ("curl" ,curl)
314 ("gettext" ,gettext-minimal)
315 ("fmt" ,fmt)
316 ("libpthread-stubs" ,libpthread-stubs)
317 ("opencc" ,opencc)
318 ("qtbase" ,qtbase)
319 ("fcitx5-qt" ,fcitx5-qt)
320 ("qtwebkit" ,qtwebkit)))
321 (native-inputs
322 `(("extra-cmake-modules" ,extra-cmake-modules)
323 ("pkg-config" ,pkg-config)))
324 (outputs '("out" "gui"))
325 (home-page "https://github.com/fcitx/fcitx5-chinese-addons")
326 (synopsis "Chinese related addons for Fcitx 5")
327 (description "Fcitx5-chinese-addons provides Chinese related addons,
328 including input methods previous bundled inside Fcitx 4:
329
330 @itemize
331 @item Bingchan
332 @item Cangjie
333 @item Erbi
334 @item Pinyin
335 @item Shuangpin
336 @item Wanfeng
337 @item Wubi
338 @item Wubi Pinyin
339 @item Ziranma
340 @end itemize\n")
341 (license (list license:lgpl2.1+
342 license:gpl2+
343 ;; im/pinyin/emoji.txt
344 license:unicode))))
345
346 (define-public fcitx5-configtool
347 (package
348 (name "fcitx5-configtool")
349 (version "5.0.2")
350 (source
351 (origin
352 (method url-fetch)
353 (uri (string-append
354 "https://download.fcitx-im.org/fcitx5"
355 "/fcitx5-configtool/fcitx5-configtool-" version ".tar.xz"))
356 (sha256
357 (base32 "0rpk3yn572pcr29jak63x84g0qgj8hj011aw8gmxjah9311nxhpb"))))
358 (build-system cmake-build-system)
359 (arguments
360 `(#:configure-flags
361 ;; KDE is currently not working on Guix, KCM supports doesn't make sense.
362 '("-DENABLE_KCM=Off")))
363 (inputs
364 `(("fcitx5" ,fcitx5)
365 ("fcitx5-qt" ,fcitx5-qt)
366 ("qtbase" ,qtbase)
367 ("qtx11extras" ,qtx11extras)
368 ("kitemviews" ,kitemviews)
369 ("kwidgetsaddons" ,kwidgetsaddons)
370 ("libx11" ,libx11)
371 ("xkeyboard-config" ,xkeyboard-config)
372 ("libxkbfile" ,libxkbfile)
373 ("gettext" ,gettext-minimal)
374 ("iso-codes" ,iso-codes)))
375 (native-inputs
376 `(("gcc" ,gcc-9)
377 ("extra-cmake-modules" ,extra-cmake-modules)
378 ("pkg-config" ,pkg-config)))
379 (home-page "https://github.com/fcitx/fcitx5-configtool")
380 (synopsis "Graphical configuration tool for Fcitx 5")
381 (description "Fcitx5-configtool is a graphical configuration tool
382 to manage different input methods in Fcitx 5.")
383 (license license:gpl2+)))
384
385 (define-public fcitx5-material-color-theme
386 (package
387 (name "fcitx5-material-color-theme")
388 (version "0.1")
389 (source
390 (origin
391 (method git-fetch)
392 (uri (git-reference
393 (url "https://github.com/hosxy/Fcitx5-Material-Color")
394 (commit version)))
395 (file-name (git-file-name name version))
396 (sha256
397 (base32 "1mgc722521jmfx0xc3ibmiycd3q2w7xg2956xcpc07kz90gcdjaa"))))
398 (build-system copy-build-system)
399 (arguments
400 `(#:phases
401 (modify-phases %standard-phases
402 (replace 'install
403 (lambda* (#:key outputs #:allow-other-keys)
404 (use-modules (srfi srfi-26))
405
406 (let* ((out (assoc-ref outputs "out"))
407 (assets-dir (string-append
408 out "/share/fcitx5-material-color-theme"))
409 (themes-prefix (string-append out "/share/fcitx5/themes")))
410
411 (define (install-theme-variant variant target)
412 (let ((dir (string-append themes-prefix "/" target))
413 (png (string-append "panel-" variant ".png"))
414 (conf (string-append "theme-" variant ".conf")))
415 (format #t "install: Installing color variant \"~a\" to ~a~%"
416 variant dir)
417 (substitute* conf
418 (("^Name=.*")
419 (string-append "Name=" target "\n")))
420 (mkdir-p dir)
421 (install-file png dir)
422 (copy-file conf (string-append dir "/theme.conf"))
423 (symlink (string-append assets-dir "/arrow.png")
424 (string-append dir "/arrow.png"))))
425
426 (mkdir-p assets-dir)
427 (install-file "arrow.png" assets-dir)
428 (for-each
429 (lambda (x)
430 (install-theme-variant
431 x (string-append "Material-Color-" (string-capitalize x))))
432 '("black" "blue" "brown" "indigo"
433 "orange" "pink" "red" "teal"))
434
435 (install-theme-variant
436 "deepPurple" "Material-Color-DeepPurple")))))))
437 (home-page "https://github.com/hosxy/Fcitx5-Material-Color")
438 (synopsis "Material Design for Fcitx 5")
439 (description "Fcitx5-material-color-theme is a Material Design theme
440 for Fcitx 5 with following color variants:
441
442 @itemize
443 @item Black
444 @item Blue
445 @item Brown
446 @item Indigo
447 @item Orange
448 @item Pink
449 @item Red
450 @item teal
451 @item DeepPurple
452 @end itemize\n")
453 (license license:asl2.0)))