summary refs log tree commit diff
path: root/gnu/packages/ibus.scm
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/packages/ibus.scm')
-rw-r--r--gnu/packages/ibus.scm118
1 files changed, 85 insertions, 33 deletions
diff --git a/gnu/packages/ibus.scm b/gnu/packages/ibus.scm
index ab4b82284e..4cf6762d24 100644
--- a/gnu/packages/ibus.scm
+++ b/gnu/packages/ibus.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2018, 2019, 2020, 2021 Peng Mei Yu <pengmeiyu@riseup.net>
 ;;; Copyright © 2020 kanichos <kanichos@yandex.ru>
 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
+;;; Copyright © 2021 Felix Gruber <felgru@posteo.net>
 ;;; Copyright © 2021 Songlin Jiang <hollowman@hollowman.ml>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -44,6 +45,7 @@
   #:use-module (gnu packages databases)
   #:use-module (gnu packages datastructures)
   #:use-module (gnu packages dbm)
+  #:use-module (gnu packages docbook)
   #:use-module (gnu packages freedesktop)
   #:use-module (gnu packages gettext)
   #:use-module (gnu packages glib)
@@ -51,19 +53,22 @@
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages iso-codes)
   #:use-module (gnu packages logging)
+  #:use-module (gnu packages perl)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages python-web)
   #:use-module (gnu packages serialization)
   #:use-module (gnu packages sqlite)
   #:use-module (gnu packages textutils)
   #:use-module (gnu packages unicode)
-  #:use-module (gnu packages xorg))
+  #:use-module (gnu packages xorg)
+  #:use-module (gnu packages xdisorg))
 
 (define-public ibus
   (package
     (name "ibus")
-    (version "1.5.22")
+    (version "1.5.24")
     (source (origin
               (method url-fetch)
               (uri (string-append "https://github.com/ibus/ibus/"
@@ -71,12 +76,14 @@
                                   version "/ibus-" version ".tar.gz"))
               (sha256
                (base32
-                "0jmy2w01phpmqnjnfnak7nvfna57mpgfnl87jwc4iai8ijjynw41"))))
+                "07s2ly75xv50bqg37mn37i9akqvcfd45k2mbplxrsqk3a2b3mwxb"))))
     (build-system glib-or-gtk-build-system)
