gnu: emacs-helm: Update to 3.8.7.
[jackhill/guix/guix.git] / gnu / packages / fcitx5.scm
CommitLineData
ad6cf3d4 1;;; GNU Guix --- Functional package management for GNU
de744389 2;;; Copyright © 2020, 2022 Zhu Zihao <all_but_last@163.com>
4685a468 3;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
93c3bcc3 4;;; Copyright © 2022 Dominic Martinez <dom@dominicm.dev>
ad6cf3d4
ZZ
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)
de744389 24 #:use-module (guix gexp)
af34f757 25 #:use-module (guix git-download)
ad6cf3d4 26 #:use-module (guix build-system cmake)
af34f757 27 #:use-module (guix build-system copy)
ad6cf3d4 28 #:use-module ((guix licenses) #:prefix license:)
93c3bcc3 29 #:use-module (gnu packages anthy)
69d3419c 30 #:use-module (gnu packages boost)
9a23698e 31 #:use-module (gnu packages curl)
ad6cf3d4 32 #:use-module (gnu packages datastructures)
aa5cfb39
ZZ
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)
ad6cf3d4 39 #:use-module (gnu packages kde-frameworks)
aa5cfb39
ZZ
40 #:use-module (gnu packages libevent)
41 #:use-module (gnu packages linux)
2d07803b 42 #:use-module (gnu packages lua)
ad6cf3d4 43 #:use-module (gnu packages pkg-config)
aa5cfb39 44 #:use-module (gnu packages pretty-print)
69d3419c 45 #:use-module (gnu packages python)
4394d372 46 #:use-module (gnu packages qt)
9a23698e 47 #:use-module (gnu packages textutils)
aa5cfb39
ZZ
48 #:use-module (gnu packages unicode)
49 #:use-module (gnu packages web)
50 #:use-module (gnu packages xdisorg)
51 #:use-module (gnu packages xml)
ad6cf3d4
ZZ
52 #:use-module (gnu packages xorg))
53
54(define-public xcb-imdkit
55 (package
56 (name "xcb-imdkit")
688c066e 57 (version "1.0.3")
ad6cf3d4
ZZ
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
688c066e 65 (base32 "1s58vjkdrgr8h183jz4b4mjn7pbvdc9cli01cn66mgczl9p65hh9"))
ad6cf3d4
ZZ
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
8394619b 74 (list uthash libxcb xcb-util xcb-util-keysyms))
ad6cf3d4 75 (native-inputs
8394619b 76 (list extra-cmake-modules pkg-config))
ad6cf3d4
ZZ
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,
80comparing with the implementation of IMDkit with Xlib, and xim inside Xlib, it
81has less memory foot print, better performance, and safer on malformed
82client.")
83 (license license:lgpl2.1)))
aa5cfb39
ZZ
84
85(define-public fcitx5
86 (package
87 (name "fcitx5")
fcc4d62d 88 (version "5.0.10")
aa5cfb39
ZZ
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
fcc4d62d 96 (base32 "0i23skr49n6b30ybm66bkv07dcr0dan5mzxch7x83znfnrpk8z3h"))))
aa5cfb39
ZZ
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
e661f4ef 134 (list extra-cmake-modules pkg-config))
aa5cfb39
ZZ
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+)))
2d07803b
ZZ
143
144(define-public fcitx5-lua
145 (package
146 (name "fcitx5-lua")
8127bcaa 147 (version "5.0.5")
2d07803b
ZZ
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
8127bcaa 155 (base32 "0f3raxzkq0nwdfpc9hxvg65vga09gznjjgy9dr6jlkamzx8zlyw9"))))
2d07803b 156 (build-system cmake-build-system)
2d07803b 157 (inputs
e3196755 158 (list fcitx5 lua gettext-minimal libpthread-stubs))
2d07803b 159 (native-inputs
8394619b 160 (list extra-cmake-modules))
2d07803b
ZZ
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+)))
69d3419c
ZZ
165
166(define-public libime
167 (package
168 (name "libime")
71d56cfa 169 (version "1.0.10")
69d3419c
ZZ
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
71d56cfa 176 (base32 "0dknxf5lf5a6kam39rp7y1h2p47bwb6pnlc8fsrhmiv7rw2pkq0f"))))
69d3419c
ZZ
177 (build-system cmake-build-system)
178 (inputs
8394619b 179 (list fcitx5 boost))
69d3419c 180 (native-inputs
e661f4ef 181 (list extra-cmake-modules python)) ;needed to run test
69d3419c 182 (home-page "https://github.com/fcitx/libime")
86a1080a
TGR
183 (synopsis "Library for implementing generic input methods")
184 (description "Libime is a library for implementing various input method
69d3419c
ZZ
185editors.")
186 (license license:lgpl2.1+)))
4394d372 187
d4aca38b
ZZ
188(define-public fcitx5-gtk
189 (package
190 (name "fcitx5-gtk")
d16650c0 191 (version "5.0.9")
d4aca38b
ZZ
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
d16650c0 199 (base32 "07ip4sxf3q895pp7mivv2bdwcmqjnwrmv9pg99jk73cw9bgyq00n"))))
d4aca38b
ZZ
200 (build-system cmake-build-system)
201 (arguments
de744389
ZZ
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="
ef3cae59
ZZ
208 #$output "/lib/girepository-1.0")
209 "-DENABLE_GTK4_IM_MODULE=OFF")
de744389
ZZ
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"))))
6616f044 220
de744389 221 (let ((gtk2 #$output:gtk2)
ef3cae59 222 (gtk3 #$output:gtk3))
de744389 223 (for-each split-immodule
ef3cae59
ZZ
224 '("gtk2" "gtk3")
225 (list gtk2 gtk3))))))))
d4aca38b 226 (inputs
de744389
ZZ
227 (list fcitx5
228 fmt
229 libx11
230 libxkbcommon
231 gettext-minimal
232 gobject-introspection
233 gtk+-2
234 gtk+
de744389 235 glib))
d4aca38b 236 (native-inputs
8394619b
LC
237 (list extra-cmake-modules pkg-config
238 `(,glib "bin"))) ;for glib-genmarshal
ef3cae59 239 (outputs '("out" "gtk2" "gtk3"))
d4aca38b 240 (home-page "https://github.com/fcitx/fcitx5-gtk")
de744389
ZZ
241 (synopsis "GLib-based D-Bus client and GTK IM module for Fcitx 5")
242 (description "Fcitx5-gtk provides the following functionality in the
243corresponding output:
244
245@table @code
246@item out
247GLib-based D-Bus client of Fcitx5.
248@item gtk2
249IM module for GTK+2 applications.
250@item gtk3
251IM module for GTK+3 applications.
de744389 252@end table")
d4aca38b
ZZ
253 (license license:lgpl2.1+)))
254
287b9803
ZZ
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
4394d372
ZZ
299(define-public fcitx5-qt
300 (package
301 (name "fcitx5-qt")
dcf48a17 302 (version "5.0.7")
4394d372
ZZ
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
dcf48a17 310 (base32 "1gspj3s1nz6mqbp3z6js5zf7mqicwm32isxlqh6whhwawr9w7vrk"))))
4394d372
ZZ
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)
ea0a5107 321 ("qtbase" ,qtbase-5)
4394d372
ZZ
322 ("gettext" ,gettext-minimal)))
323 (native-inputs
8394619b 324 (list extra-cmake-modules))
4394d372
ZZ
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
328for Qt based application.")
329 (license (list license:lgpl2.1+
330 ;; Files under qt4(Fcitx5Qt4DBusAddons), qt5/dbusaddons
331 ;; and qt5/platforminputcontext.
332 license:bsd-3))))
9a23698e 333
93c3bcc3
DM
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
355the Anthy input method.")
356 (license license:gpl2+)))
357
9a23698e
ZZ
358(define-public fcitx5-chinese-addons
359 (package
360 (name "fcitx5-chinese-addons")
86bb7760 361 (version "5.0.6")
9a23698e
ZZ
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
86bb7760 369 (base32 "11l76gpcfm0x1f6x5m9s37q7ffa7xcsdydlzjdz2s6kk45fvvq89"))))
9a23698e
ZZ
370 (build-system cmake-build-system)
371 (arguments
db17f8b5
LF
372 `(#:configure-flags
373 '("-DUSE_WEBKIT=off")
374 #:phases
9a23698e 375 (modify-phases %standard-phases
9a23698e
ZZ
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)
ea0a5107 393 ("qtbase" ,qtbase-5)
9a23698e 394 ("fcitx5-qt" ,fcitx5-qt)
735d340a 395 ("qtdeclarative-5" ,qtdeclarative-5)
0938c3e3 396 ("qtwebchannel-5" ,qtwebchannel-5)
a0beb297 397 ("qtwebengine-5" ,qtwebengine-5)))
9a23698e 398 (native-inputs
8394619b 399 (list extra-cmake-modules pkg-config))
9a23698e
ZZ
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,
404including 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))))
ac1c7530
ZZ
421
422(define-public fcitx5-configtool
423 (package
441b93ce 424 (name "fcitx5-configtool")
159ee051 425 (version "5.0.8")
441b93ce
ZZ
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
159ee051 433 (base32 "0rajrw914mbl0x7h08cal0sszwyvqg6v3w0vs0c9acs6m438xbw4"))))
441b93ce
ZZ
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)
ea0a5107 442 ("qtbase" ,qtbase-5)
441b93ce
ZZ
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
e661f4ef 452 (list extra-cmake-modules pkg-config))
441b93ce
ZZ
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
ac1c7530 456to manage different input methods in Fcitx 5.")
441b93ce 457 (license license:gpl2+)))
af34f757
ZZ
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)))
adbb62f1 469 (file-name (git-file-name name version))
af34f757
ZZ
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
514for 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)))