gnu: Add python-pyshp.
[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.8")
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 "0536sjpgjlg0bf8imz4jf9bdsp7fhm09bkssddji56cc9mgdxx82"))))
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 `(("gcc" ,gcc-9) ; for #include <charconv>
137 ("extra-cmake-modules" ,extra-cmake-modules)
138 ("pkg-config" ,pkg-config)))
139 (native-search-paths
140 (list (search-path-specification
141 (variable "FCITX_ADDON_DIRS")
142 (files '("lib/fcitx5")))))
143 (home-page "https://github.com/fcitx/fcitx5")
144 (synopsis "Input method framework")
145 (description "Fcitx 5 is a generic input method framework.")
146 (license license:lgpl2.1+)))
147
148 (define-public fcitx5-lua
149 (package
150 (name "fcitx5-lua")
151 (version "5.0.5")
152 (source
153 (origin
154 (method url-fetch)
155 (uri (string-append
156 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
157 version ".tar.xz"))
158 (sha256
159 (base32 "0f3raxzkq0nwdfpc9hxvg65vga09gznjjgy9dr6jlkamzx8zlyw9"))))
160 (build-system cmake-build-system)
161 (inputs
162 `(("fcitx5" ,fcitx5)
163 ("lua" ,lua)
164 ("gettext" ,gettext-minimal)
165 ("libpthread-stubs" ,libpthread-stubs)))
166 (native-inputs
167 `(("extra-cmake-modules" ,extra-cmake-modules)))
168 (home-page "https://github.com/fcitx/fcitx5-lua")
169 (synopsis "Lua support for Fcitx 5")
170 (description "Fcitx5-lua allows writing Fcitx5 extension in Lua.")
171 (license license:lgpl2.1+)))
172
173 (define-public libime
174 (package
175 (name "libime")
176 (version "1.0.7")
177 (source
178 (origin
179 (method url-fetch)
180 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
181 version "_dict.tar.xz"))
182 (sha256
183 (base32 "06smx1kqq3qh0xra8070cjfhw79hcm0vksrswk05wq6jyhvrk5sd"))))
184 (build-system cmake-build-system)
185 (inputs
186 `(("fcitx5" ,fcitx5)
187 ("boost" ,boost)))
188 (native-inputs
189 `(("gcc" ,gcc-9) ;for #include <filesystem> and ld support
190 ("extra-cmake-modules" ,extra-cmake-modules)
191 ("python" ,python))) ;needed to run test
192 (home-page "https://github.com/fcitx/libime")
193 (synopsis "Library for implementing generic input methods")
194 (description "Libime is a library for implementing various input method
195 editors.")
196 (license license:lgpl2.1+)))
197
198 (define-public fcitx5-gtk
199 (package
200 (name "fcitx5-gtk")
201 (version "5.0.7")
202 (source
203 (origin
204 (method url-fetch)
205 (uri (string-append "https://download.fcitx-im.org/fcitx5"
206 "/fcitx5-gtk/fcitx5-gtk-"
207 version ".tar.xz"))
208 (sha256
209 (base32 "0x9xwyb3hnb2xl47jkj8zs34fhyf7gshy3bv3jxd66sfkjrscr5v"))))
210 (build-system cmake-build-system)
211 (arguments
212 `(#:tests? #f ;No test
213 #:configure-flags
214 (list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
215 %output "/share/gir-1.0")
216 (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
217 %output "/lib/girepository-1.0")
218 ;; TODO: Enable it when Guix has GTK4.
219 "-DENABLE_GTK4_IM_MODULE=Off")
220 #:phases
221 (modify-phases %standard-phases
222 (add-before 'configure 'patch-install-prefix
223 (lambda* (#:key outputs #:allow-other-keys)
224 (let ((out (assoc-ref outputs "out"))
225 (gtk2 (assoc-ref outputs "gtk2")))
226 ;; Install GTK+ 2 input method module to its own output.
227 (substitute* "gtk2/CMakeLists.txt"
228 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
229 (string-append gtk2 "/lib")))))))))
230 (inputs
231 `(("fcitx5" ,fcitx5)
232 ("fmt" ,fmt)
233 ("libxkbcommon" ,libxkbcommon)
234 ("gobject-introspection" ,gobject-introspection)
235 ("gtk2" ,gtk+-2)
236 ("gtk3" ,gtk+)
237 ("glib" ,glib)
238 ("libx11" ,libx11)
239 ("gettext" ,gettext-minimal)))
240 (native-inputs
241 `(("extra-cmake-modules" ,extra-cmake-modules)
242 ("pkg-config" ,pkg-config)
243 ("glib" ,glib "bin"))) ;for glib-genmarshal
244 ;; TODO: Add "lib" output to reduce the closure size of "gtk2".
245 (outputs '("out" "gtk2"))
246 (home-page "https://github.com/fcitx/fcitx5-gtk")
247 (synopsis "Glib based D-Bus client and GTK IM module for Fcitx 5")
248 (description "Fcitx5-gtk provides a Glib based D-Bus client and IM module
249 for GTK+2/GTK+3 application.")
250 (license license:lgpl2.1+)))
251
252 (define-public fcitx5-qt
253 (package
254 (name "fcitx5-qt")
255 (version "5.0.6")
256 (source
257 (origin
258 (method url-fetch)
259 (uri (string-append "https://download.fcitx-im.org/fcitx5"
260 "/fcitx5-qt/fcitx5-qt-"
261 version ".tar.xz"))
262 (sha256
263 (base32 "0wp88cmy0gn15gkfzl5z4q4qd9j1ssdmgp1rfsbw0cp3qh5x4m69"))))
264 (build-system cmake-build-system)
265 (arguments
266 `(#:configure-flags
267 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
268 %output "/lib/qt5/plugins")
269 "-DENABLE_QT4=Off")))
270 (inputs
271 `(("fcitx5" ,fcitx5)
272 ("libxcb" ,libxcb)
273 ("libxkbcommon" ,libxkbcommon)
274 ("qtbase" ,qtbase-5)
275 ("gettext" ,gettext-minimal)))
276 (native-inputs
277 `(("extra-cmake-modules" ,extra-cmake-modules)))
278 (home-page "https://github.com/fcitx/fcitx5-qt")
279 (synopsis "Qt library and IM module for Fcitx 5")
280 (description "Fcitx5-qt provides Qt library for development and IM module
281 for Qt based application.")
282 (license (list license:lgpl2.1+
283 ;; Files under qt4(Fcitx5Qt4DBusAddons), qt5/dbusaddons
284 ;; and qt5/platforminputcontext.
285 license:bsd-3))))
286
287 (define-public fcitx5-chinese-addons
288 (package
289 (name "fcitx5-chinese-addons")
290 (version "5.0.6")
291 (source
292 (origin
293 (method url-fetch)
294 (uri (string-append "https://download.fcitx-im.org/fcitx5"
295 "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
296 version "_dict.tar.xz"))
297 (sha256
298 (base32 "11l76gpcfm0x1f6x5m9s37q7ffa7xcsdydlzjdz2s6kk45fvvq89"))))
299 (build-system cmake-build-system)
300 (arguments
301 `(#:phases
302 (modify-phases %standard-phases
303 (add-before 'configure 'split-outputs
304 ;; Build with GUI supports requires Qt and increase package closure
305 ;; by 800M on x86_64, so place it under another output.
306 (lambda* (#:key outputs #:allow-other-keys)
307 (substitute* "gui/pinyindictmanager/CMakeLists.txt"
308 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}" _)
309 (string-append (assoc-ref outputs "gui") "/lib"))))))))
310 (inputs
311 `(("fcitx5" ,fcitx5)
312 ("fcitx5-lua" ,fcitx5-lua)
313 ("boost" ,boost)
314 ("libime",libime)
315 ("curl" ,curl)
316 ("gettext" ,gettext-minimal)
317 ("fmt" ,fmt)
318 ("libpthread-stubs" ,libpthread-stubs)
319 ("opencc" ,opencc)
320 ("qtbase" ,qtbase-5)
321 ("fcitx5-qt" ,fcitx5-qt)
322 ("qtwebkit" ,qtwebkit)))
323 (native-inputs
324 `(("extra-cmake-modules" ,extra-cmake-modules)
325 ("pkg-config" ,pkg-config)))
326 (outputs '("out" "gui"))
327 (home-page "https://github.com/fcitx/fcitx5-chinese-addons")
328 (synopsis "Chinese related addons for Fcitx 5")
329 (description "Fcitx5-chinese-addons provides Chinese related addons,
330 including input methods previous bundled inside Fcitx 4:
331
332 @itemize
333 @item Bingchan
334 @item Cangjie
335 @item Erbi
336 @item Pinyin
337 @item Shuangpin
338 @item Wanfeng
339 @item Wubi
340 @item Wubi Pinyin
341 @item Ziranma
342 @end itemize\n")
343 (license (list license:lgpl2.1+
344 license:gpl2+
345 ;; im/pinyin/emoji.txt
346 license:unicode))))
347
348 (define-public fcitx5-configtool
349 (package
350 (name "fcitx5-configtool")
351 (version "5.0.5")
352 (source
353 (origin
354 (method url-fetch)
355 (uri (string-append
356 "https://download.fcitx-im.org/fcitx5"
357 "/fcitx5-configtool/fcitx5-configtool-" version ".tar.xz"))
358 (sha256
359 (base32 "1diwiniqvsvcdwzcx1dqxbvwsr6ajbxs67my0cpn8n22asd5mx8i"))))
360 (build-system cmake-build-system)
361 (arguments
362 `(#:configure-flags
363 ;; KDE is currently not working on Guix, KCM supports doesn't make sense.
364 '("-DENABLE_KCM=Off")))
365 (inputs
366 `(("fcitx5" ,fcitx5)
367 ("fcitx5-qt" ,fcitx5-qt)
368 ("qtbase" ,qtbase-5)
369 ("qtx11extras" ,qtx11extras)
370 ("kitemviews" ,kitemviews)
371 ("kwidgetsaddons" ,kwidgetsaddons)
372 ("libx11" ,libx11)
373 ("xkeyboard-config" ,xkeyboard-config)
374 ("libxkbfile" ,libxkbfile)
375 ("gettext" ,gettext-minimal)
376 ("iso-codes" ,iso-codes)))
377 (native-inputs
378 `(("gcc" ,gcc-9)
379 ("extra-cmake-modules" ,extra-cmake-modules)
380 ("pkg-config" ,pkg-config)))
381 (home-page "https://github.com/fcitx/fcitx5-configtool")
382 (synopsis "Graphical configuration tool for Fcitx 5")
383 (description "Fcitx5-configtool is a graphical configuration tool
384 to manage different input methods in Fcitx 5.")
385 (license license:gpl2+)))
386
387 (define-public fcitx5-material-color-theme
388 (package
389 (name "fcitx5-material-color-theme")
390 (version "0.1")
391 (source
392 (origin
393 (method git-fetch)
394 (uri (git-reference
395 (url "https://github.com/hosxy/Fcitx5-Material-Color")
396 (commit version)))
397 (file-name (git-file-name name version))
398 (sha256
399 (base32 "1mgc722521jmfx0xc3ibmiycd3q2w7xg2956xcpc07kz90gcdjaa"))))
400 (build-system copy-build-system)
401 (arguments
402 `(#:phases
403 (modify-phases %standard-phases
404 (replace 'install
405 (lambda* (#:key outputs #:allow-other-keys)
406 (use-modules (srfi srfi-26))
407
408 (let* ((out (assoc-ref outputs "out"))
409 (assets-dir (string-append
410 out "/share/fcitx5-material-color-theme"))
411 (themes-prefix (string-append out "/share/fcitx5/themes")))
412
413 (define (install-theme-variant variant target)
414 (let ((dir (string-append themes-prefix "/" target))
415 (png (string-append "panel-" variant ".png"))
416 (conf (string-append "theme-" variant ".conf")))
417 (format #t "install: Installing color variant \"~a\" to ~a~%"
418 variant dir)
419 (substitute* conf
420 (("^Name=.*")
421 (string-append "Name=" target "\n")))
422 (mkdir-p dir)
423 (install-file png dir)
424 (copy-file conf (string-append dir "/theme.conf"))
425 (symlink (string-append assets-dir "/arrow.png")
426 (string-append dir "/arrow.png"))))
427
428 (mkdir-p assets-dir)
429 (install-file "arrow.png" assets-dir)
430 (for-each
431 (lambda (x)
432 (install-theme-variant
433 x (string-append "Material-Color-" (string-capitalize x))))
434 '("black" "blue" "brown" "indigo"
435 "orange" "pink" "red" "teal"))
436
437 (install-theme-variant
438 "deepPurple" "Material-Color-DeepPurple")))))))
439 (home-page "https://github.com/hosxy/Fcitx5-Material-Color")
440 (synopsis "Material Design for Fcitx 5")
441 (description "Fcitx5-material-color-theme is a Material Design theme
442 for Fcitx 5 with following color variants:
443
444 @itemize
445 @item Black
446 @item Blue
447 @item Brown
448 @item Indigo
449 @item Orange
450 @item Pink
451 @item Red
452 @item teal
453 @item DeepPurple
454 @end itemize\n")
455 (license license:asl2.0)))