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 build-system cmake)
23 #:use-module ((guix licenses) #:prefix license:)
24 #:use-module (gnu packages boost)
25 #:use-module (gnu packages curl)
26 #:use-module (gnu packages datastructures)
27 #:use-module (gnu packages enchant)
28 #:use-module (gnu packages freedesktop)
29 #:use-module (gnu packages gcc)
30 #:use-module (gnu packages gettext)
31 #:use-module (gnu packages glib)
32 #:use-module (gnu packages gtk)
33 #:use-module (gnu packages iso-codes)
34 #:use-module (gnu packages kde-frameworks)
35 #:use-module (gnu packages libevent)
36 #:use-module (gnu packages linux)
37 #:use-module (gnu packages lua)
38 #:use-module (gnu packages pkg-config)
39 #:use-module (gnu packages pretty-print)
40 #:use-module (gnu packages python)
41 #:use-module (gnu packages qt)
42 #:use-module (gnu packages textutils)
43 #:use-module (gnu packages unicode)
44 #:use-module (gnu packages web)
45 #:use-module (gnu packages xdisorg)
46 #:use-module (gnu packages xml)
47 #:use-module (gnu packages xorg))
49 (define-public xcb-imdkit
57 "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
60 (base32 "1qgbbp8y8ci7haz99vgbrgpjsbrwwyjianyhdvxcirnbm5bybvmz"))
61 (modules '((guix build utils)))
64 ;; Remove bundled uthash.
65 (delete-file-recursively "uthash")
67 (build-system cmake-build-system)
71 ("xcb-util" ,xcb-util)
72 ("xcb-util-keysyms" ,xcb-util-keysyms)))
74 `(("extra-cmake-modules" ,extra-cmake-modules)
75 ("pkg-config" ,pkg-config)))
76 (home-page "https://github.com/fcitx/xcb-imdkit")
77 (synopsis "Input method development support for XCB")
78 (description "Xcb-imdkit is an implementation of xim protocol in XCB,
79 comparing with the implementation of IMDkit with Xlib, and xim inside Xlib, it
80 has less memory foot print, better performance, and safer on malformed
82 (license license:lgpl2.1)))
92 "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
93 version "_dict.tar.xz"))
95 (base32 "06zkb33m2rnhg385iy79n3r4svz5jbav74di61xqa3lhbv7534s3"))))
96 (build-system cmake-build-system)
99 (list (string-append "-DCLDR_DIR="
100 (assoc-ref %build-inputs "unicode-cldr-common")
101 "/share/unicode/cldr"))))
104 ("cairo-xcb" ,cairo-xcb)
109 ("gdk-pixbuf" ,gdk-pixbuf)
110 ("gettext" ,gettext-minimal)
112 ("iso-codes" ,iso-codes)
114 ("libevent" ,libevent)
115 ("libpthread-stubs" ,libpthread-stubs)
116 ("libuuid" ,util-linux "lib")
119 ("libxfixes" ,libxfixes)
120 ("libxinerama" ,libxinerama)
121 ("libxkbcommon" ,libxkbcommon)
122 ("libxkbfile" ,libxkbfile)
124 ("unicode-cldr-common" ,unicode-cldr-common)
126 ("wayland-protocols" ,wayland-protocols)
127 ("xcb-imdkit" ,xcb-imdkit)
128 ("xcb-util" ,xcb-util)
129 ("xcb-util-keysyms" ,xcb-util-keysyms)
130 ("xcb-util-wm" ,xcb-util-wm)
131 ("xkeyboard-config" ,xkeyboard-config)))
133 `(("extra-cmake-modules" ,extra-cmake-modules)
134 ("pkg-config" ,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 "177mj56j8yrl79hvk7bbrifvm137np23pwalv83ibgk4l51z92hf"))))
156 (build-system cmake-build-system)
160 (string-append "-DFEM_INCLUDE_INSTALL_DIR=" %output "/include")
161 (string-append "-DFEM_LIB_INSTALL_DIR=" %output "/lib"))
163 (modify-phases %standard-phases
164 (add-before 'configure 'patch-install-prefix
165 (lambda* (#:key outputs #:allow-other-keys)
168 (format #t "patch-install-prefix: Fixing install prefix in ~a~%"
171 (("\\$\\{FCITX_INSTALL_PKGDATADIR\\}")
172 (string-append (assoc-ref outputs "out")
174 '("src/addonloader/CMakeLists.txt"
175 "src/imeapi/CMakeLists.txt")))))))
179 ("gettext" ,gettext-minimal)
180 ("libpthread-stubs" ,libpthread-stubs)))
182 `(("extra-cmake-modules" ,extra-cmake-modules)))
183 (home-page "https://github.com/fcitx/fcitx5-lua")
184 (synopsis "Lua support for Fcitx 5")
185 (description "Fcitx5-lua allows writing Fcitx5 extension in Lua.")
186 (license license:lgpl2.1+)))
188 (define-public libime
195 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
196 version "_dict.tar.xz"))
198 (base32 "006pncby7p6h3rnicckzjwi6jzsrqiqbj6p9bpic80lanlllgw31"))))
199 (build-system cmake-build-system)
204 `(("gcc" ,gcc-9) ;for #include <filesystem> and ld support
205 ("extra-cmake-modules" ,extra-cmake-modules)
206 ("python" ,python))) ;needed to run test
207 (home-page "https://github.com/fcitx/libime")
208 (synopsis "Library for implementing generic input method")
209 (description "Libime is a library for implmenting various input methods
211 (license license:lgpl2.1+)))
213 (define-public fcitx5-gtk
220 (uri (string-append "https://download.fcitx-im.org/fcitx5"
221 "/fcitx5-gtk/fcitx5-gtk-"
224 (base32 "0h53liraqc5nz4nyi3ixdfdw3zzkdcsiff7j25acc3gmaa5gyij7"))))
225 (build-system cmake-build-system)
227 `(#:tests? #f ;No test
229 (list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
230 %output "/share/gir-1.0")
231 (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
232 %output "/lib/girepository-1.0"))
234 (modify-phases %standard-phases
235 (add-before 'configure 'patch-install-prefix
236 (lambda* (#:key outputs #:allow-other-keys)
237 (let ((out (assoc-ref outputs "out"))
238 (gtk2 (assoc-ref outputs "gtk2")))
239 ;; Install GTK+ 2 input method module to its own output.
240 (substitute* "gtk2/CMakeLists.txt"
241 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
242 (string-append gtk2 "/lib")))))))))
245 ("libxkbcommon" ,libxkbcommon)
246 ("gobject-introspection" ,gobject-introspection)
251 ("gettext" ,gettext-minimal)))
253 `(("extra-cmake-modules" ,extra-cmake-modules)
254 ("pkg-config" ,pkg-config)
255 ("glib" ,glib "bin"))) ;for glib-genmarshal
256 ;; TODO: Add "lib" output to reduce the closure size of "gtk2".
257 (outputs '("out" "gtk2"))
258 (home-page "https://github.com/fcitx/fcitx5-gtk")
259 (synopsis "Glib based D-Bus client and GTK IM module for Fcitx 5")
260 (description "Fcitx5-gtk provides a Glib based D-Bus client and IM module
261 for GTK+2/GTK+3 application.")
262 (license license:lgpl2.1+)))
264 (define-public fcitx5-qt
271 (uri (string-append "https://download.fcitx-im.org/fcitx5"
272 "/fcitx5-qt/fcitx5-qt-"
275 (base32 "0ilhb4yw9k3m1c4fidnv3nd5dgm9xxds11dgdys6gswjjnmcgqqm"))))
276 (build-system cmake-build-system)
279 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
280 %output "/lib/qt5/plugins")
281 "-DENABLE_QT4=Off")))
285 ("libxkbcommon" ,libxkbcommon)
287 ("gettext" ,gettext-minimal)))
289 `(("extra-cmake-modules" ,extra-cmake-modules)))
290 (home-page "https://github.com/fcitx/fcitx5-qt")
291 (synopsis "Qt library and IM module for Fcitx 5")
292 (description "Fcitx5-qt provides Qt library for development and IM module
293 for Qt based application.")
294 (license (list license:lgpl2.1+
295 ;; Files under qt4(Fcitx5Qt4DBusAddons), qt5/dbusaddons
296 ;; and qt5/platforminputcontext.
299 (define-public fcitx5-chinese-addons
301 (name "fcitx5-chinese-addons")
306 (uri (string-append "https://download.fcitx-im.org/fcitx5"
307 "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
308 version "_dict.tar.xz"))
310 (base32 "0mf91gzwzhfci0jn6g3l516xjw8r4v40ginnbl70h1zx6vr24rfp"))))
311 (build-system cmake-build-system)
315 (string-append "-DFEM_INCLUDE_INSTALL_DIR=" %output "/include")
316 (string-append "-DFEM_LIB_INSTALL_DIR=" %output "/lib"))
318 (modify-phases %standard-phases
319 (add-before 'configure 'patch-install-prefix
320 (lambda* (#:key outputs #:allow-other-keys)
323 (format #t "patch-install-prefix: Fixing install prefix in ~a~%"
326 (("\\$\\{FCITX_INSTALL_PKGDATADIR\\}")
327 (string-append (assoc-ref outputs "out")
329 (find-files "." "CMakeLists\\.txt$"))))
330 (add-before 'configure 'split-outputs
331 ;; Build with GUI supports requires Qt and increase package closure
332 ;; by 800M on x86_64, so place it under another output.
333 (lambda* (#:key outputs #:allow-other-keys)
334 (substitute* "gui/pinyindictmanager/CMakeLists.txt"
335 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}" _)
336 (string-append (assoc-ref outputs "gui") "/lib"))))))))
339 ("fcitx5-lua" ,fcitx5-lua)
343 ("gettext" ,gettext-minimal)
345 ("libpthread-stubs" ,libpthread-stubs)
348 ("fcitx5-qt" ,fcitx5-qt)
349 ("qtwebkit" ,qtwebkit)))
351 `(("extra-cmake-modules" ,extra-cmake-modules)
352 ("pkg-config" ,pkg-config)))
353 (outputs '("out" "gui"))
354 (home-page "https://github.com/fcitx/fcitx5-chinese-addons")
355 (synopsis "Chinese related addons for Fcitx 5")
356 (description "Fcitx5-chinese-addons provides Chinese related addons,
357 including input methods previous bundled inside Fcitx 4:
370 (license (list license:lgpl2.1+
372 ;; im/pinyin/emoji.txt