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 "16j716xawbszkb3fxzpdza1a4czh0fvkysikjc9bfyvbwp72p6an"))))
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 `(("extra-cmake-modules" ,extra-cmake-modules)
137 ("pkg-config" ,pkg-config)))
139 (list (search-path-specification
140 (variable "FCITX_ADDON_DIRS")
141 (files '("lib/fcitx5")))))
142 (home-page "https://github.com/fcitx/fcitx5")
143 (synopsis "Input method framework")
144 (description "Fcitx 5 is a generic input method framework.")
145 (license license:lgpl2.1+)))
147 (define-public fcitx5-lua
155 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
158 (base32 "0y5yc9102bz681f4wj6xqjxmfdmrshz3fhf39pa61718hkyy9lih"))))
159 (build-system cmake-build-system)
163 ("gettext" ,gettext-minimal)
164 ("libpthread-stubs" ,libpthread-stubs)))
166 `(("extra-cmake-modules" ,extra-cmake-modules)))
167 (home-page "https://github.com/fcitx/fcitx5-lua")
168 (synopsis "Lua support for Fcitx 5")
169 (description "Fcitx5-lua allows writing Fcitx5 extension in Lua.")
170 (license license:lgpl2.1+)))
172 (define-public libime
179 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
180 version "_dict.tar.xz"))
182 (base32 "1s8gzpzyn16pg9gm7kw1nhl09drdndi6j4mjam14ymqsrfsdqr1r"))))
183 (build-system cmake-build-system)
188 `(("gcc" ,gcc-9) ;for #include <filesystem> and ld support
189 ("extra-cmake-modules" ,extra-cmake-modules)
190 ("python" ,python))) ;needed to run test
191 (home-page "https://github.com/fcitx/libime")
192 (synopsis "Library for implementing generic input method")
193 (description "Libime is a library for implementing various input methods
195 (license license:lgpl2.1+)))
197 (define-public fcitx5-gtk
204 (uri (string-append "https://download.fcitx-im.org/fcitx5"
205 "/fcitx5-gtk/fcitx5-gtk-"
208 (base32 "18bwwj9a5v82c6ssc8560hd8vwykakvg6sfijwdb5jswk9mafvgj"))))
209 (build-system cmake-build-system)
211 `(#:tests? #f ;No test
213 (list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
214 %output "/share/gir-1.0")
215 (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
216 %output "/lib/girepository-1.0")
217 ;; TODO: Enable it when Guix has GTK4.
218 "-DENABLE_GTK4_IM_MODULE=Off")
220 (modify-phases %standard-phases
221 (add-before 'configure 'patch-install-prefix
222 (lambda* (#:key outputs #:allow-other-keys)
223 (let ((out (assoc-ref outputs "out"))
224 (gtk2 (assoc-ref outputs "gtk2")))
225 ;; Install GTK+ 2 input method module to its own output.
226 (substitute* "gtk2/CMakeLists.txt"
227 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
228 (string-append gtk2 "/lib")))))))))
231 ("libxkbcommon" ,libxkbcommon)
232 ("gobject-introspection" ,gobject-introspection)
237 ("gettext" ,gettext-minimal)))
239 `(("extra-cmake-modules" ,extra-cmake-modules)
240 ("pkg-config" ,pkg-config)
241 ("glib" ,glib "bin"))) ;for glib-genmarshal
242 ;; TODO: Add "lib" output to reduce the closure size of "gtk2".
243 (outputs '("out" "gtk2"))
244 (home-page "https://github.com/fcitx/fcitx5-gtk")
245 (synopsis "Glib based D-Bus client and GTK IM module for Fcitx 5")
246 (description "Fcitx5-gtk provides a Glib based D-Bus client and IM module
247 for GTK+2/GTK+3 application.")
248 (license license:lgpl2.1+)))
250 (define-public fcitx5-qt
257 (uri (string-append "https://download.fcitx-im.org/fcitx5"
258 "/fcitx5-qt/fcitx5-qt-"
261 (base32 "0vsvrfv0b21pfrz5n0v6p458vfr8k7km50h9bhjp1bnssampjfsb"))))
262 (build-system cmake-build-system)
265 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
266 %output "/lib/qt5/plugins")
267 "-DENABLE_QT4=Off")))
271 ("libxkbcommon" ,libxkbcommon)
273 ("gettext" ,gettext-minimal)))
275 `(("extra-cmake-modules" ,extra-cmake-modules)))
276 (home-page "https://github.com/fcitx/fcitx5-qt")
277 (synopsis "Qt library and IM module for Fcitx 5")
278 (description "Fcitx5-qt provides Qt library for development and IM module
279 for Qt based application.")
280 (license (list license:lgpl2.1+
281 ;; Files under qt4(Fcitx5Qt4DBusAddons), qt5/dbusaddons
282 ;; and qt5/platforminputcontext.
285 (define-public fcitx5-chinese-addons
287 (name "fcitx5-chinese-addons")
292 (uri (string-append "https://download.fcitx-im.org/fcitx5"
293 "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
294 version "_dict.tar.xz"))
296 (base32 "1kmzbllk0g86m2z3piwn9j84ihxixyxzv7rzj832xfvwqgk7gixk"))))
297 (build-system cmake-build-system)
300 (modify-phases %standard-phases
301 (add-before 'configure 'split-outputs
302 ;; Build with GUI supports requires Qt and increase package closure
303 ;; by 800M on x86_64, so place it under another output.
304 (lambda* (#:key outputs #:allow-other-keys)
305 (substitute* "gui/pinyindictmanager/CMakeLists.txt"
306 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}" _)
307 (string-append (assoc-ref outputs "gui") "/lib"))))))))
310 ("fcitx5-lua" ,fcitx5-lua)
314 ("gettext" ,gettext-minimal)
316 ("libpthread-stubs" ,libpthread-stubs)
319 ("fcitx5-qt" ,fcitx5-qt)
320 ("qtwebkit" ,qtwebkit)))
322 `(("extra-cmake-modules" ,extra-cmake-modules)
323 ("pkg-config" ,pkg-config)))
324 (outputs '("out" "gui"))
325 (home-page "https://github.com/fcitx/fcitx5-chinese-addons")
326 (synopsis "Chinese related addons for Fcitx 5")
327 (description "Fcitx5-chinese-addons provides Chinese related addons,
328 including input methods previous bundled inside Fcitx 4:
341 (license (list license:lgpl2.1+
343 ;; im/pinyin/emoji.txt
346 (define-public fcitx5-configtool
348 (name "fcitx5-configtool")
354 "https://download.fcitx-im.org/fcitx5"
355 "/fcitx5-configtool/fcitx5-configtool-" version ".tar.xz"))
357 (base32 "0rpk3yn572pcr29jak63x84g0qgj8hj011aw8gmxjah9311nxhpb"))))
358 (build-system cmake-build-system)
361 ;; KDE is currently not working on Guix, KCM supports doesn't make sense.
362 '("-DENABLE_KCM=Off")))
365 ("fcitx5-qt" ,fcitx5-qt)
367 ("qtx11extras" ,qtx11extras)
368 ("kitemviews" ,kitemviews)
369 ("kwidgetsaddons" ,kwidgetsaddons)
371 ("xkeyboard-config" ,xkeyboard-config)
372 ("libxkbfile" ,libxkbfile)
373 ("gettext" ,gettext-minimal)
374 ("iso-codes" ,iso-codes)))
377 ("extra-cmake-modules" ,extra-cmake-modules)
378 ("pkg-config" ,pkg-config)))
379 (home-page "https://github.com/fcitx/fcitx5-configtool")
380 (synopsis "Graphical configuration tool for Fcitx 5")
381 (description "Fcitx5-configtool is a graphical configuration tool
382 to manage different input methods in Fcitx 5.")
383 (license license:gpl2+)))
385 (define-public fcitx5-material-color-theme
387 (name "fcitx5-material-color-theme")
393 (url "https://github.com/hosxy/Fcitx5-Material-Color")
395 (file-name (git-file-name name version))
397 (base32 "1mgc722521jmfx0xc3ibmiycd3q2w7xg2956xcpc07kz90gcdjaa"))))
398 (build-system copy-build-system)
401 (modify-phases %standard-phases
403 (lambda* (#:key outputs #:allow-other-keys)
404 (use-modules (srfi srfi-26))
406 (let* ((out (assoc-ref outputs "out"))
407 (assets-dir (string-append
408 out "/share/fcitx5-material-color-theme"))
409 (themes-prefix (string-append out "/share/fcitx5/themes")))
411 (define (install-theme-variant variant target)
412 (let ((dir (string-append themes-prefix "/" target))
413 (png (string-append "panel-" variant ".png"))
414 (conf (string-append "theme-" variant ".conf")))
415 (format #t "install: Installing color variant \"~a\" to ~a~%"
419 (string-append "Name=" target "\n")))
421 (install-file png dir)
422 (copy-file conf (string-append dir "/theme.conf"))
423 (symlink (string-append assets-dir "/arrow.png")
424 (string-append dir "/arrow.png"))))
427 (install-file "arrow.png" assets-dir)
430 (install-theme-variant
431 x (string-append "Material-Color-" (string-capitalize x))))
432 '("black" "blue" "brown" "indigo"
433 "orange" "pink" "red" "teal"))
435 (install-theme-variant
436 "deepPurple" "Material-Color-DeepPurple")))))))
437 (home-page "https://github.com/hosxy/Fcitx5-Material-Color")
438 (synopsis "Material Design for Fcitx 5")
439 (description "Fcitx5-material-color-theme is a Material Design theme
440 for Fcitx 5 with following color variants:
453 (license license:asl2.0)))