all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Zhu Zihao <all_but_last@163.com>
To: Maxime Devos <maximedevos@telenet.be>
Cc: 53648@debbugs.gnu.org
Subject: [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
Date: Sat, 12 Feb 2022 01:42:39 +0800	[thread overview]
Message-ID: <865yplz3mx.fsf@163.com> (raw)
In-Reply-To: <86y22j7hew.fsf@163.com>


[-- Attachment #1.1: Type: text/plain, Size: 167 bytes --]


You can test it with

# No immodule cache needed for GTK4
./pre-inst-env guix shell fcitx5-gtk:gtk4 celluloid
GUIX_GTK4_PATH=$GUIX_ENVIRONMENT/lib/gtk-4.0 celluloid


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 255 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-gnu-fcitx5-gtk-Add-GTK-4-support.patch --]
[-- Type: text/x-patch, Size: 2836 bytes --]

From 0c23e8cbbfe8f0548b29176831a4358d41820159 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Mon, 31 Jan 2022 14:51:30 +0800
Subject: [PATCH 1/2] gnu: fcitx5-gtk: Add GTK 4 support.

* gnu/packages/fcitx5.scm (fcitx5-gtk)[arguments]:
<configure-flags>: Enable GTK 4 IM module.
<phases>: In 'patch-install-prefix', patch the install prefix of GTK 4 IM
module.
[inputs]: Add GTK 4.
[outputs]: Add 'gtk4'.
---
 gnu/packages/fcitx5.scm | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/fcitx5.scm b/gnu/packages/fcitx5.scm
index 92fc0ea171..123418cd4f 100644
--- a/gnu/packages/fcitx5.scm
+++ b/gnu/packages/fcitx5.scm
@@ -201,19 +201,23 @@ (define-public fcitx5-gtk
        (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")
+                            %output "/lib/girepository-1.0"))
        #: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")))
+                   (gtk2 (assoc-ref outputs "gtk2"))
+                   (gtk4 (assoc-ref outputs "gtk4")))
                ;; Install GTK+ 2 input method module to its own output.
                (substitute* "gtk2/CMakeLists.txt"
                  (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
-                  (string-append gtk2 "/lib")))))))))
+                  (string-append gtk2 "/lib")))
+
+               ;; Install for GTK 4.
+               (substitute* "gtk4/CMakeLists.txt"
+                 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
+                  (string-append gtk4 "/lib")))))))))
     (inputs
      `(("fcitx5" ,fcitx5)
        ("fmt" ,fmt)
@@ -221,6 +225,7 @@ (define-public fcitx5-gtk
        ("gobject-introspection" ,gobject-introspection)
        ("gtk2" ,gtk+-2)
        ("gtk3" ,gtk+)
+       ("gtk4" ,gtk)
        ("glib" ,glib)
        ("libx11" ,libx11)
        ("gettext" ,gettext-minimal)))
@@ -228,7 +233,7 @@ (define-public fcitx5-gtk
      (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" "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
-- 
2.34.0


[-- Attachment #3: 0002-gnu-fcitx5-gtk-Split-IM-module-output-for-different-.patch --]
[-- Type: text/x-patch, Size: 5500 bytes --]

From 429e4569a03af76a7fbd2b56726f35a1b38bc0b9 Mon Sep 17 00:00:00 2001
From: Zhu Zihao <all_but_last@163.com>
Date: Mon, 7 Feb 2022 13:55:26 +0800
Subject: [PATCH 2/2] gnu: fcitx5-gtk: Split IM module output for different
 version of GTK.

* gnu/packages/fcitx5.scm (fcitx5-gtk)[arguments]: Use G-Expression.

<phases>: Split input method module into different outputs for GTK2, GTK3 and GTK4.

Now default output only provides GLib client of Fcitx5.

[inputs]: Use label-less style inputs.
[outputs]: Add new "gtk3" output.

[synopsis]: Fix typo.
[description]: Describe the functionality of each output.
---
 gnu/packages/fcitx5.scm | 87 +++++++++++++++++++++++------------------
 1 file changed, 50 insertions(+), 37 deletions(-)

diff --git a/gnu/packages/fcitx5.scm b/gnu/packages/fcitx5.scm
index 123418cd4f..9e1ccdd3eb 100644
--- a/gnu/packages/fcitx5.scm
+++ b/gnu/packages/fcitx5.scm
@@ -1,5 +1,5 @@
 ;;; 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>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -20,6 +20,7 @@
 (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)
@@ -196,48 +197,60 @@ (define-public fcitx5-gtk
         (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"))
-       #: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"))
-                   (gtk4 (assoc-ref outputs "gtk4")))
-               ;; 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"))))
 
-               ;; Install for GTK 4.
-               (substitute* "gtk4/CMakeLists.txt"
-                 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
-                  (string-append gtk4 "/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+)
-       ("gtk4" ,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" "gtk4"))
+    (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
-- 
2.34.0


[-- Attachment #4: Type: text/plain, Size: 100 bytes --]


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

  reply	other threads:[~2022-02-11 18:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-31  6:53 [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support Zhu Zihao
2022-02-06 12:47 ` Zhu Zihao
2022-02-06 15:48 ` Maxime Devos
2022-02-06 16:02   ` Zhu Zihao
2022-02-06 17:03     ` Maxime Devos
2022-02-07  4:25       ` Zhu Zihao
2022-02-07  8:42         ` Maxime Devos
2022-02-08  4:19           ` Zhu Zihao
2022-02-08 10:02             ` Maxime Devos
2022-02-09  2:12               ` Zhu Zihao
2022-02-09 11:05                 ` Maxime Devos
2022-02-09 15:54                   ` Zhu Zihao
2022-02-09 20:33                     ` Maxime Devos
2022-02-09 23:23                       ` Zhu Zihao
2022-02-11 17:42                         ` Zhu Zihao [this message]
2022-02-14 13:36                           ` Ludovic Courtès
2022-02-16 13:25                             ` Zhu Zihao
2022-02-07  5:58       ` Zhu Zihao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=865yplz3mx.fsf@163.com \
    --to=all_but_last@163.com \
    --cc=53648@debbugs.gnu.org \
    --cc=maximedevos@telenet.be \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.