gnu: Add fcitx5-lua.
[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 datastructures)
25 #:use-module (gnu packages enchant)
26 #:use-module (gnu packages freedesktop)
27 #:use-module (gnu packages gettext)
28 #:use-module (gnu packages glib)
29 #:use-module (gnu packages gtk)
30 #:use-module (gnu packages iso-codes)
31 #:use-module (gnu packages kde-frameworks)
32 #:use-module (gnu packages libevent)
33 #:use-module (gnu packages linux)
34 #:use-module (gnu packages lua)
35 #:use-module (gnu packages pkg-config)
36 #:use-module (gnu packages pretty-print)
37 #:use-module (gnu packages unicode)
38 #:use-module (gnu packages web)
39 #:use-module (gnu packages xdisorg)
40 #:use-module (gnu packages xml)
41 #:use-module (gnu packages xorg))
42
43 (define-public xcb-imdkit
44 (package
45 (name "xcb-imdkit")
46 (version "1.0.1")
47 (source
48 (origin
49 (method url-fetch)
50 (uri (string-append
51 "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
52 version ".tar.xz"))
53 (sha256
54 (base32 "1qgbbp8y8ci7haz99vgbrgpjsbrwwyjianyhdvxcirnbm5bybvmz"))
55 (modules '((guix build utils)))
56 (snippet
57 '(begin
58 ;; Remove bundled uthash.
59 (delete-file-recursively "uthash")
60 #t))))
61 (build-system cmake-build-system)
62 (inputs
63 `(("uthash" ,uthash)
64 ("libxcb" ,libxcb)
65 ("xcb-util" ,xcb-util)
66 ("xcb-util-keysyms" ,xcb-util-keysyms)))
67 (native-inputs
68 `(("extra-cmake-modules" ,extra-cmake-modules)
69 ("pkg-config" ,pkg-config)))
70 (home-page "https://github.com/fcitx/xcb-imdkit")
71 (synopsis "Input method development support for XCB")
72 (description "Xcb-imdkit is an implementation of xim protocol in XCB,
73 comparing with the implementation of IMDkit with Xlib, and xim inside Xlib, it
74 has less memory foot print, better performance, and safer on malformed
75 client.")
76 (license license:lgpl2.1)))
77
78 (define-public fcitx5
79 (package
80 (name "fcitx5")
81 (version "5.0.3")
82 (source
83 (origin
84 (method url-fetch)
85 (uri (string-append
86 "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
87 version "_dict.tar.xz"))
88 (sha256
89 (base32 "06zkb33m2rnhg385iy79n3r4svz5jbav74di61xqa3lhbv7534s3"))))
90 (build-system cmake-build-system)
91 (arguments
92 `(#:configure-flags
93 (list (string-append "-DCLDR_DIR="
94 (assoc-ref %build-inputs "unicode-cldr-common")
95 "/share/unicode/cldr"))))
96 (inputs
97 `(("cairo" ,cairo)
98 ("cairo-xcb" ,cairo-xcb)
99 ("dbus" ,dbus)
100 ("enchant" ,enchant)
101 ("expat" ,expat)
102 ("fmt" ,fmt)
103 ("gdk-pixbuf" ,gdk-pixbuf)
104 ("gettext" ,gettext-minimal)
105 ("glib" ,glib)
106 ("iso-codes" ,iso-codes)
107 ("json-c" ,json-c)
108 ("libevent" ,libevent)
109 ("libpthread-stubs" ,libpthread-stubs)
110 ("libuuid" ,util-linux "lib")
111 ("libx11" ,libx11)
112 ("libxcb" ,libxcb)
113 ("libxfixes" ,libxfixes)
114 ("libxinerama" ,libxinerama)
115 ("libxkbcommon" ,libxkbcommon)
116 ("libxkbfile" ,libxkbfile)
117 ("pango" ,pango)
118 ("unicode-cldr-common" ,unicode-cldr-common)
119 ("wayland" ,wayland)
120 ("wayland-protocols" ,wayland-protocols)
121 ("xcb-imdkit" ,xcb-imdkit)
122 ("xcb-util" ,xcb-util)
123 ("xcb-util-keysyms" ,xcb-util-keysyms)
124 ("xcb-util-wm" ,xcb-util-wm)
125 ("xkeyboard-config" ,xkeyboard-config)))
126 (native-inputs
127 `(("extra-cmake-modules" ,extra-cmake-modules)
128 ("pkg-config" ,pkg-config)))
129 (native-search-paths
130 (list (search-path-specification
131 (variable "FCITX_ADDON_DIRS")
132 (files '("lib/fcitx5")))))
133 (home-page "https://github.com/fcitx/fcitx5")
134 (synopsis "Input method framework")
135 (description "Fcitx 5 is a generic input method framework.")
136 (license license:lgpl2.1+)))
137
138 (define-public fcitx5-lua
139 (package
140 (name "fcitx5-lua")
141 (version "5.0.1")
142 (source
143 (origin
144 (method url-fetch)
145 (uri (string-append
146 "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
147 version ".tar.xz"))
148 (sha256
149 (base32 "177mj56j8yrl79hvk7bbrifvm137np23pwalv83ibgk4l51z92hf"))))
150 (build-system cmake-build-system)
151 (arguments
152 `(#:configure-flags
153 (list
154 (string-append "-DFEM_INCLUDE_INSTALL_DIR=" %output "/include")
155 (string-append "-DFEM_LIB_INSTALL_DIR=" %output "/lib"))
156 #:phases
157 (modify-phases %standard-phases
158 (add-before 'configure 'patch-install-prefix
159 (lambda* (#:key outputs #:allow-other-keys)
160 (for-each
161 (lambda (x)
162 (format #t "patch-install-prefix: Fixing install prefix in ~a~%"
163 x)
164 (substitute* x
165 (("\\$\\{FCITX_INSTALL_PKGDATADIR\\}")
166 (string-append (assoc-ref outputs "out")
167 "/share/fcitx5"))))
168 '("src/addonloader/CMakeLists.txt"
169 "src/imeapi/CMakeLists.txt")))))))
170 (inputs
171 `(("fcitx5" ,fcitx5)
172 ("lua" ,lua)
173 ("gettext" ,gettext-minimal)
174 ("libpthread-stubs" ,libpthread-stubs)))
175 (native-inputs
176 `(("extra-cmake-modules" ,extra-cmake-modules)))
177 (home-page "https://github.com/fcitx/fcitx5-lua")
178 (synopsis "Lua support for Fcitx 5")
179 (description "Fcitx5-lua allows writing Fcitx5 extension in Lua.")
180 (license license:lgpl2.1+)))