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>
5 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
52 (define-public xcb-imdkit
60 "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
63 (base32 "1s58vjkdrgr8h183jz4b4mjn7pbvdc9cli01cn66mgczl9p65hh9"))
64 (modules '((guix build utils)))
67 ;; Remove bundled uthash.
68 (delete-file-recursively "uthash")
70 (build-system cmake-build-system)
74 ("xcb-util" ,xcb-util)
75 ("xcb-util-keysyms" ,xcb-util-keysyms)))
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
85 (license license:lgpl2.1)))
95 "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
96 version "_dict.tar.xz"))
98 (base32 "0536sjpgjlg0bf8imz4jf9bdsp7fhm09bkssddji56cc9mgdxx82"))))
99 (build-system cmake-build-system)
102 (list (string-append "-DCLDR_DIR="
103 (assoc-ref %build-inputs "unicode-cldr-common")
104 "/share/unicode/cldr"))))
107 ("cairo-xcb" ,cairo-xcb)
112 ("gdk-pixbuf" ,gdk-pixbuf)
113 ("gettext" ,gettext-minimal)
115 ("iso-codes" ,iso-codes)
117 ("libevent" ,libevent)
118 ("libpthread-stubs" ,libpthread-stubs)
119 ("libuuid" ,util-linux "lib")
122 ("libxfixes" ,libxfixes)
123 ("libxinerama" ,libxinerama)
124 ("libxkbcommon" ,libxkbcommon)
125 ("libxkbfile" ,libxkbfile)
127 ("unicode-cldr-common" ,unicode-cldr-common)
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)))
136 `(("gcc" ,gcc-9) ; for #include <charconv>
137 ("extra-cmake-modules" ,extra-cmake-modules)
138 ("pkg-config" ,pkg-config)))
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+)))
148 (define-public fcitx5-lua
156 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
159 (base32 "0f3raxzkq0nwdfpc9hxvg65vga09gznjjgy9dr6jlkamzx8zlyw9"))))
160 (build-system cmake-build-system)
164 ("gettext" ,gettext-minimal)
165 ("libpthread-stubs" ,libpthread-stubs)))
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+)))
173 (define-public libime
180 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
181 version "_dict.tar.xz"))
183 (base32 "06smx1kqq3qh0xra8070cjfhw79hcm0vksrswk05wq6jyhvrk5sd"))))
184 (build-system cmake-build-system)
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
196 (license license:lgpl2.1+)))
198 (define-public fcitx5-gtk
205 (uri (string-append "https://download.fcitx-im.org/fcitx5"
206 "/fcitx5-gtk/fcitx5-gtk-"
209 (base32 "0x9xwyb3hnb2xl47jkj8zs34fhyf7gshy3bv3jxd66sfkjrscr5v"))))
210 (build-system cmake-build-system)
212 `(#:tests? #f ;No test
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")
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")))))))))
233 ("libxkbcommon" ,libxkbcommon)
234 ("gobject-introspection" ,gobject-introspection)
239 ("gettext" ,gettext-minimal)))
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+)))
252 (define-public fcitx5-qt
259 (uri (string-append "https://download.fcitx-im.org/fcitx5"
260 "/fcitx5-qt/fcitx5-qt-"
263 (base32 "0wp88cmy0gn15gkfzl5z4q4qd9j1ssdmgp1rfsbw0cp3qh5x4m69"))))
264 (build-system cmake-build-system)
267 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
268 %output "/lib/qt5/plugins")
269 "-DENABLE_QT4=Off")))
273 ("libxkbcommon" ,libxkbcommon)
275 ("gettext" ,gettext-minimal)))
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.
287 (define-public fcitx5-chinese-addons
289 (name "fcitx5-chinese-addons")
294 (uri (string-append "https://download.fcitx-im.org/fcitx5"
295 "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
296 version "_dict.tar.xz"))
298 (base32 "11l76gpcfm0x1f6x5m9s37q7ffa7xcsdydlzjdz2s6kk45fvvq89"))))
299 (build-system cmake-build-system)
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"))))))))
312 ("fcitx5-lua" ,fcitx5-lua)
316 ("gettext" ,gettext-minimal)
318 ("libpthread-stubs" ,libpthread-stubs)
321 ("fcitx5-qt" ,fcitx5-qt)
322 ("qtwebkit" ,qtwebkit)))
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:
343 (license (list license:lgpl2.1+
345 ;; im/pinyin/emoji.txt
348 (define-public fcitx5-configtool
350 (name "fcitx5-configtool")
356 "https://download.fcitx-im.org/fcitx5"
357 "/fcitx5-configtool/fcitx5-configtool-" version ".tar.xz"))
359 (base32 "1diwiniqvsvcdwzcx1dqxbvwsr6ajbxs67my0cpn8n22asd5mx8i"))))
360 (build-system cmake-build-system)
363 ;; KDE is currently not working on Guix, KCM supports doesn't make sense.
364 '("-DENABLE_KCM=Off")))
367 ("fcitx5-qt" ,fcitx5-qt)
369 ("qtx11extras" ,qtx11extras)
370 ("kitemviews" ,kitemviews)
371 ("kwidgetsaddons" ,kwidgetsaddons)
373 ("xkeyboard-config" ,xkeyboard-config)
374 ("libxkbfile" ,libxkbfile)
375 ("gettext" ,gettext-minimal)
376 ("iso-codes" ,iso-codes)))
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+)))
387 (define-public fcitx5-material-color-theme
389 (name "fcitx5-material-color-theme")
395 (url "https://github.com/hosxy/Fcitx5-Material-Color")
397 (file-name (git-file-name name version))
399 (base32 "1mgc722521jmfx0xc3ibmiycd3q2w7xg2956xcpc07kz90gcdjaa"))))
400 (build-system copy-build-system)
403 (modify-phases %standard-phases
405 (lambda* (#:key outputs #:allow-other-keys)
406 (use-modules (srfi srfi-26))
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")))
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~%"
421 (string-append "Name=" target "\n")))
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"))))
429 (install-file "arrow.png" assets-dir)
432 (install-theme-variant
433 x (string-append "Material-Color-" (string-capitalize x))))
434 '("black" "blue" "brown" "indigo"
435 "orange" "pink" "red" "teal"))
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:
455 (license license:asl2.0)))