gnu: julius: Update to 1.7.0.
[jackhill/guix/guix.git] / gnu / packages / fcitx5.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020, 2022 Zhu Zihao <all_but_last@163.com>
3 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2022 Dominic Martinez <dom@dominicm.dev>
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 fcitx5)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix gexp)
25 #:use-module (guix git-download)
26 #:use-module (guix build-system cmake)
27 #:use-module (guix build-system copy)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (gnu packages anthy)
30 #:use-module (gnu packages boost)
31 #:use-module (gnu packages curl)
32 #:use-module (gnu packages datastructures)
33 #:use-module (gnu packages enchant)
34 #:use-module (gnu packages freedesktop)
35 #:use-module (gnu packages gettext)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages gtk)
38 #:use-module (gnu packages iso-codes)
39 #:use-module (gnu packages kde-frameworks)
40 #:use-module (gnu packages libevent)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages lua)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages pretty-print)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages qt)
47 #:use-module (gnu packages textutils)
48 #:use-module (gnu packages unicode)
49 #:use-module (gnu packages web)
50 #:use-module (gnu packages xdisorg)
51 #:use-module (gnu packages xml)
52 #:use-module (gnu packages xorg))
53
54 (define-public xcb-imdkit
55 (package
56 (name "xcb-imdkit")
57 (version "1.0.3")
58 (source
59 (origin
60 (method url-fetch)
61 (uri (string-append
62 "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
63 version ".tar.xz"))
64 (sha256
65 (base32 "1s58vjkdrgr8h183jz4b4mjn7pbvdc9cli01cn66mgczl9p65hh9"))
66 (modules '((guix build utils)))
67 (snippet
68 '(begin
69 ;; Remove bundled uthash.
70 (delete-file-recursively "uthash")
71 #t))))
72 (build-system cmake-build-system)
73 (inputs
74 (list uthash libxcb xcb-util xcb-util-keysyms))
75 (native-inputs
76 (list extra-cmake-modules pkg-config))
77 (home-page "https://github.com/fcitx/xcb-imdkit")
78 (synopsis "Input method development support for XCB")
79 (description "Xcb-imdkit is an implementation of xim protocol in XCB,
80 comparing with the implementation of IMDkit with Xlib, and xim inside Xlib, it
81 has less memory foot print, better performance, and safer on malformed
82 client.")
83 (license license:lgpl2.1)))
84
85 (define-public fcitx5
86 (package
87 (name "fcitx5")
88 (version "5.0.10")
89 (source
90 (origin
91 (method url-fetch)
92 (uri (string-append
93 "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
94 version "_dict.tar.xz"))
95 (sha256
96 (base32 "0i23skr49n6b30ybm66bkv07dcr0dan5mzxch7x83znfnrpk8z3h"))))
97 (build-system cmake-build-system)
98 (arguments
99 `(#:configure-flags
100 (list (string-append "-DCLDR_DIR="
101 (assoc-ref %build-inputs "unicode-cldr-common")
102 "/share/unicode/cldr"))))
103 (inputs
104 `(("cairo" ,cairo)
105 ("cairo-xcb" ,cairo-xcb)
106 ("dbus" ,dbus)
107 ("enchant" ,enchant)
108 ("expat" ,expat)
109 ("fmt" ,fmt)
110 ("gdk-pixbuf" ,gdk-pixbuf)
111 ("gettext" ,gettext-minimal)
112 ("glib" ,glib)
113 ("iso-codes" ,iso-codes)
114 ("json-c" ,json-c)
115 ("libevent" ,libevent)
116 ("libpthread-stubs" ,libpthread-stubs)
117 ("libuuid" ,util-linux "lib")
118 ("libx11" ,libx11)
119 ("libxcb" ,libxcb)
120 ("libxfixes" ,libxfixes)
121 ("libxinerama" ,libxinerama)
122 ("libxkbcommon" ,libxkbcommon)
123 ("libxkbfile" ,libxkbfile)
124 ("pango" ,pango)
125 ("unicode-cldr-common" ,unicode-cldr-common)
126 ("wayland" ,wayland)
127 ("wayland-protocols" ,wayland-protocols)
128 ("xcb-imdkit" ,xcb-imdkit)
129 ("xcb-util" ,xcb-util)
130 ("xcb-util-keysyms" ,xcb-util-keysyms)
131 ("xcb-util-wm" ,xcb-util-wm)
132 ("xkeyboard-config" ,xkeyboard-config)))
133 (native-inputs
134 (list extra-cmake-modules pkg-config))
135 (native-search-paths
136 (list (search-path-specification
137 (variable "FCITX_ADDON_DIRS")
138 (files '("lib/fcitx5")))))
139 (home-page "https://github.com/fcitx/fcitx5")
140 (synopsis "Input method framework")
141 (description "Fcitx 5 is a generic input method framework.")
142 (license license:lgpl2.1+)))
143
144 (define-public fcitx5-lua
145 (package
146 (name "fcitx5-lua")
147 (version "5.0.5")
148 (source
149 (origin
150 (method url-fetch)
151 (uri (string-append
152 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
153 version ".tar.xz"))
154 (sha256
155 (base32 "0f3raxzkq0nwdfpc9hxvg65vga09gznjjgy9dr6jlkamzx8zlyw9"))))
156 (build-system cmake-build-system)
157 (inputs
158 (list fcitx5 lua gettext-minimal libpthread-stubs))
159 (native-inputs
160 (list extra-cmake-modules))
161 (home-page "https://github.com/fcitx/fcitx5-lua")
162 (synopsis "Lua support for Fcitx 5")
163 (description "Fcitx5-lua allows writing Fcitx5 extension in Lua.")
164 (license license:lgpl2.1+)))
165
166 (define-public libime
167 (package
168 (name "libime")
169 (version "1.0.10")
170 (source
171 (origin
172 (method url-fetch)
173 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
174 version "_dict.tar.xz"))
175 (sha256
176 (base32 "0dknxf5lf5a6kam39rp7y1h2p47bwb6pnlc8fsrhmiv7rw2pkq0f"))))
177 (build-system cmake-build-system)
178 (inputs
179 (list fcitx5 boost))
180 (native-inputs
181 (list extra-cmake-modules python)) ;needed to run test
182 (home-page "https://github.com/fcitx/libime")
183 (synopsis "Library for implementing generic input methods")
184 (description "Libime is a library for implementing various input method
185 editors.")
186 (license license:lgpl2.1+)))
187
188 (define-public fcitx5-gtk
189 (package
190 (name "fcitx5-gtk")
191 (version "5.0.9")
192 (source
193 (origin
194 (method url-fetch)
195 (uri (string-append "https://download.fcitx-im.org/fcitx5"
196 "/fcitx5-gtk/fcitx5-gtk-"
197 version ".tar.xz"))
198 (sha256
199 (base32 "07ip4sxf3q895pp7mivv2bdwcmqjnwrmv9pg99jk73cw9bgyq00n"))))
200 (build-system cmake-build-system)
201 (arguments
202 (list
203 #:tests? #f ;No test
204 #:configure-flags
205 #~(list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
206 #$output "/share/gir-1.0")
207 (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
208 #$output "/lib/girepository-1.0")
209 "-DENABLE_GTK4_IM_MODULE=OFF")
210 #:phases
211 #~(modify-phases %standard-phases
212 (add-before 'configure 'patch-install-prefix
213 (lambda _
214 ;; Take care of different versions of GTK because this package
215 ;; provides IM module for GTK application to use input method.
216 (define (split-immodule gtk-version output)
217 (substitute* (string-append gtk-version "/CMakeLists.txt")
218 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
219 (string-append output "/lib"))))
220
221 (let ((gtk2 #$output:gtk2)
222 (gtk3 #$output:gtk3))
223 (for-each split-immodule
224 '("gtk2" "gtk3")
225 (list gtk2 gtk3))))))))
226 (inputs
227 (list fcitx5
228 fmt
229 libx11
230 libxkbcommon
231 gettext-minimal
232 gobject-introspection
233 gtk+-2
234 gtk+
235 glib))
236 (native-inputs
237 (list extra-cmake-modules pkg-config
238 `(,glib "bin"))) ;for glib-genmarshal
239 (outputs '("out" "gtk2" "gtk3"))
240 (home-page "https://github.com/fcitx/fcitx5-gtk")
241 (synopsis "GLib-based D-Bus client and GTK IM module for Fcitx 5")
242 (description "Fcitx5-gtk provides the following functionality in the
243 corresponding output:
244
245 @table @code
246 @item out
247 GLib-based D-Bus client of Fcitx5.
248 @item gtk2
249 IM module for GTK+2 applications.
250 @item gtk3
251 IM module for GTK+3 applications.
252 @end table")
253 (license license:lgpl2.1+)))
254
255 ;; XXX: This package is separated from fcitx5-gtk for following reasons.
256 ;; 1. GTK4 has a lot more dependencies, some of which maybe unavailable on
257 ;; platforms other than x86_64. See <https://issues.guix.gnu.org/53648>.
258 ;; 2. GTK4 now propagates pango@1.50, it will conflict with GTK3 and GTK2
259 ;; (propagates pango@1.48) if they're all in the inputs of same package.
260 ;; See <https://issues.guix.gnu.org/54261>.
261 (define-public fcitx5-gtk4
262 (package
263 (inherit fcitx5-gtk)
264 (name "fcitx5-gtk4")
265 (arguments
266 (list
267 #:tests? #f ;No test
268 #:configure-flags
269 #~(list (string-append "-DCMAKE_CXX_FLAGS=-I"
270 #$(this-package-input "fcitx5-gtk")
271 "/include/Fcitx5/GClient")
272 "-DENABLE_GTK2_IM_MODULE=OFF"
273 "-DENABLE_GTK3_IM_MODULE=OFF")
274 #:phases
275 #~(modify-phases %standard-phases
276 (add-before 'configure 'fix-gclient
277 (lambda* (#:key inputs #:allow-other-keys)
278 (define gclient
279 (search-input-file inputs "lib/libFcitx5GClient.so"))
280 ;; Force cmake search libFcitx5GClient.so in library search
281 ;; path instead of compiling again.
282 (substitute* "gtk4/CMakeLists.txt"
283 (("Fcitx5::GClient")
284 gclient))))
285 (add-before 'build 'enter-gtk4-subdirectory
286 (lambda _
287 (chdir "gtk4")))
288 (add-after 'install 'leave-gtk4-subdirectory
289 (lambda _
290 (chdir ".."))))))
291 (inputs
292 (modify-inputs (package-inputs fcitx5-gtk)
293 (delete "gtk+")
294 (prepend fcitx5-gtk gtk)))
295 (outputs '("out"))
296 (synopsis "GTK4 IM module for Fcitx 5")
297 (description "Fcitx5-gtk4 provides IM module for GTK4 applications.")))
298
299 (define-public fcitx5-qt
300 (package
301 (name "fcitx5-qt")
302 (version "5.0.7")
303 (source
304 (origin
305 (method url-fetch)
306 (uri (string-append "https://download.fcitx-im.org/fcitx5"
307 "/fcitx5-qt/fcitx5-qt-"
308 version ".tar.xz"))
309 (sha256
310 (base32 "1gspj3s1nz6mqbp3z6js5zf7mqicwm32isxlqh6whhwawr9w7vrk"))))
311 (build-system cmake-build-system)
312 (arguments
313 `(#:configure-flags
314 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
315 %output "/lib/qt5/plugins")
316 "-DENABLE_QT4=Off")))
317 (inputs
318 `(("fcitx5" ,fcitx5)
319 ("libxcb" ,libxcb)
320 ("libxkbcommon" ,libxkbcommon)
321 ("qtbase" ,qtbase-5)
322 ("gettext" ,gettext-minimal)))
323 (native-inputs
324 (list extra-cmake-modules))
325 (home-page "https://github.com/fcitx/fcitx5-qt")
326 (synopsis "Qt library and IM module for Fcitx 5")
327 (description "Fcitx5-qt provides Qt library for development and IM module
328 for Qt based application.")
329 (license (list license:lgpl2.1+
330 ;; Files under qt4(Fcitx5Qt4DBusAddons), qt5/dbusaddons
331 ;; and qt5/platforminputcontext.
332 license:bsd-3))))
333
334 (define-public fcitx5-anthy
335 (package
336 (name "fcitx5-anthy")
337 (version "5.0.9")
338 (source
339 (origin
340 (method url-fetch)
341 (uri (string-append "https://download.fcitx-im.org/fcitx5"
342 "/fcitx5-anthy/fcitx5-anthy-"
343 version ".tar.xz"))
344 (sha256
345 (base32 "0i2ahfp1vh0cs3brcsfblzqwszal2qj1ncgb1hbc9v03s1j6bybk"))))
346 (build-system cmake-build-system)
347 (arguments
348 `(#:tests? #f)) ;; no tests
349 (inputs (list fcitx5 anthy gettext-minimal fmt))
350 (native-inputs
351 (list extra-cmake-modules pkg-config))
352 (home-page "https://github.com/fcitx/fcitx5-anthy")
353 (synopsis "Anthy Japanese language input for Fcitx 5")
354 (description "Fcitx5-Anthy provides Japanese input support to Fcitx5 using
355 the Anthy input method.")
356 (license license:gpl2+)))
357
358 (define-public fcitx5-chinese-addons
359 (package
360 (name "fcitx5-chinese-addons")
361 (version "5.0.6")
362 (source
363 (origin
364 (method url-fetch)
365 (uri (string-append "https://download.fcitx-im.org/fcitx5"
366 "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
367 version "_dict.tar.xz"))
368 (sha256
369 (base32 "11l76gpcfm0x1f6x5m9s37q7ffa7xcsdydlzjdz2s6kk45fvvq89"))))
370 (build-system cmake-build-system)
371 (arguments
372 `(#:configure-flags
373 '("-DUSE_WEBKIT=off")
374 #:phases
375 (modify-phases %standard-phases
376 (add-before 'configure 'split-outputs
377 ;; Build with GUI supports requires Qt and increase package closure
378 ;; by 800M on x86_64, so place it under another output.
379 (lambda* (#:key outputs #:allow-other-keys)
380 (substitute* "gui/pinyindictmanager/CMakeLists.txt"
381 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}" _)
382 (string-append (assoc-ref outputs "gui") "/lib"))))))))
383 (inputs
384 `(("fcitx5" ,fcitx5)
385 ("fcitx5-lua" ,fcitx5-lua)
386 ("boost" ,boost)
387 ("libime",libime)
388 ("curl" ,curl)
389 ("gettext" ,gettext-minimal)
390 ("fmt" ,fmt)
391 ("libpthread-stubs" ,libpthread-stubs)
392 ("opencc" ,opencc)
393 ("qtbase" ,qtbase-5)
394 ("fcitx5-qt" ,fcitx5-qt)
395 ("qtdeclarative-5" ,qtdeclarative-5)
396 ("qtwebchannel-5" ,qtwebchannel-5)
397 ("qtwebengine-5" ,qtwebengine-5)))
398 (native-inputs
399 (list extra-cmake-modules pkg-config))
400 (outputs '("out" "gui"))
401 (home-page "https://github.com/fcitx/fcitx5-chinese-addons")
402 (synopsis "Chinese related addons for Fcitx 5")
403 (description "Fcitx5-chinese-addons provides Chinese related addons,
404 including input methods previous bundled inside Fcitx 4:
405
406 @itemize
407 @item Bingchan
408 @item Cangjie
409 @item Erbi
410 @item Pinyin
411 @item Shuangpin
412 @item Wanfeng
413 @item Wubi
414 @item Wubi Pinyin
415 @item Ziranma
416 @end itemize\n")
417 (license (list license:lgpl2.1+
418 license:gpl2+
419 ;; im/pinyin/emoji.txt
420 license:unicode))))
421
422 (define-public fcitx5-configtool
423 (package
424 (name "fcitx5-configtool")
425 (version "5.0.8")
426 (source
427 (origin
428 (method url-fetch)
429 (uri (string-append
430 "https://download.fcitx-im.org/fcitx5"
431 "/fcitx5-configtool/fcitx5-configtool-" version ".tar.xz"))
432 (sha256
433 (base32 "0rajrw914mbl0x7h08cal0sszwyvqg6v3w0vs0c9acs6m438xbw4"))))
434 (build-system cmake-build-system)
435 (arguments
436 `(#:configure-flags
437 ;; KDE is currently not working on Guix, KCM supports doesn't make sense.
438 '("-DENABLE_KCM=Off")))
439 (inputs
440 `(("fcitx5" ,fcitx5)
441 ("fcitx5-qt" ,fcitx5-qt)
442 ("qtbase" ,qtbase-5)
443 ("qtx11extras" ,qtx11extras)
444 ("kitemviews" ,kitemviews)
445 ("kwidgetsaddons" ,kwidgetsaddons)
446 ("libx11" ,libx11)
447 ("xkeyboard-config" ,xkeyboard-config)
448 ("libxkbfile" ,libxkbfile)
449 ("gettext" ,gettext-minimal)
450 ("iso-codes" ,iso-codes)))
451 (native-inputs
452 (list extra-cmake-modules pkg-config))
453 (home-page "https://github.com/fcitx/fcitx5-configtool")
454 (synopsis "Graphical configuration tool for Fcitx 5")
455 (description "Fcitx5-configtool is a graphical configuration tool
456 to manage different input methods in Fcitx 5.")
457 (license license:gpl2+)))
458
459 (define-public fcitx5-material-color-theme
460 (package
461 (name "fcitx5-material-color-theme")
462 (version "0.1")
463 (source
464 (origin
465 (method git-fetch)
466 (uri (git-reference
467 (url "https://github.com/hosxy/Fcitx5-Material-Color")
468 (commit version)))
469 (file-name (git-file-name name version))
470 (sha256
471 (base32 "1mgc722521jmfx0xc3ibmiycd3q2w7xg2956xcpc07kz90gcdjaa"))))
472 (build-system copy-build-system)
473 (arguments
474 `(#:phases
475 (modify-phases %standard-phases
476 (replace 'install
477 (lambda* (#:key outputs #:allow-other-keys)
478 (use-modules (srfi srfi-26))
479
480 (let* ((out (assoc-ref outputs "out"))
481 (assets-dir (string-append
482 out "/share/fcitx5-material-color-theme"))
483 (themes-prefix (string-append out "/share/fcitx5/themes")))
484
485 (define (install-theme-variant variant target)
486 (let ((dir (string-append themes-prefix "/" target))
487 (png (string-append "panel-" variant ".png"))
488 (conf (string-append "theme-" variant ".conf")))
489 (format #t "install: Installing color variant \"~a\" to ~a~%"
490 variant dir)
491 (substitute* conf
492 (("^Name=.*")
493 (string-append "Name=" target "\n")))
494 (mkdir-p dir)
495 (install-file png dir)
496 (copy-file conf (string-append dir "/theme.conf"))
497 (symlink (string-append assets-dir "/arrow.png")
498 (string-append dir "/arrow.png"))))
499
500 (mkdir-p assets-dir)
501 (install-file "arrow.png" assets-dir)
502 (for-each
503 (lambda (x)
504 (install-theme-variant
505 x (string-append "Material-Color-" (string-capitalize x))))
506 '("black" "blue" "brown" "indigo"
507 "orange" "pink" "red" "teal"))
508
509 (install-theme-variant
510 "deepPurple" "Material-Color-DeepPurple")))))))
511 (home-page "https://github.com/hosxy/Fcitx5-Material-Color")
512 (synopsis "Material Design for Fcitx 5")
513 (description "Fcitx5-material-color-theme is a Material Design theme
514 for Fcitx 5 with following color variants:
515
516 @itemize
517 @item Black
518 @item Blue
519 @item Brown
520 @item Indigo
521 @item Orange
522 @item Pink
523 @item Red
524 @item teal
525 @item DeepPurple
526 @end itemize\n")
527 (license license:asl2.0)))