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