1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020, 2022 Zhu Zihao <all_but_last@163.com>
3 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
4 ;;; Copyright © 2022 Dominic Martinez <dom@dominicm.dev>
6 ;;; This file is part of GNU Guix.
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21 (define-module (gnu packages fcitx5)
22 #:use-module (guix packages)
23 #:use-module (guix download)
24 #:use-module (guix gexp)
25 #:use-module (guix git-download)
26 #:use-module (guix build-system cmake)
27 #:use-module (guix build-system copy)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (gnu packages anthy)
30 #:use-module (gnu packages boost)
31 #:use-module (gnu packages curl)
32 #:use-module (gnu packages datastructures)
33 #:use-module (gnu packages enchant)
34 #:use-module (gnu packages freedesktop)
35 #:use-module (gnu packages gettext)
36 #:use-module (gnu packages glib)
37 #:use-module (gnu packages gtk)
38 #:use-module (gnu packages iso-codes)
39 #:use-module (gnu packages kde-frameworks)
40 #:use-module (gnu packages libevent)
41 #:use-module (gnu packages linux)
42 #:use-module (gnu packages lua)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages pretty-print)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages qt)
47 #:use-module (gnu packages textutils)
48 #:use-module (gnu packages unicode)
49 #:use-module (gnu packages web)
50 #:use-module (gnu packages xdisorg)
51 #:use-module (gnu packages xml)
52 #:use-module (gnu packages xorg))
54 (define-public xcb-imdkit
62 "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
65 (base32 "1s58vjkdrgr8h183jz4b4mjn7pbvdc9cli01cn66mgczl9p65hh9"))
66 (modules '((guix build utils)))
69 ;; Remove bundled uthash.
70 (delete-file-recursively "uthash")
72 (build-system cmake-build-system)
74 (list uthash libxcb xcb-util xcb-util-keysyms))
76 (list extra-cmake-modules pkg-config))
77 (home-page "https://github.com/fcitx/xcb-imdkit")
78 (synopsis "Input method development support for XCB")
79 (description "Xcb-imdkit is an implementation of xim protocol in XCB,
80 comparing with the implementation of IMDkit with Xlib, and xim inside Xlib, it
81 has less memory foot print, better performance, and safer on malformed
83 (license license:lgpl2.1)))
93 "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
94 version "_dict.tar.xz"))
96 (base32 "0i23skr49n6b30ybm66bkv07dcr0dan5mzxch7x83znfnrpk8z3h"))))
97 (build-system cmake-build-system)
100 (list (string-append "-DCLDR_DIR="
101 (assoc-ref %build-inputs "unicode-cldr-common")
102 "/share/unicode/cldr"))))
105 ("cairo-xcb" ,cairo-xcb)
110 ("gdk-pixbuf" ,gdk-pixbuf)
111 ("gettext" ,gettext-minimal)
113 ("iso-codes" ,iso-codes)
115 ("libevent" ,libevent)
116 ("libpthread-stubs" ,libpthread-stubs)
117 ("libuuid" ,util-linux "lib")
120 ("libxfixes" ,libxfixes)
121 ("libxinerama" ,libxinerama)
122 ("libxkbcommon" ,libxkbcommon)
123 ("libxkbfile" ,libxkbfile)
125 ("unicode-cldr-common" ,unicode-cldr-common)
127 ("wayland-protocols" ,wayland-protocols)
128 ("xcb-imdkit" ,xcb-imdkit)
129 ("xcb-util" ,xcb-util)
130 ("xcb-util-keysyms" ,xcb-util-keysyms)
131 ("xcb-util-wm" ,xcb-util-wm)
132 ("xkeyboard-config" ,xkeyboard-config)))
134 (list extra-cmake-modules pkg-config))
136 (list (search-path-specification
137 (variable "FCITX_ADDON_DIRS")
138 (files '("lib/fcitx5")))))
139 (home-page "https://github.com/fcitx/fcitx5")
140 (synopsis "Input method framework")
141 (description "Fcitx 5 is a generic input method framework.")
142 (license license:lgpl2.1+)))
144 (define-public fcitx5-lua
152 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
155 (base32 "0f3raxzkq0nwdfpc9hxvg65vga09gznjjgy9dr6jlkamzx8zlyw9"))))
156 (build-system cmake-build-system)
158 (list fcitx5 lua gettext-minimal libpthread-stubs))
160 (list extra-cmake-modules))
161 (home-page "https://github.com/fcitx/fcitx5-lua")
162 (synopsis "Lua support for Fcitx 5")
163 (description "Fcitx5-lua allows writing Fcitx5 extension in Lua.")
164 (license license:lgpl2.1+)))
166 (define-public libime
173 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
174 version "_dict.tar.xz"))
176 (base32 "0dknxf5lf5a6kam39rp7y1h2p47bwb6pnlc8fsrhmiv7rw2pkq0f"))))
177 (build-system cmake-build-system)
181 (list extra-cmake-modules python)) ;needed to run test
182 (home-page "https://github.com/fcitx/libime")
183 (synopsis "Library for implementing generic input methods")
184 (description "Libime is a library for implementing various input method
186 (license license:lgpl2.1+)))
188 (define-public fcitx5-gtk
195 (uri (string-append "https://download.fcitx-im.org/fcitx5"
196 "/fcitx5-gtk/fcitx5-gtk-"
199 (base32 "07ip4sxf3q895pp7mivv2bdwcmqjnwrmv9pg99jk73cw9bgyq00n"))))
200 (build-system cmake-build-system)
205 #~(list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
206 #$output "/share/gir-1.0")
207 (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
208 #$output "/lib/girepository-1.0")
209 "-DENABLE_GTK4_IM_MODULE=OFF")
211 #~(modify-phases %standard-phases
212 (add-before 'configure 'patch-install-prefix
214 ;; Take care of different versions of GTK because this package
215 ;; provides IM module for GTK application to use input method.
216 (define (split-immodule gtk-version output)
217 (substitute* (string-append gtk-version "/CMakeLists.txt")
218 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
219 (string-append output "/lib"))))
221 (let ((gtk2 #$output:gtk2)
222 (gtk3 #$output:gtk3))
223 (for-each split-immodule
225 (list gtk2 gtk3))))))))
232 gobject-introspection
237 (list extra-cmake-modules pkg-config
238 `(,glib "bin"))) ;for glib-genmarshal
239 (outputs '("out" "gtk2" "gtk3"))
240 (home-page "https://github.com/fcitx/fcitx5-gtk")
241 (synopsis "GLib-based D-Bus client and GTK IM module for Fcitx 5")
242 (description "Fcitx5-gtk provides the following functionality in the
243 corresponding output:
247 GLib-based D-Bus client of Fcitx5.
249 IM module for GTK+2 applications.
251 IM module for GTK+3 applications.
253 (license license:lgpl2.1+)))
255 ;; XXX: This package is separated from fcitx5-gtk for following reasons.
256 ;; 1. GTK4 has a lot more dependencies, some of which maybe unavailable on
257 ;; platforms other than x86_64. See <https://issues.guix.gnu.org/53648>.
258 ;; 2. GTK4 now propagates pango@1.50, it will conflict with GTK3 and GTK2
259 ;; (propagates pango@1.48) if they're all in the inputs of same package.
260 ;; See <https://issues.guix.gnu.org/54261>.
261 (define-public fcitx5-gtk4
269 #~(list (string-append "-DCMAKE_CXX_FLAGS=-I"
270 #$(this-package-input "fcitx5-gtk")
271 "/include/Fcitx5/GClient")
272 "-DENABLE_GTK2_IM_MODULE=OFF"
273 "-DENABLE_GTK3_IM_MODULE=OFF")
275 #~(modify-phases %standard-phases
276 (add-before 'configure 'fix-gclient
277 (lambda* (#:key inputs #:allow-other-keys)
279 (search-input-file inputs "lib/libFcitx5GClient.so"))
280 ;; Force cmake search libFcitx5GClient.so in library search
281 ;; path instead of compiling again.
282 (substitute* "gtk4/CMakeLists.txt"
285 (add-before 'build 'enter-gtk4-subdirectory
288 (add-after 'install 'leave-gtk4-subdirectory
292 (modify-inputs (package-inputs fcitx5-gtk)
294 (prepend fcitx5-gtk gtk)))
296 (synopsis "GTK4 IM module for Fcitx 5")
297 (description "Fcitx5-gtk4 provides IM module for GTK4 applications.")))
299 (define-public fcitx5-qt
306 (uri (string-append "https://download.fcitx-im.org/fcitx5"
307 "/fcitx5-qt/fcitx5-qt-"
310 (base32 "1gspj3s1nz6mqbp3z6js5zf7mqicwm32isxlqh6whhwawr9w7vrk"))))
311 (build-system cmake-build-system)
314 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
315 %output "/lib/qt5/plugins")
316 "-DENABLE_QT4=Off")))
320 ("libxkbcommon" ,libxkbcommon)
322 ("gettext" ,gettext-minimal)))
324 (list extra-cmake-modules))
325 (home-page "https://github.com/fcitx/fcitx5-qt")
326 (synopsis "Qt library and IM module for Fcitx 5")
327 (description "Fcitx5-qt provides Qt library for development and IM module
328 for Qt based application.")
329 (license (list license:lgpl2.1+
330 ;; Files under qt4(Fcitx5Qt4DBusAddons), qt5/dbusaddons
331 ;; and qt5/platforminputcontext.
334 (define-public fcitx5-anthy
336 (name "fcitx5-anthy")
341 (uri (string-append "https://download.fcitx-im.org/fcitx5"
342 "/fcitx5-anthy/fcitx5-anthy-"
345 (base32 "0i2ahfp1vh0cs3brcsfblzqwszal2qj1ncgb1hbc9v03s1j6bybk"))))
346 (build-system cmake-build-system)
348 `(#:tests? #f)) ;; no tests
349 (inputs (list fcitx5 anthy gettext-minimal fmt))
351 (list extra-cmake-modules pkg-config))
352 (home-page "https://github.com/fcitx/fcitx5-anthy")
353 (synopsis "Anthy Japanese language input for Fcitx 5")
354 (description "Fcitx5-Anthy provides Japanese input support to Fcitx5 using
355 the Anthy input method.")
356 (license license:gpl2+)))
358 (define-public fcitx5-chinese-addons
360 (name "fcitx5-chinese-addons")
365 (uri (string-append "https://download.fcitx-im.org/fcitx5"
366 "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
367 version "_dict.tar.xz"))
369 (base32 "11l76gpcfm0x1f6x5m9s37q7ffa7xcsdydlzjdz2s6kk45fvvq89"))))
370 (build-system cmake-build-system)
373 '("-DUSE_WEBKIT=off")
375 (modify-phases %standard-phases
376 (add-before 'configure 'split-outputs
377 ;; Build with GUI supports requires Qt and increase package closure
378 ;; by 800M on x86_64, so place it under another output.
379 (lambda* (#:key outputs #:allow-other-keys)
380 (substitute* "gui/pinyindictmanager/CMakeLists.txt"
381 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}" _)
382 (string-append (assoc-ref outputs "gui") "/lib"))))))))
385 ("fcitx5-lua" ,fcitx5-lua)
389 ("gettext" ,gettext-minimal)
391 ("libpthread-stubs" ,libpthread-stubs)
394 ("fcitx5-qt" ,fcitx5-qt)
395 ("qtdeclarative-5" ,qtdeclarative-5)
396 ("qtwebchannel-5" ,qtwebchannel-5)
397 ("qtwebengine-5" ,qtwebengine-5)))
399 (list extra-cmake-modules pkg-config))
400 (outputs '("out" "gui"))
401 (home-page "https://github.com/fcitx/fcitx5-chinese-addons")
402 (synopsis "Chinese related addons for Fcitx 5")
403 (description "Fcitx5-chinese-addons provides Chinese related addons,
404 including input methods previous bundled inside Fcitx 4:
417 (license (list license:lgpl2.1+
419 ;; im/pinyin/emoji.txt
422 (define-public fcitx5-configtool
424 (name "fcitx5-configtool")
430 "https://download.fcitx-im.org/fcitx5"
431 "/fcitx5-configtool/fcitx5-configtool-" version ".tar.xz"))
433 (base32 "0rajrw914mbl0x7h08cal0sszwyvqg6v3w0vs0c9acs6m438xbw4"))))
434 (build-system cmake-build-system)
437 ;; KDE is currently not working on Guix, KCM supports doesn't make sense.
438 '("-DENABLE_KCM=Off")))
441 ("fcitx5-qt" ,fcitx5-qt)
443 ("qtx11extras" ,qtx11extras)
444 ("kitemviews" ,kitemviews)
445 ("kwidgetsaddons" ,kwidgetsaddons)
447 ("xkeyboard-config" ,xkeyboard-config)
448 ("libxkbfile" ,libxkbfile)
449 ("gettext" ,gettext-minimal)
450 ("iso-codes" ,iso-codes)))
452 (list extra-cmake-modules pkg-config))
453 (home-page "https://github.com/fcitx/fcitx5-configtool")
454 (synopsis "Graphical configuration tool for Fcitx 5")
455 (description "Fcitx5-configtool is a graphical configuration tool
456 to manage different input methods in Fcitx 5.")
457 (license license:gpl2+)))
459 (define-public fcitx5-material-color-theme
461 (name "fcitx5-material-color-theme")
467 (url "https://github.com/hosxy/Fcitx5-Material-Color")
469 (file-name (git-file-name name version))
471 (base32 "1mgc722521jmfx0xc3ibmiycd3q2w7xg2956xcpc07kz90gcdjaa"))))
472 (build-system copy-build-system)
475 (modify-phases %standard-phases
477 (lambda* (#:key outputs #:allow-other-keys)
478 (use-modules (srfi srfi-26))
480 (let* ((out (assoc-ref outputs "out"))
481 (assets-dir (string-append
482 out "/share/fcitx5-material-color-theme"))
483 (themes-prefix (string-append out "/share/fcitx5/themes")))
485 (define (install-theme-variant variant target)
486 (let ((dir (string-append themes-prefix "/" target))
487 (png (string-append "panel-" variant ".png"))
488 (conf (string-append "theme-" variant ".conf")))
489 (format #t "install: Installing color variant \"~a\" to ~a~%"
493 (string-append "Name=" target "\n")))
495 (install-file png dir)
496 (copy-file conf (string-append dir "/theme.conf"))
497 (symlink (string-append assets-dir "/arrow.png")
498 (string-append dir "/arrow.png"))))
501 (install-file "arrow.png" assets-dir)
504 (install-theme-variant
505 x (string-append "Material-Color-" (string-capitalize x))))
506 '("black" "blue" "brown" "indigo"
507 "orange" "pink" "red" "teal"))
509 (install-theme-variant
510 "deepPurple" "Material-Color-DeepPurple")))))))
511 (home-page "https://github.com/hosxy/Fcitx5-Material-Color")
512 (synopsis "Material Design for Fcitx 5")
513 (description "Fcitx5-material-color-theme is a Material Design theme
514 for Fcitx 5 with following color variants:
527 (license license:asl2.0)))