+    (outputs '("out" "doc"))
     (arguments
-     `(#:tests? #f  ; tests fail because there's no connection to dbus
-       #:parallel-build? #f ; race condition discovered with emoji support
+     `(#:parallel-build? #f ; race condition discovered with emoji support
        #:configure-flags (list "--enable-python-library"
+                               "--enable-gtk-doc"
+                               "--enable-memconf"
                                (string-append
                                 "--with-unicode-emoji-dir="
                                 (assoc-ref %build-inputs "unicode-emoji")
@@ -91,6 +98,20 @@
                                "--enable-wayland")
        #:phases
        (modify-phases %standard-phases
+         (add-after 'unpack 'disable-failing-tests
+           (lambda _
+             ;; These tests require /etc/machine-id.
+             (with-directory-excursion "src/tests"
+               (substitute* '("ibus-share.c" "ibus-compose.c"
+                              "ibus-keypress.c")
+                 (("[ \t]*return g_test_run \\(\\);") "")))))
+         (add-after 'unpack 'patch-docbook-xml
+           (lambda* (#:key inputs #:allow-other-keys)
+             (with-directory-excursion "docs/reference/ibus"
+               (substitute* "ibus-docs.sgml.in"
+                 (("http://www.oasis-open.org/docbook/xml/4.1.2/")
+                  (string-append (assoc-ref inputs "docbook-xml")
+                                 "/xml/dtd/docbook/"))))))
          (add-after 'unpack 'patch-python-target-directories
            (lambda* (#:key outputs #:allow-other-keys)
              (let ((root (string-append (assoc-ref outputs "out")
@@ -101,13 +122,11 @@
                  (("(py2?overridesdir)=.*" _ var)
                   (string-append var "=" root "/gi/overrides/"))
                  (("(pkgpython2dir=).*" _ var)
-                  (string-append var root "/ibus"))))
-             #t))
+                  (string-append var root "/ibus"))))))
          (add-before 'configure 'disable-dconf-update
            (lambda _
              (substitute* "data/dconf/Makefile.in"
-               (("dconf update") "echo dconf update"))
-             #t))
+               (("dconf update") "echo dconf update"))))
          (add-after 'unpack 'delete-generated-files
            (lambda _
              (for-each (lambda (file)
@@ -115,53 +134,85 @@
                            (when (file-exists? c)
                              (format #t "deleting ~a\n" c)
                              (delete-file c))))
-                       (find-files "." "\\.vala"))
-             #t))
+                       (find-files "." "\\.vala"))))
          (add-after 'unpack 'fix-paths
            (lambda* (#:key inputs #:allow-other-keys)
              (substitute* "src/ibusenginesimple.c"
                (("/usr/share/X11/locale")
-                (string-append (assoc-ref inputs "libx11")
-                               "/share/X11/locale")))
+                (search-input-directory inputs
+                                        "share/X11/locale")))
              (substitute* "ui/gtk3/xkblayout.vala"
                (("\"(setxkbmap|xmodmap)\"" _ prog)
-                (string-append "\"" (assoc-ref inputs prog) "/bin/" prog "\"")))
-             #t))
+                (string-append "\""
+                               (search-input-file inputs
+                                                  (string-append "bin/" prog))
+                               "\"")))))
+         (add-before 'check 'pre-check
+           (lambda _
+             ;; Tests write to $HOME.
+             (setenv "HOME" (getcwd))
+             ;; Tests look for $XDG_RUNTIME_DIR.
+             (setenv "XDG_RUNTIME_DIR" (getcwd))
+             ;; For missing '/etc/machine-id'.
+             (setenv "DBUS_FATAL_WARNINGS" "0")
+             ;; Tests require a running X server.
+             (system "Xvfb :1 +extension GLX &")
+             (setenv "DISPLAY" ":1")
+             ;; Tests require running iBus daemon.
+             (system "./bus/ibus-daemon --daemonize")))
+         (add-after 'install 'move-doc
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let* ((out (assoc-ref outputs "out"))
+                    (doc (assoc-ref outputs "doc")))
+               (mkdir-p (string-append doc "/share"))
+               (rename-file
+                (string-append out "/share/gtk-doc")
+                (string-append doc "/share/gtk-doc")))))
          (add-after 'wrap-program 'wrap-with-additional-paths
            (lambda* (#:key outputs #:allow-other-keys)
              ;; Make sure 'ibus-setup' runs with the correct PYTHONPATH and
              ;; GI_TYPELIB_PATH.
              (let ((out (assoc-ref outputs "out")))
                (wrap-program (string-append out "/bin/ibus-setup")
-                 `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))
+                 `("GUIX_PYTHONPATH" ":" prefix (,(getenv "GUIX_PYTHONPATH")))
                  `("GI_TYPELIB_PATH" ":" prefix
                    (,(getenv "GI_TYPELIB_PATH")
-                    ,(string-append out "/lib/girepository-1.0")))))
-             #t)))))
+                    ,(string-append out "/lib/girepository-1.0"))))))))))
     (inputs
      `(("dbus" ,dbus)
        ("dconf" ,dconf)
-       ("gconf" ,gconf)
+       ("glib" ,glib)
        ("gtk2" ,gtk+-2)
        ("gtk+" ,gtk+)
+       ("iso-codes" ,iso-codes)
        ("json-glib" ,json-glib)
        ("libnotify" ,libnotify)
        ("libx11" ,libx11)
+       ("libxkbcommon" ,libxkbcommon)
+       ("libxtst" ,libxtst)
+       ("pygobject" ,python-pygobject)
+       ("python" ,python)
+       ("python-dbus" ,python-dbus)
        ("setxkbmap" ,setxkbmap)
+       ("ucd" ,ucd)
+       ("unicode-cldr-common" ,unicode-cldr-common)
+       ("unicode-emoji" ,unicode-emoji)
        ("wayland" ,wayland)
-       ("xmodmap" ,xmodmap)
-       ("iso-codes" ,iso-codes)
-       ("pygobject2" ,python-pygobject)
-       ("python" ,python)))
+       ("xmodmap" ,xmodmap)))
     (native-inputs
-     `(("glib" ,glib "bin") ; for glib-genmarshal
+     `(("docbook-xml" ,docbook-xml-4.1.2)
+       ("glib" ,glib "bin")             ; for glib-genmarshal
        ("gettext" ,gettext-minimal)
+       ("gnome-common" ,gnome-common)
        ("gobject-introspection" ,gobject-introspection) ; for g-ir-compiler
-       ("ucd" ,ucd)
-       ("unicode-emoji" ,unicode-emoji)
-       ("unicode-cldr-common" ,unicode-cldr-common)
+       ("gtk+:bin" ,gtk+ "bin")
+       ("gtk-doc" ,gtk-doc)
+       ("perl" ,perl)
+       ("pkg-config" ,pkg-config)
+       ("python-wrapper" ,python-wrapper)
        ("vala" ,vala)
-       ("pkg-config" ,pkg-config)))
+       ("which" ,which)
+       ("xorg-server" ,xorg-server-for-tests)))
     (native-search-paths
      (list (search-path-specification
             (variable "IBUS_COMPONENT_PATH")
@@ -198,8 +249,8 @@ may also simplify input method development.")
              ;; PYTHONPATH and GI_TYPELIB_PATH.
              (let ((out (assoc-ref outputs "out")))
                (wrap-program (string-append out "/libexec/ibus-setup-libpinyin")
-                 `("PYTHONPATH" ":" =
-                   (,(getenv "PYTHONPATH")
+                 `("GUIX_PYTHONPATH" ":" prefix
+                   (,(getenv "GUIX_PYTHONPATH")
                     ,(string-append (assoc-ref inputs "ibus")
                                     "/lib/girepository-1.0")
                     ,(string-append (assoc-ref outputs "out")
@@ -280,8 +331,8 @@ Chinese pinyin input methods.")
                (for-each
                 (lambda (prog)
                   (wrap-program (string-append out "/libexec/" prog)
-                    `("PYTHONPATH" ":" prefix
-                      (,(getenv "PYTHONPATH")))
+                    `("GUIX_PYTHONPATH" ":" prefix
+                      (,(getenv "GUIX_PYTHONPATH")))
                     `("GI_TYPELIB_PATH" ":" prefix
                       (,(getenv "GI_TYPELIB_PATH")
                        ,(string-append out "/lib/girepository-1.0")))))
@@ -320,6 +371,7 @@ Japanese language input in most graphical applications.")
        (sha256
         (base32
          "0pqk0i3zcii3fx5laj9qzbgd58jvq6wn31j76w4zix2i4b1lqcqv"))
+       (patches (search-patches "librime-fix-build-with-gcc10.patch"))
        (modules '((guix build utils)))
        (snippet
         '(begin
@@ -752,7 +804,7 @@ hanja dictionary and small hangul character classification.")
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (wrap-program (string-append (assoc-ref outputs "out")
                                           "/libexec/ibus-setup-hangul")
-               `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))
+               `("GUIX_PYTHONPATH" ":" prefix (,(getenv "GUIX_PYTHONPATH")))
                `("LD_LIBRARY_PATH" ":" prefix
                  (,(string-append (assoc-ref inputs "libhangul") "/lib")))
                `("GI_TYPELIB_PATH" ":" prefix