1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
4 ;;; This file is part of GNU Guix.
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.
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.
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/>.
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))
51 (define-public xcb-imdkit
59 "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
62 (base32 "16f7jdnrr8lrll7qvnj0gh3gwzgn5idfsc9rwi1gp1n2mnjrs7w0"))
63 (modules '((guix build utils)))
66 ;; Remove bundled uthash.
67 (delete-file-recursively "uthash")
69 (build-system cmake-build-system)
73 ("xcb-util" ,xcb-util)
74 ("xcb-util-keysyms" ,xcb-util-keysyms)))
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
84 (license license:lgpl2.1)))
94 "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
95 version "_dict.tar.xz"))
97 (base32 "14pqbjbdc3b5xlycm92gs1rgkmpykfnyls3gfr608902lk2lw5as"))))
98 (build-system cmake-build-system)
101 (list (string-append "-DCLDR_DIR="
102 (assoc-ref %build-inputs "unicode-cldr-common")
103 "/share/unicode/cldr"))))
106 ("cairo-xcb" ,cairo-xcb)
111 ("gdk-pixbuf" ,gdk-pixbuf)
112 ("gettext" ,gettext-minimal)
114 ("iso-codes" ,iso-codes)
116 ("libevent" ,libevent)
117 ("libpthread-stubs" ,libpthread-stubs)
118 ("libuuid" ,util-linux "lib")
121 ("libxfixes" ,libxfixes)
122 ("libxinerama" ,libxinerama)
123 ("libxkbcommon" ,libxkbcommon)
124 ("libxkbfile" ,libxkbfile)
126 ("unicode-cldr-common" ,unicode-cldr-common)
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)))
135 `(("extra-cmake-modules" ,extra-cmake-modules)
136 ("pkg-config" ,pkg-config)))
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+)))
146 (define-public fcitx5-lua
154 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
157 (base32 "0y5yc9102bz681f4wj6xqjxmfdmrshz3fhf39pa61718hkyy9lih"))))
158 (build-system cmake-build-system)
162 ("gettext" ,gettext-minimal)
163 ("libpthread-stubs" ,libpthread-stubs)))
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+)))
171 (define-public libime
178 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
179 version "_dict.tar.xz"))
181 (base32 "1gi9ylqha9x3dhjsa2i7x9wh2g9vgqkkfr6s1facs2ky65vgvdrv"))))
182 (build-system cmake-build-system)
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
194 (license license:lgpl2.1+)))
196 (define-public fcitx5-gtk
203 (uri (string-append "https://download.fcitx-im.org/fcitx5"
204 "/fcitx5-gtk/fcitx5-gtk-"
207 (base32 "0h53liraqc5nz4nyi3ixdfdw3zzkdcsiff7j25acc3gmaa5gyij7"))))
208 (build-system cmake-build-system)
210 `(#:tests? #f ;No test
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"))
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")))))))))
228 ("libxkbcommon" ,libxkbcommon)
229 ("gobject-introspection" ,gobject-introspection)
234 ("gettext" ,gettext-minimal)))
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+)))
247 (define-public fcitx5-qt
254 (uri (string-append "https://download.fcitx-im.org/fcitx5"
255 "/fcitx5-qt/fcitx5-qt-"
258 (base32 "0ilhb4yw9k3m1c4fidnv3nd5dgm9xxds11dgdys6gswjjnmcgqqm"))))
259 (build-system cmake-build-system)
262 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
263 %output "/lib/qt5/plugins")
264 "-DENABLE_QT4=Off")))
268 ("libxkbcommon" ,libxkbcommon)
270 ("gettext" ,gettext-minimal)))
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.
282 (define-public fcitx5-chinese-addons
284 (name "fcitx5-chinese-addons")
289 (uri (string-append "https://download.fcitx-im.org/fcitx5"
290 "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
291 version "_dict.tar.xz"))
293 (base32 "1kmzbllk0g86m2z3piwn9j84ihxixyxzv7rzj832xfvwqgk7gixk"))))
294 (build-system cmake-build-system)
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"))))))))
307 ("fcitx5-lua" ,fcitx5-lua)
311 ("gettext" ,gettext-minimal)
313 ("libpthread-stubs" ,libpthread-stubs)
316 ("fcitx5-qt" ,fcitx5-qt)
317 ("qtwebkit" ,qtwebkit)))
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:
338 (license (list license:lgpl2.1+
340 ;; im/pinyin/emoji.txt
343 (define-public fcitx5-configtool
345 (name "fcitx5-configtool")
351 "https://download.fcitx-im.org/fcitx5"
352 "/fcitx5-configtool/fcitx5-configtool-" version ".tar.xz"))
354 (base32 "0mrqhzvab41hkvhkz7vkb8d2mv5bgx4aqp9jpz4kf3kskwm1q14b"))))
355 (build-system cmake-build-system)
358 ;; KDE is currently not working on Guix, KCM supports doesn't make sense.
359 '("-DENABLE_KCM=Off")))
362 ("fcitx5-qt" ,fcitx5-qt)
364 ("qtx11extras" ,qtx11extras)
365 ("kitemviews" ,kitemviews)
366 ("kwidgetsaddons" ,kwidgetsaddons)
368 ("xkeyboard-config" ,xkeyboard-config)
369 ("libxkbfile" ,libxkbfile)
370 ("gettext" ,gettext-minimal)
371 ("iso-codes" ,iso-codes)))
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+)))
382 (define-public fcitx5-material-color-theme
384 (name "fcitx5-material-color-theme")
390 (url "https://github.com/hosxy/Fcitx5-Material-Color")
392 (file-name (git-file-name name version))
394 (base32 "1mgc722521jmfx0xc3ibmiycd3q2w7xg2956xcpc07kz90gcdjaa"))))
395 (build-system copy-build-system)
398 (modify-phases %standard-phases
400 (lambda* (#:key outputs #:allow-other-keys)
401 (use-modules (srfi srfi-26))
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")))
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~%"
416 (string-append "Name=" target "\n")))
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"))))
424 (install-file "arrow.png" assets-dir)
427 (install-theme-variant
428 x (string-append "Material-Color-" (string-capitalize x))))
429 '("black" "blue" "brown" "indigo"
430 "orange" "pink" "red" "teal"))
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:
450 (license license:asl2.0)))