summary refs log tree commit diff
path: root/gnu/packages/fcitx5.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/fcitx5.scm')
-rw-r--r--gnu/packages/fcitx5.scm118
1 files changed, 83 insertions, 35 deletions
diff --git a/gnu/packages/fcitx5.scm b/gnu/packages/fcitx5.scm
index 92fc0ea171..13031d6d3d 100644
--- a/gnu/packages/fcitx5.scm
+++ b/gnu/packages/fcitx5.scm
@@ -1,6 +1,7 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2020 Zhu Zihao <all_but_last@163.com>
+;;; Copyright © 2020, 2022 Zhu Zihao <all_but_last@163.com>
 ;;; Copyright © 2021 Tobias Geerinckx-Rice <me@tobias.gr>
+;;; Copyright © 2022 Dominic Martinez <dom@dominicm.dev>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -20,10 +21,12 @@
 (define-module (gnu packages fcitx5)
   #:use-module (guix packages)
   #:use-module (guix download)
+  #:use-module (guix gexp)
   #:use-module (guix git-download)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system copy)
   #:use-module ((guix licenses) #:prefix license:)
+  #:use-module (gnu packages anthy)
   #:use-module (gnu packages boost)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages datastructures)
@@ -196,43 +199,60 @@ editors.")
         (base32 "07ip4sxf3q895pp7mivv2bdwcmqjnwrmv9pg99jk73cw9bgyq00n"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:tests? #f                      ;No test
-       #:configure-flags
-       (list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
-                            %output "/share/gir-1.0")
-             (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
-                            %output "/lib/girepository-1.0")
-             ;; TODO: Enable it when Guix has GTK4.
-             "-DENABLE_GTK4_IM_MODULE=Off")
-       #:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'patch-install-prefix
-           (lambda* (#:key outputs #:allow-other-keys)
-             (let ((out (assoc-ref outputs "out"))
-                   (gtk2 (assoc-ref outputs "gtk2")))
-               ;; Install GTK+ 2 input method module to its own output.
-               (substitute* "gtk2/CMakeLists.txt"
-                 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
-                  (string-append gtk2 "/lib")))))))))
+     (list
+      #:tests? #f                       ;No test
+      #:configure-flags
+      #~(list (string-append "-DGOBJECT_INTROSPECTION_GIRDIR="
+                             #$output "/share/gir-1.0")
+              (string-append "-DGOBJECT_INTROSPECTION_TYPELIBDIR="
+                             #$output "/lib/girepository-1.0"))
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'configure 'patch-install-prefix
+            (lambda _
+              ;; Take care of different versions of GTK because this package
+              ;; provides IM module for GTK application to use input method.
+              (define (split-immodule gtk-version output)
+                (substitute* (string-append gtk-version "/CMakeLists.txt")
+                  (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
+                   (string-append output "/lib"))))
+
+              (let ((gtk2 #$output:gtk2)
+                    (gtk3 #$output:gtk3)
+                    (gtk4 #$output:gtk4))
+                (for-each split-immodule
+                          '("gtk2" "gtk3" "gtk4")
+                          (list gtk2 gtk3 gtk4))))))))
     (inputs
-     `(("fcitx5" ,fcitx5)
-       ("fmt" ,fmt)
-       ("libxkbcommon" ,libxkbcommon)
-       ("gobject-introspection" ,gobject-introspection)
-       ("gtk2" ,gtk+-2)
-       ("gtk3" ,gtk+)
-       ("glib" ,glib)
-       ("libx11" ,libx11)
-       ("gettext" ,gettext-minimal)))
+     (list fcitx5
+           fmt
+           libx11
+           libxkbcommon
+           gettext-minimal
+           gobject-introspection
+           gtk+-2
+           gtk+
+           gtk
+           glib))
     (native-inputs
      (list extra-cmake-modules pkg-config
            `(,glib "bin")))           ;for glib-genmarshal
-    ;; TODO: Add "lib" output to reduce the closure size of "gtk2".
-    (outputs '("out" "gtk2"))
+    (outputs '("out" "gtk2" "gtk3" "gtk4"))
     (home-page "https://github.com/fcitx/fcitx5-gtk")
-    (synopsis "Glib based D-Bus client and GTK IM module for Fcitx 5")
-    (description "Fcitx5-gtk provides a Glib based D-Bus client and IM module
-for GTK+2/GTK+3 application.")
+    (synopsis "GLib-based D-Bus client and GTK IM module for Fcitx 5")
+    (description "Fcitx5-gtk provides the following functionality in the
+corresponding output:
+
+@table @code
+@item out
+GLib-based D-Bus client of Fcitx5.
+@item gtk2
+IM module for GTK+2 applications.
+@item gtk3
+IM module for GTK+3 applications.
+@item gtk4
+IM module for GTK4 applications.
+@end table")
     (license license:lgpl2.1+)))
 
 (define-public fcitx5-qt
@@ -270,6 +290,30 @@ for Qt based application.")
                    ;; and qt5/platforminputcontext.
                    license:bsd-3))))
 
+(define-public fcitx5-anthy
+  (package
+    (name "fcitx5-anthy")
+    (version "5.0.9")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://download.fcitx-im.org/fcitx5"
+                           "/fcitx5-anthy/fcitx5-anthy-"
+                           version ".tar.xz"))
+       (sha256
+        (base32 "0i2ahfp1vh0cs3brcsfblzqwszal2qj1ncgb1hbc9v03s1j6bybk"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:tests? #f)) ;; no tests
+    (inputs (list fcitx5 anthy gettext-minimal fmt))
+    (native-inputs
+     (list extra-cmake-modules pkg-config))
+    (home-page "https://github.com/fcitx/fcitx5-anthy")
+    (synopsis "Anthy Japanese language input for Fcitx 5")
+    (description "Fcitx5-Anthy provides Japanese input support to Fcitx5 using
+the Anthy input method.")
+    (license license:gpl2+)))
+
 (define-public fcitx5-chinese-addons
   (package
     (name "fcitx5-chinese-addons")
@@ -284,7 +328,9 @@ for Qt based application.")
         (base32 "11l76gpcfm0x1f6x5m9s37q7ffa7xcsdydlzjdz2s6kk45fvvq89"))))
     (build-system cmake-build-system)
     (arguments
-     `(#:phases
+     `(#:configure-flags
+       '("-DUSE_WEBKIT=off")
+       #:phases
        (modify-phases %standard-phases
          (add-before 'configure 'split-outputs
            ;; Build with GUI supports requires Qt and increase package closure
@@ -305,7 +351,9 @@ for Qt based application.")
        ("opencc" ,opencc)
        ("qtbase" ,qtbase-5)
        ("fcitx5-qt" ,fcitx5-qt)
-       ("qtwebkit" ,qtwebkit)))
+       ("qtdeclarative" ,qtdeclarative)
+       ("qtwebchannel" ,qtwebchannel)
+       ("qtwebengine" ,qtwebengine)))
     (native-inputs
      (list extra-cmake-modules pkg-config))
     (outputs '("out" "gui"))