fcitx5.scm 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
  3. ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; 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 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. (define-public xcb-imdkit
  51. (package
  52. (name "xcb-imdkit")
  53. (version "1.0.3")
  54. (source
  55. (origin
  56. (method url-fetch)
  57. (uri (string-append
  58. "https://download.fcitx-im.org/fcitx5/xcb-imdkit/xcb-imdkit-"
  59. version ".tar.xz"))
  60. (sha256
  61. (base32 "1s58vjkdrgr8h183jz4b4mjn7pbvdc9cli01cn66mgczl9p65hh9"))
  62. (modules '((guix build utils)))
  63. (snippet
  64. '(begin
  65. ;; Remove bundled uthash.
  66. (delete-file-recursively "uthash")
  67. #t))))
  68. (build-system cmake-build-system)
  69. (inputs
  70. `(("uthash" ,uthash)
  71. ("libxcb" ,libxcb)
  72. ("xcb-util" ,xcb-util)
  73. ("xcb-util-keysyms" ,xcb-util-keysyms)))
  74. (native-inputs
  75. `(("extra-cmake-modules" ,extra-cmake-modules)
  76. ("pkg-config" ,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
  82. client.")
  83. (license license:lgpl2.1)))
  84. (define-public fcitx5
  85. (package
  86. (name "fcitx5")
  87. (version "5.0.8")
  88. (source
  89. (origin
  90. (method url-fetch)
  91. (uri (string-append
  92. "https://download.fcitx-im.org/fcitx5/fcitx5/fcitx5-"
  93. version "_dict.tar.xz"))
  94. (sha256
  95. (base32 "0536sjpgjlg0bf8imz4jf9bdsp7fhm09bkssddji56cc9mgdxx82"))))
  96. (build-system cmake-build-system)
  97. (arguments
  98. `(#:configure-flags
  99. (list (string-append "-DCLDR_DIR="
  100. (assoc-ref %build-inputs "unicode-cldr-common")
  101. "/share/unicode/cldr"))))
  102. (inputs
  103. `(("cairo" ,cairo)
  104. ("cairo-xcb" ,cairo-xcb)
  105. ("dbus" ,dbus)
  106. ("enchant" ,enchant)
  107. ("expat" ,expat)
  108. ("fmt" ,fmt)
  109. ("gdk-pixbuf" ,gdk-pixbuf)
  110. ("gettext" ,gettext-minimal)
  111. ("glib" ,glib)
  112. ("iso-codes" ,iso-codes)
  113. ("json-c" ,json-c)
  114. ("libevent" ,libevent)
  115. ("libpthread-stubs" ,libpthread-stubs)
  116. ("libuuid" ,util-linux "lib")
  117. ("libx11" ,libx11)
  118. ("libxcb" ,libxcb)
  119. ("libxfixes" ,libxfixes)
  120. ("libxinerama" ,libxinerama)
  121. ("libxkbcommon" ,libxkbcommon)
  122. ("libxkbfile" ,libxkbfile)
  123. ("pango" ,pango)
  124. ("unicode-cldr-common" ,unicode-cldr-common)
  125. ("wayland" ,wayland)
  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)))
  132. (native-inputs
  133. `(("gcc" ,gcc-9) ; for #include <charconv>
  134. ("extra-cmake-modules" ,extra-cmake-modules)
  135. ("pkg-config" ,pkg-config)))
  136. (native-search-paths
  137. (list (search-path-specification
  138. (variable "FCITX_ADDON_DIRS")
  139. (files '("lib/fcitx5")))))
  140. (home-page "https://github.com/fcitx/fcitx5")
  141. (synopsis "Input method framework")
  142. (description "Fcitx 5 is a generic input method framework.")
  143. (license license:lgpl2.1+)))
  144. (define-public fcitx5-lua
  145. (package
  146. (name "fcitx5-lua")
  147. (version "5.0.5")
  148. (source
  149. (origin
  150. (method url-fetch)
  151. (uri (string-append
  152. "https://download.fcitx-im.org/fcitx5/fcitx5-lua/fcitx5-lua-"
  153. version ".tar.xz"))
  154. (sha256
  155. (base32 "0f3raxzkq0nwdfpc9hxvg65vga09gznjjgy9dr6jlkamzx8zlyw9"))))
  156. (build-system cmake-build-system)
  157. (inputs
  158. `(("fcitx5" ,fcitx5)
  159. ("lua" ,lua)
  160. ("gettext" ,gettext-minimal)
  161. ("libpthread-stubs" ,libpthread-stubs)))
  162. (native-inputs
  163. `(("extra-cmake-modules" ,extra-cmake-modules)))
  164. (home-page "https://github.com/fcitx/fcitx5-lua")
  165. (synopsis "Lua support for Fcitx 5")
  166. (description "Fcitx5-lua allows writing Fcitx5 extension in Lua.")
  167. (license license:lgpl2.1+)))
  168. (define-public libime
  169. (package
  170. (name "libime")
  171. (version "1.0.7")
  172. (source
  173. (origin
  174. (method url-fetch)
  175. (uri (string-append "https://download.fcitx-im.org/fcitx5/libime/libime-"
  176. version "_dict.tar.xz"))
  177. (sha256
  178. (base32 "06smx1kqq3qh0xra8070cjfhw79hcm0vksrswk05wq6jyhvrk5sd"))))
  179. (build-system cmake-build-system)
  180. (inputs
  181. `(("fcitx5" ,fcitx5)
  182. ("boost" ,boost)))
  183. (native-inputs
  184. `(("gcc" ,gcc-9) ;for #include <filesystem> and ld support
  185. ("extra-cmake-modules" ,extra-cmake-modules)
  186. ("python" ,python))) ;needed to run test
  187. (home-page "https://github.com/fcitx/libime")
  188. (synopsis "Library for implementing generic input methods")
  189. (description "Libime is a library for implementing various input method
  190. editors.")
  191. (license license:lgpl2.1+)))
  192. (define-public fcitx5-gtk
  193. (package
  194. (name "fcitx5-gtk")
  195. (version "5.0.7")
  196. (source
  197. (origin
  198. (method url-fetch)
  199. (uri (string-append "https://download.fcitx-im.org/fcitx5"
  200. "/fcitx5-gtk/fcitx5-gtk-"
  201. version ".tar.xz"))
  202. (sha256
  203. (base32 "0x9xwyb3hnb2xl47jkj8zs34fhyf7gshy3bv3jxd66sfkjrscr5v"))))
  204. (build-system cmake-build-system)
  205. (arguments
  206. `(#:tests? #f ;No test
  207. #:configure-flags
  208. (list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
  209. %output "/share/gir-1.0")
  210. (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
  211. %output "/lib/girepository-1.0")
  212. ;; TODO: Enable it when Guix has GTK4.
  213. "-DENABLE_GTK4_IM_MODULE=Off")
  214. #:phases
  215. (modify-phases %standard-phases
  216. (add-before 'configure 'patch-install-prefix
  217. (lambda* (#:key outputs #:allow-other-keys)
  218. (let ((out (assoc-ref outputs "out"))
  219. (gtk2 (assoc-ref outputs "gtk2")))
  220. ;; Install GTK+ 2 input method module to its own output.
  221. (substitute* "gtk2/CMakeLists.txt"
  222. (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
  223. (string-append gtk2 "/lib")))))))))
  224. (inputs
  225. `(("fcitx5" ,fcitx5)
  226. ("fmt" ,fmt)
  227. ("libxkbcommon" ,libxkbcommon)
  228. ("gobject-introspection" ,gobject-introspection)
  229. ("gtk2" ,gtk+-2)
  230. ("gtk3" ,gtk+)
  231. ("glib" ,glib)
  232. ("libx11" ,libx11)
  233. ("gettext" ,gettext-minimal)))
  234. (native-inputs
  235. `(("extra-cmake-modules" ,extra-cmake-modules)
  236. ("pkg-config" ,pkg-config)
  237. ("glib" ,glib "bin"))) ;for glib-genmarshal
  238. ;; TODO: Add "lib" output to reduce the closure size of "gtk2".
  239. (outputs '("out" "gtk2"))
  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 a Glib based D-Bus client and IM module
  243. for GTK+2/GTK+3 application.")
  244. (license license:lgpl2.1+)))
  245. (define-public fcitx5-qt
  246. (package
  247. (name "fcitx5-qt")
  248. (version "5.0.6")
  249. (source
  250. (origin
  251. (method url-fetch)
  252. (uri (string-append "https://download.fcitx-im.org/fcitx5"
  253. "/fcitx5-qt/fcitx5-qt-"
  254. version ".tar.xz"))
  255. (sha256
  256. (base32 "0wp88cmy0gn15gkfzl5z4q4qd9j1ssdmgp1rfsbw0cp3qh5x4m69"))))
  257. (build-system cmake-build-system)
  258. (arguments
  259. `(#:configure-flags
  260. (list (string-append "-DCMAKE_INSTALL_QT5PLUGINDIR="
  261. %output "/lib/qt5/plugins")
  262. "-DENABLE_QT4=Off")))
  263. (inputs
  264. `(("fcitx5" ,fcitx5)
  265. ("libxcb" ,libxcb)
  266. ("libxkbcommon" ,libxkbcommon)
  267. ("qtbase" ,qtbase-5)
  268. ("gettext" ,gettext-minimal)))
  269. (native-inputs
  270. `(("extra-cmake-modules" ,extra-cmake-modules)))
  271. (home-page "https://github.com/fcitx/fcitx5-qt")
  272. (synopsis "Qt library and IM module for Fcitx 5")
  273. (description "Fcitx5-qt provides Qt library for development and IM module
  274. for Qt based application.")
  275. (license (list license:lgpl2.1+
  276. ;; Files under qt4(Fcitx5Qt4DBusAddons), qt5/dbusaddons
  277. ;; and qt5/platforminputcontext.
  278. license:bsd-3))))
  279. (define-public fcitx5-chinese-addons
  280. (package
  281. (name "fcitx5-chinese-addons")
  282. (version "5.0.6")
  283. (source
  284. (origin
  285. (method url-fetch)
  286. (uri (string-append "https://download.fcitx-im.org/fcitx5"
  287. "/fcitx5-chinese-addons/fcitx5-chinese-addons-"
  288. version "_dict.tar.xz"))
  289. (sha256
  290. (base32 "11l76gpcfm0x1f6x5m9s37q7ffa7xcsdydlzjdz2s6kk45fvvq89"))))
  291. (build-system cmake-build-system)
  292. (arguments
  293. `(#:phases
  294. (modify-phases %standard-phases
  295. (add-before 'configure 'split-outputs
  296. ;; Build with GUI supports requires Qt and increase package closure
  297. ;; by 800M on x86_64, so place it under another output.
  298. (lambda* (#:key outputs #:allow-other-keys)
  299. (substitute* "gui/pinyindictmanager/CMakeLists.txt"
  300. (("\\$\\{CMAKE_INSTALL_LIBDIR\\}" _)
  301. (string-append (assoc-ref outputs "gui") "/lib"))))))))
  302. (inputs
  303. `(("fcitx5" ,fcitx5)
  304. ("fcitx5-lua" ,fcitx5-lua)
  305. ("boost" ,boost)
  306. ("libime",libime)
  307. ("curl" ,curl)
  308. ("gettext" ,gettext-minimal)
  309. ("fmt" ,fmt)
  310. ("libpthread-stubs" ,libpthread-stubs)
  311. ("opencc" ,opencc)
  312. ("qtbase" ,qtbase-5)
  313. ("fcitx5-qt" ,fcitx5-qt)
  314. ("qtwebkit" ,qtwebkit)))
  315. (native-inputs
  316. `(("extra-cmake-modules" ,extra-cmake-modules)
  317. ("pkg-config" ,pkg-config)))
  318. (outputs '("out" "gui"))
  319. (home-page "https://github.com/fcitx/fcitx5-chinese-addons")
  320. (synopsis "Chinese related addons for Fcitx 5")
  321. (description "Fcitx5-chinese-addons provides Chinese related addons,
  322. including input methods previous bundled inside Fcitx 4:
  323. @itemize
  324. @item Bingchan
  325. @item Cangjie
  326. @item Erbi
  327. @item Pinyin
  328. @item Shuangpin
  329. @item Wanfeng
  330. @item Wubi
  331. @item Wubi Pinyin
  332. @item Ziranma
  333. @end itemize\n")
  334. (license (list license:lgpl2.1+
  335. license:gpl2+
  336. ;; im/pinyin/emoji.txt
  337. license:unicode))))
  338. (define-public fcitx5-configtool
  339. (package
  340. (name "fcitx5-configtool")
  341. (version "5.0.5")
  342. (source
  343. (origin
  344. (method url-fetch)
  345. (uri (string-append
  346. "https://download.fcitx-im.org/fcitx5"
  347. "/fcitx5-configtool/fcitx5-configtool-" version ".tar.xz"))
  348. (sha256
  349. (base32 "1diwiniqvsvcdwzcx1dqxbvwsr6ajbxs67my0cpn8n22asd5mx8i"))))
  350. (build-system cmake-build-system)
  351. (arguments
  352. `(#:configure-flags
  353. ;; KDE is currently not working on Guix, KCM supports doesn't make sense.
  354. '("-DENABLE_KCM=Off")))
  355. (inputs
  356. `(("fcitx5" ,fcitx5)
  357. ("fcitx5-qt" ,fcitx5-qt)
  358. ("qtbase" ,qtbase-5)
  359. ("qtx11extras" ,qtx11extras)
  360. ("kitemviews" ,kitemviews)
  361. ("kwidgetsaddons" ,kwidgetsaddons)
  362. ("libx11" ,libx11)
  363. ("xkeyboard-config" ,xkeyboard-config)
  364. ("libxkbfile" ,libxkbfile)
  365. ("gettext" ,gettext-minimal)
  366. ("iso-codes" ,iso-codes)))
  367. (native-inputs
  368. `(("gcc" ,gcc-9)
  369. ("extra-cmake-modules" ,extra-cmake-modules)
  370. ("pkg-config" ,pkg-config)))
  371. (home-page "https://github.com/fcitx/fcitx5-configtool")
  372. (synopsis "Graphical configuration tool for Fcitx 5")
  373. (description "Fcitx5-configtool is a graphical configuration tool
  374. to manage different input methods in Fcitx 5.")
  375. (license license:gpl2+)))
  376. (define-public fcitx5-material-color-theme
  377. (package
  378. (name "fcitx5-material-color-theme")
  379. (version "0.1")
  380. (source
  381. (origin
  382. (method git-fetch)
  383. (uri (git-reference
  384. (url "https://github.com/hosxy/Fcitx5-Material-Color")
  385. (commit version)))
  386. (file-name (git-file-name name version))
  387. (sha256
  388. (base32 "1mgc722521jmfx0xc3ibmiycd3q2w7xg2956xcpc07kz90gcdjaa"))))
  389. (build-system copy-build-system)
  390. (arguments
  391. `(#:phases
  392. (modify-phases %standard-phases
  393. (replace 'install
  394. (lambda* (#:key outputs #:allow-other-keys)
  395. (use-modules (srfi srfi-26))
  396. (let* ((out (assoc-ref outputs "out"))
  397. (assets-dir (string-append
  398. out "/share/fcitx5-material-color-theme"))
  399. (themes-prefix (string-append out "/share/fcitx5/themes")))
  400. (define (install-theme-variant variant target)
  401. (let ((dir (string-append themes-prefix "/" target))
  402. (png (string-append "panel-" variant ".png"))
  403. (conf (string-append "theme-" variant ".conf")))
  404. (format #t "install: Installing color variant \"~a\" to ~a~%"
  405. variant dir)
  406. (substitute* conf
  407. (("^Name=.*")
  408. (string-append "Name=" target "\n")))
  409. (mkdir-p dir)
  410. (install-file png dir)
  411. (copy-file conf (string-append dir "/theme.conf"))
  412. (symlink (string-append assets-dir "/arrow.png")
  413. (string-append dir "/arrow.png"))))
  414. (mkdir-p assets-dir)
  415. (install-file "arrow.png" assets-dir)
  416. (for-each
  417. (lambda (x)
  418. (install-theme-variant
  419. x (string-append "Material-Color-" (string-capitalize x))))
  420. '("black" "blue" "brown" "indigo"
  421. "orange" "pink" "red" "teal"))
  422. (install-theme-variant
  423. "deepPurple" "Material-Color-DeepPurple")))))))
  424. (home-page "https://github.com/hosxy/Fcitx5-Material-Color")
  425. (synopsis "Material Design for Fcitx 5")
  426. (description "Fcitx5-material-color-theme is a Material Design theme
  427. for Fcitx 5 with following color variants:
  428. @itemize
  429. @item Black
  430. @item Blue
  431. @item Brown
  432. @item Indigo
  433. @item Orange
  434. @item Pink
  435. @item Red
  436. @item teal
  437. @item DeepPurple
  438. @end itemize\n")
  439. (license license:asl2.0)))