gnu: fcitx5-lua: Remove stale build steps.
[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 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))
50
51 (define-public xcb-imdkit
52 (package
53 (name "xcb-imdkit")
54 (version "1.0.1")
55 (source
56 (origin
57 (method url-fetch)
58 (uri (string-append
59 "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
60 version ".tar.xz"))
61 (sha256
62 (base32 "1qgbbp8y8ci7haz99vgbrgpjsbrwwyjianyhdvxcirnbm5bybvmz"))
63 (modules '((guix build utils)))
64 (snippet
65 '(begin
66 ;; Remove bundled uthash.
67 (delete-file-recursively "uthash")
68 #t))))
69 (build-system cmake-build-system)
70 (inputs
71 `(("uthash" ,uthash)
72 ("libxcb" ,libxcb)
73 ("xcb-util" ,xcb-util)
74 ("xcb-util-keysyms" ,xcb-util-keysyms)))
75 (native-inputs
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
83 client.")
84 (license license:lgpl2.1)))
85
86 (define-public fcitx5
87 (package
88 (name "fcitx5")
89 (version "5.0.3")
90 (source
91 (origin
92 (method url-fetch)
93 (uri (string-append
94 "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
95 version "_dict.tar.xz"))
96 (sha256
97 (base32 "06zkb33m2rnhg385iy79n3r4svz5jbav74di61xqa3lhbv7534s3"))))
98 (build-system cmake-build-system)
99 (arguments
100 `(#:configure-flags
101 (list (string-append "-DCLDR_DIR="
102 (assoc-ref %build-inputs "unicode-cldr-common")
103 "/share/unicode/cldr"))))
104 (inputs
105 `(("cairo" ,cairo)
106 ("cairo-xcb" ,cairo-xcb)
107 ("dbus" ,dbus)
108 ("enchant" ,enchant)
109 ("expat" ,expat)
110 ("fmt" ,fmt)
111 ("gdk-pixbuf" ,gdk-pixbuf)
112 ("gettext" ,gettext-minimal)
113 ("glib" ,glib)
114 ("iso-codes" ,iso-codes)
115 ("json-c" ,json-c)
116 ("libevent" ,libevent)
117 ("libpthread-stubs" ,libpthread-stubs)
118 ("libuuid" ,util-linux "lib")
119 ("libx11" ,libx11)
120 ("libxcb" ,libxcb)
121 ("libxfixes" ,libxfixes)
122 ("libxinerama" ,libxinerama)
123 ("libxkbcommon" ,libxkbcommon)
124 ("libxkbfile" ,libxkbfile)
125 ("pango" ,pango)
126 ("unicode-cldr-common" ,unicode-cldr-common)
127 ("wayland" ,wayland)
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)))
134 (native-inputs
135 `(("extra-cmake-modules" ,extra-cmake-modules)
136 ("pkg-config" ,pkg-config)))
137 (native-search-paths
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+)))
145
146 (define-public fcitx5-lua
147 (package
148 (name "fcitx5-lua")
149 (version "5.0.1")
150 (source
151 (origin
152 (method url-fetch)
153 (uri (string-append
154 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
155 version ".tar.xz"))
156 (sha256
157 (base32 "177mj56j8yrl79hvk7bbrifvm137np23pwalv83ibgk4l51z92hf"))))
158 (build-system cmake-build-system)
159 (inputs
160 `(("fcitx5" ,fcitx5)
161 ("lua" ,lua)
162 ("gettext" ,gettext-minimal)
163 ("libpthread-stubs" ,libpthread-stubs)))
164 (native-inputs
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+)))
170
171 (define-public libime
172 (package
173 (name "libime")
174 (version "1.0.2")
175 (source
176 (origin
177 (method url-fetch)
178 (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
179 version "_dict.tar.xz"))
180 (sha256
181 (base32 "006pncby7p6h3rnicckzjwi6jzsrqiqbj6p9bpic80lanlllgw31"))))
182 (build-system cmake-build-system)
183 (inputs
184 `(("fcitx5" ,fcitx5)
185 ("boost" ,boost)))
186 (native-inputs
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
193 editors.")
194 (license license:lgpl2.1+)))
195
196 (define-public fcitx5-gtk
197 (package
198 (name "fcitx5-gtk")
199 (version "5.0.1")
200 (source
201 (origin
202 (method url-fetch)
203 (uri (string-append "https://download.fcitx-im.org/fcitx5"
204 "/fcitx5-gtk/fcitx5-gtk-"
205 version ".tar.xz"))
206 (sha256
207 (base32 "0h53liraqc5nz4nyi3ixdfdw3zzkdcsiff7j25acc3gmaa5gyij7"))))
208 (build-system cmake-build-system)
209 (arguments
210 `(#:tests? #f ;No test
211 #:configure-flags
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"))
216 #:phases
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")))))))))
226 (inputs
227 `(("fcitx5" ,fcitx5)
228 ("libxkbcommon" ,libxkbcommon)
229 ("gobject-introspection" ,gobject-introspection)
230 ("gtk2" ,gtk+-2)
231 ("gtk3" ,gtk+)
232 ("glib" ,glib)
233 ("libx11" ,libx11)
234 ("gettext" ,gettext-minimal)))
235 (native-inputs
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+)))
246
247 (define-public fcitx5-qt
248 (package
249 (name "fcitx5-qt")
250 (version "5.0.1")
251 (source
252 (origin
253 (method url-fetch)
254 (uri (string-append "https://download.fcitx-im.org/fcitx5"
255 "/fcitx5-qt/fcitx5-qt-"
256 version ".tar.xz"))
257 (sha256
258 (base32 "0ilhb4yw9k3m1c4fidnv3nd5dgm9xxds11dgdys6gswjjnmcgqqm"))))
259 (build-system cmake-build-system)
260 (arguments
261 `(#:configure-flags
262 (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
263 %output "/lib/qt5/plugins")
264 "-DENABLE_QT4=Off")))
265 (inputs
266 `(("fcitx5" ,fcitx5)
267 ("libxcb" ,libxcb)
268 ("libxkbcommon" ,libxkbcommon)
269 ("qtbase" ,qtbase)
270 ("gettext" ,gettext-minimal)))
271 (native-inputs
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.
280 license:bsd-3))))
281
282 (define-public fcitx5-chinese-addons
283 (package
284 (name "fcitx5-chinese-addons")
285 (version "5.0.2")
286 (source
287 (origin
288 (method url-fetch)
289 (uri (string-append "https://download.fcitx-im.org/fcitx5"
290 "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
291 version "_dict.tar.xz"))
292 (sha256
293 (base32 "0mf91gzwzhfci0jn6g3l516xjw8r4v40ginnbl70h1zx6vr24rfp"))))
294 (build-system cmake-build-system)
295 (arguments
296 `(#:configure-flags
297 (list
298 (string-append "-DFEM_INCLUDE_INSTALL_DIR=" %output "/include")
299 (string-append "-DFEM_LIB_INSTALL_DIR=" %output "/lib"))
300 #:phases
301 (modify-phases %standard-phases
302 (add-before 'configure 'patch-install-prefix
303 (lambda* (#:key outputs #:allow-other-keys)
304 (for-each
305 (lambda (x)
306 (format #t "patch-install-prefix: Fixing install prefix in ~a~%"
307 x)
308 (substitute* x
309 (("\\$\\{FCITX_INSTALL_PKGDATADIR\\}")
310 (string-append (assoc-ref outputs "out")
311 "/share/fcitx5"))))
312 (find-files "." "CMakeLists\\.txt$"))))
313 (add-before 'configure 'split-outputs
314 ;; Build with GUI supports requires Qt and increase package closure
315 ;; by 800M on x86_64, so place it under another output.
316 (lambda* (#:key outputs #:allow-other-keys)
317 (substitute* "gui/pinyindictmanager/CMakeLists.txt"
318 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}" _)
319 (string-append (assoc-ref outputs "gui") "/lib"))))))))
320 (inputs
321 `(("fcitx5" ,fcitx5)
322 ("fcitx5-lua" ,fcitx5-lua)
323 ("boost" ,boost)
324 ("libime",libime)
325 ("curl" ,curl)
326 ("gettext" ,gettext-minimal)
327 ("fmt" ,fmt)
328 ("libpthread-stubs" ,libpthread-stubs)
329 ("opencc" ,opencc)
330 ("qtbase" ,qtbase)
331 ("fcitx5-qt" ,fcitx5-qt)
332 ("qtwebkit" ,qtwebkit)))
333 (native-inputs
334 `(("extra-cmake-modules" ,extra-cmake-modules)
335 ("pkg-config" ,pkg-config)))
336 (outputs '("out" "gui"))
337 (home-page "https://github.com/fcitx/fcitx5-chinese-addons")
338 (synopsis "Chinese related addons for Fcitx 5")
339 (description "Fcitx5-chinese-addons provides Chinese related addons,
340 including input methods previous bundled inside Fcitx 4:
341
342 @itemize
343 @item Bingchan
344 @item Cangjie
345 @item Erbi
346 @item Pinyin
347 @item Shuangpin
348 @item Wanfeng
349 @item Wubi
350 @item Wubi Pinyin
351 @item Ziranma
352 @end itemize\n")
353 (license (list license:lgpl2.1+
354 license:gpl2+
355 ;; im/pinyin/emoji.txt
356 license:unicode))))
357
358 (define-public fcitx5-configtool
359 (package
360 (name "fcitx5-configtool")
361 (version "5.0.1")
362 (source
363 (origin
364 (method url-fetch)
365 (uri (string-append
366 "https://download.fcitx-im.org/fcitx5"
367 "/fcitx5-configtool/fcitx5-configtool-" version ".tar.xz"))
368 (sha256
369 (base32 "0mrqhzvab41hkvhkz7vkb8d2mv5bgx4aqp9jpz4kf3kskwm1q14b"))))
370 (build-system cmake-build-system)
371 (arguments
372 `(#:configure-flags
373 ;; KDE is currently not working on Guix, KCM supports doesn't make sense.
374 '("-DENABLE_KCM=Off")))
375 (inputs
376 `(("fcitx5" ,fcitx5)
377 ("fcitx5-qt" ,fcitx5-qt)
378 ("qtbase" ,qtbase)
379 ("qtx11extras" ,qtx11extras)
380 ("kitemviews" ,kitemviews)
381 ("kwidgetsaddons" ,kwidgetsaddons)
382 ("libx11" ,libx11)
383 ("xkeyboard-config" ,xkeyboard-config)
384 ("libxkbfile" ,libxkbfile)
385 ("gettext" ,gettext-minimal)
386 ("iso-codes" ,iso-codes)))
387 (native-inputs
388 `(("gcc" ,gcc-9)
389 ("extra-cmake-modules" ,extra-cmake-modules)
390 ("pkg-config" ,pkg-config)))
391 (home-page "https://github.com/fcitx/fcitx5-configtool")
392 (synopsis "Graphical configuration tool for Fcitx 5")
393 (description "Fcitx5-configtool is a graphical configuration tool
394 to manage different input methods in Fcitx 5.")
395 (license license:gpl2+)))
396
397 (define-public fcitx5-material-color-theme
398 (package
399 (name "fcitx5-material-color-theme")
400 (version "0.1")
401 (source
402 (origin
403 (method git-fetch)
404 (uri (git-reference
405 (url "https://github.com/hosxy/Fcitx5-Material-Color")
406 (commit version)))
407 (file-name (git-file-name name version))
408 (sha256
409 (base32 "1mgc722521jmfx0xc3ibmiycd3q2w7xg2956xcpc07kz90gcdjaa"))))
410 (build-system copy-build-system)
411 (arguments
412 `(#:phases
413 (modify-phases %standard-phases
414 (replace 'install
415 (lambda* (#:key outputs #:allow-other-keys)
416 (use-modules (srfi srfi-26))
417
418 (let* ((out (assoc-ref outputs "out"))
419 (assets-dir (string-append
420 out "/share/fcitx5-material-color-theme"))
421 (themes-prefix (string-append out "/share/fcitx5/themes")))
422
423 (define (install-theme-variant variant target)
424 (let ((dir (string-append themes-prefix "/" target))
425 (png (string-append "panel-" variant ".png"))
426 (conf (string-append "theme-" variant ".conf")))
427 (format #t "install: Installing color variant \"~a\" to ~a~%"
428 variant dir)
429 (substitute* conf
430 (("^Name=.*")
431 (string-append "Name=" target "\n")))
432 (mkdir-p dir)
433 (install-file png dir)
434 (copy-file conf (string-append dir "/theme.conf"))
435 (symlink (string-append assets-dir "/arrow.png")
436 (string-append dir "/arrow.png"))))
437
438 (mkdir-p assets-dir)
439 (install-file "arrow.png" assets-dir)
440 (for-each
441 (lambda (x)
442 (install-theme-variant
443 x (string-append "Material-Color-" (string-capitalize x))))
444 '("black" "blue" "brown" "indigo"
445 "orange" "pink" "red" "teal"))
446
447 (install-theme-variant
448 "deepPurple" "Material-Color-DeepPurple")))))))
449 (home-page "https://github.com/hosxy/Fcitx5-Material-Color")
450 (synopsis "Material Design for Fcitx 5")
451 (description "Fcitx5-material-color-theme is a Material Design theme
452 for Fcitx 5 with following color variants:
453
454 @itemize
455 @item Black
456 @item Blue
457 @item Brown
458 @item Indigo
459 @item Orange
460 @item Pink
461 @item Red
462 @item teal
463 @item DeepPurple
464 @end itemize\n")
465 (license license:asl2.0)))