gnu: Add fcitx5-gtk.
[jackhill/guix/guix.git] / gnu / packages / fcitx5.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
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.
10 ;;;
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.
15 ;;;
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/>.
18
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 datastructures)
26 #:use-module (gnu packages enchant)
27 #:use-module (gnu packages freedesktop)
28 #:use-module (gnu packages gcc)
29 #:use-module (gnu packages gettext)
30 #:use-module (gnu packages glib)
31 #:use-module (gnu packages gtk)
32 #:use-module (gnu packages iso-codes)
33 #:use-module (gnu packages kde-frameworks)
34 #:use-module (gnu packages libevent)
35 #:use-module (gnu packages linux)
36 #:use-module (gnu packages lua)
37 #:use-module (gnu packages pkg-config)
38 #:use-module (gnu packages pretty-print)
39 #:use-module (gnu packages python)
40 #:use-module (gnu packages qt)
41 #:use-module (gnu packages unicode)
42 #:use-module (gnu packages web)
43 #:use-module (gnu packages xdisorg)
44 #:use-module (gnu packages xml)
45 #:use-module (gnu packages xorg))
46
47 (define-public xcb-imdkit
48 (package
49 (name "xcb-imdkit")
50 (version "1.0.1")
51 (source
52 (origin
53 (method url-fetch)
54 (uri (string-append
55 "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
56 version ".tar.xz"))
57 (sha256
58 (base32 "1qgbbp8y8ci7haz99vgbrgpjsbrwwyjianyhdvxcirnbm5bybvmz"))
59 (modules '((guix build utils)))
60 (snippet
61 '(begin
62 ;; Remove bundled uthash.
63 (delete-file-recursively "uthash")
64 #t))))
65 (build-system cmake-build-system)
66 (inputs
67 `(("uthash" ,uthash)
68 ("libxcb" ,libxcb)
69 ("xcb-util" ,xcb-util)
70 ("xcb-util-keysyms" ,xcb-util-keysyms)))
71 (native-inputs
72 `(("extra-cmake-modules" ,extra-cmake-modules)
73 ("pkg-config" ,pkg-config)))
74 (home-page "https://github.com/fcitx/xcb-imdkit")
75 (synopsis "Input method development support for XCB")
76 (description "Xcb-imdkit is an implementation of xim protocol in XCB,
77 comparing with the implementation of IMDkit with Xlib, and xim inside Xlib, it
78 has less memory foot print, better performance, and safer on malformed
79 client.")
80 (license license:lgpl2.1)))
81
82 (define-public fcitx5
83 (package
84 (name "fcitx5")
85 (version "5.0.3")
86 (source
87 (origin
88 (method url-fetch)
89 (uri (string-append
90 "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
91 version "_dict.tar.xz"))
92 (sha256
93 (base32 "06zkb33m2rnhg385iy79n3r4svz5jbav74di61xqa3lhbv7534s3"))))
94 (build-system cmake-build-system)
95 (arguments
96 `(#:configure-flags
97 (list (string-append "-DCLDR_DIR="
98 (assoc-ref %build-inputs "unicode-cldr-common")
99 "/share/unicode/cldr"))))
100 (inputs
101 `(("cairo" ,cairo)
102 ("cairo-xcb" ,cairo-xcb)
103 ("dbus" ,dbus)
104 ("enchant" ,enchant)
105 ("expat" ,expat)
106 ("fmt" ,fmt)
107 ("gdk-pixbuf" ,gdk-pixbuf)
108 ("gettext" ,gettext-minimal)
109 ("glib" ,glib)
110 ("iso-codes" ,iso-codes)
111 ("json-c" ,json-c)
112 ("libevent" ,libevent)
113 ("libpthread-stubs" ,libpthread-stubs)
114 ("libuuid" ,util-linux "lib")
115 ("libx11" ,libx11)
116 ("libxcb" ,libxcb)
117 ("libxfixes" ,libxfixes)
118 ("libxinerama" ,libxinerama)
119 ("libxkbcommon" ,libxkbcommon)
120 ("libxkbfile" ,libxkbfile)
121 ("pango" ,pango)
122 ("unicode-cldr-common" ,unicode-cldr-common)
123 ("wayland" ,wayland)
124 ("wayland-protocols" ,wayland-protocols)
125 ("xcb-imdkit" ,xcb-imdkit)
126 ("xcb-util" ,xcb-util)
127 ("xcb-util-keysyms" ,xcb-util-keysyms)
128 ("xcb-util-wm" ,xcb-util-wm)
129 ("xkeyboard-config" ,xkeyboard-config)))
130 (native-inputs
131 `(("extra-cmake-modules" ,extra-cmake-modules)
132 ("pkg-config" ,pkg-config)))
133 (native-search-paths
134 (list (search-path-specification
135 (variable "FCITX_ADDON_DIRS")
136 (files '("lib/fcitx5")))))
137 (home-page "https://github.com/fcitx/fcitx5")
138 (synopsis "Input method framework")
139 (description "Fcitx 5 is a generic input method framework.")
140 (license license:lgpl2.1+)))
141
142 (define-public fcitx5-lua
143 (package
144 (name "fcitx5-lua")
145 (version "5.0.1")
146 (source
147 (origin
148 (method url-fetch)
149 (uri (string-append
150 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
151 version ".tar.xz"))
152 (sha256
153 (base32 "177mj56j8yrl79hvk7bbrifvm137np23pwalv83ibgk4l51z92hf"))))
154 (build-system cmake-build-system)
155 (arguments
156 `(#:configure-flags
157 (list
158 (string-append "-DFEM_INCLUDE_INSTALL_DIR=" %output "/include")
159 (string-append "-DFEM_LIB_INSTALL_DIR=" %output "/lib"))
160 #:phases
161 (modify-phases %standard-phases
162 (add-before 'configure 'patch-install-prefix
163 (lambda* (#:key outputs #:allow-other-keys)
164 (for-each
165 (lambda (x)
166 (format #t "patch-install-prefix: Fixing install prefix in ~a~%"
167 x)
168 (substitute* x
169 (("\\$\\{FCITX_INSTALL_PKGDATADIR\\}")
170 (string-append (assoc-ref outputs "out")
171 "/share/fcitx5"))))
172 '("src/addonloader/CMakeLists.txt"
173 "src/imeapi/CMakeLists.txt")))))))
174 (inputs
175 `(("fcitx5" ,fcitx5)
176 ("lua" ,lua)
177 ("gettext" ,gettext-minimal)
178 ("libpthread-stubs" ,libpthread-stubs)))
179 (native-inputs
180 `(("extra-cmake-modules" ,extra-cmake-modules)))
181 (home-page "https://github.com/fcitx/fcitx5-lua")
182 (synopsis "Lua support for Fcitx 5")
183 (description "Fcitx5-lua allows writing Fcitx5 extension in Lua.")
184 (license license:lgpl2.1+)))
185
186 (define-public libime
187 (package
188 (name "libime")
189 (version "1.0.2")
190 (source
191 (origin
192 (method url-fetch)
193 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
194 version "_dict.tar.xz"))
195 (sha256
196 (base32 "006pncby7p6h3rnicckzjwi6jzsrqiqbj6p9bpic80lanlllgw31"))))
197 (build-system cmake-build-system)
198 (inputs
199 `(("fcitx5" ,fcitx5)
200 ("boost" ,boost)))
201 (native-inputs
202 `(("gcc" ,gcc-9) ;for #include <filesystem> and ld support
203 ("extra-cmake-modules" ,extra-cmake-modules)
204 ("python" ,python))) ;needed to run test
205 (home-page "https://github.com/fcitx/libime")
206 (synopsis "Library for implementing generic input method")
207 (description "Libime is a library for implmenting various input methods
208 editors.")
209 (license license:lgpl2.1+)))
210
211 (define-public fcitx5-gtk
212 (package
213 (name "fcitx5-gtk")
214 (version "5.0.1")
215 (source
216 (origin
217 (method url-fetch)
218 (uri (string-append "https://download.fcitx-im.org/fcitx5"
219 "/fcitx5-gtk/fcitx5-gtk-"
220 version ".tar.xz"))
221 (sha256
222 (base32 "0h53liraqc5nz4nyi3ixdfdw3zzkdcsiff7j25acc3gmaa5gyij7"))))
223 (build-system cmake-build-system)
224 (arguments
225 `(#:tests? #f ;No test
226 #:configure-flags
227 (list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
228 %output "/share/gir-1.0")
229 (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
230 %output "/lib/girepository-1.0"))
231 #:phases
232 (modify-phases %standard-phases
233 (add-before 'configure 'patch-install-prefix
234 (lambda* (#:key outputs #:allow-other-keys)
235 (let ((out (assoc-ref outputs "out"))
236 (gtk2 (assoc-ref outputs "gtk2")))
237 ;; Install GTK+ 2 input method module to its own output.
238 (substitute* "gtk2/CMakeLists.txt"
239 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
240 (string-append gtk2 "/lib")))))))))
241 (inputs
242 `(("fcitx5" ,fcitx5)
243 ("libxkbcommon" ,libxkbcommon)
244 ("gobject-introspection" ,gobject-introspection)
245 ("gtk2" ,gtk+-2)
246 ("gtk3" ,gtk+)
247 ("glib" ,glib)
248 ("libx11" ,libx11)
249 ("gettext" ,gettext-minimal)))
250 (native-inputs
251 `(("extra-cmake-modules" ,extra-cmake-modules)
252 ("pkg-config" ,pkg-config)
253 ("glib" ,glib "bin"))) ;for glib-genmarshal
254 ;; TODO: Add "lib" output to reduce the closure size of "gtk2".
255 (outputs '("out" "gtk2"))
256 (home-page "https://github.com/fcitx/fcitx5-gtk")
257 (synopsis "Glib based D-Bus client and GTK IM module for Fcitx 5")
258 (description "Fcitx5-gtk provides a Glib based D-Bus client and IM module
259 for GTK+2/GTK+3 application.")
260 (license license:lgpl2.1+)))
261
262 (define-public fcitx5-qt
263 (package
264 (name "fcitx5-qt")
265 (version "5.0.1")
266 (source
267 (origin
268 (method url-fetch)
269 (uri (string-append "https://download.fcitx-im.org/fcitx5"
270 "/fcitx5-qt/fcitx5-qt-"
271 version ".tar.xz"))
272 (sha256
273 (base32 "0ilhb4yw9k3m1c4fidnv3nd5dgm9xxds11dgdys6gswjjnmcgqqm"))))
274 (build-system cmake-build-system)
275 (arguments
276 `(#:configure-flags
277 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
278 %output "/lib/qt5/plugins")
279 "-DENABLE_QT4=Off")))
280 (inputs
281 `(("fcitx5" ,fcitx5)
282 ("libxcb" ,libxcb)
283 ("libxkbcommon" ,libxkbcommon)
284 ("qtbase" ,qtbase)
285 ("gettext" ,gettext-minimal)))
286 (native-inputs
287 `(("extra-cmake-modules" ,extra-cmake-modules)))
288 (home-page "https://github.com/fcitx/fcitx5-qt")
289 (synopsis "Qt library and IM module for Fcitx 5")
290 (description "Fcitx5-qt provides Qt library for development and IM module
291 for Qt based application.")
292 (license (list license:lgpl2.1+
293 ;; Files under qt4(Fcitx5Qt4DBusAddons), qt5/dbusaddons
294 ;; and qt5/platforminputcontext.
295 license:bsd-3))))