all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
@ 2022-01-31  6:53 Zhu Zihao
  2022-02-06 12:47 ` Zhu Zihao
  2022-02-06 15:48 ` Maxime Devos
  0 siblings, 2 replies; 18+ messages in thread
From: Zhu Zihao @ 2022-01-31  6:53 UTC (permalink / raw)
  To: 53648


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



[-- 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: 2832 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] 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: Type: text/plain, Size: 100 bytes --]


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  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
  1 sibling, 0 replies; 18+ messages in thread
From: Zhu Zihao @ 2022-02-06 12:47 UTC (permalink / raw)
  To: 53648

[-- Attachment #1: Type: text/plain, Size: 112 bytes --]

ping.
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  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
  1 sibling, 1 reply; 18+ messages in thread
From: Maxime Devos @ 2022-02-06 15:48 UTC (permalink / raw)
  To: Zhu Zihao, 53648

[-- Attachment #1: Type: text/plain, Size: 379 bytes --]

Zhu Zihao schreef op ma 31-01-2022 om 14:53 [+0800]:
> -    (outputs '("out" "gtk2"))
> +    (outputs '("out" "gtk2" "gtk4"))

What's the point of building for three separate gtk versions?
Why not just build for gtk@4?

Also, if we go for multiple outputs, shouldn't the latest gtk version
go into "out" instead of the middle version gtk@3?

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-06 15:48 ` Maxime Devos
@ 2022-02-06 16:02   ` Zhu Zihao
  2022-02-06 17:03     ` Maxime Devos
  0 siblings, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2022-02-06 16:02 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 53648

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]


Maxime Devos <maximedevos@telenet.be> writes:

> What's the point of building for three separate gtk versions?
> Why not just build for gtk@4?

Many packages still use GTK3, aren't they?

> Also, if we go for multiple outputs, shouldn't the latest gtk version
> go into "out" instead of the middle version gtk@3?

IMO, GTK3 is still majority, so put it under "out", and make gtk2 and
gtk4 separated.
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-06 16:02   ` Zhu Zihao
@ 2022-02-06 17:03     ` Maxime Devos
  2022-02-07  4:25       ` Zhu Zihao
  2022-02-07  5:58       ` Zhu Zihao
  0 siblings, 2 replies; 18+ messages in thread
From: Maxime Devos @ 2022-02-06 17:03 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 53648

[-- Attachment #1: Type: text/plain, Size: 1026 bytes --]

Zhu Zihao schreef op ma 07-02-2022 om 00:02 [+0800]:
> Maxime Devos <maximedevos@telenet.be> writes:
> 
> > What's the point of building for three separate gtk versions?
> > Why not just build for gtk@4?
> 
> Many packages still use GTK3, aren't they?
> 
> > Also, if we go for multiple outputs, shouldn't the latest gtk
> version
> > go into "out" instead of the middle version gtk@3?
> 
> IMO, GTK3 is still majority, so put it under "out", and make gtk2 and
> gtk4 separated.

It doesn't seem relevant to me that most packages use gtk+@3,
since fcitx5-gtk is not most packages.  Majority is irrelevant here.

Anyways, we try to use the latest version of packages in Guix whenever
feasible (for features, for bugfixes, because eventually the old
versions will be unsupported upstream and to have less versions to
keep track of), and gtk@4 is the latest version of gtk, so it seems to
me that we should simplify things here by just using the latest version
of gtk, i.e., gtk@4.

Greetings,
Maximes

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-06 17:03     ` Maxime Devos
@ 2022-02-07  4:25       ` Zhu Zihao
  2022-02-07  8:42         ` Maxime Devos
  2022-02-07  5:58       ` Zhu Zihao
  1 sibling, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2022-02-07  4:25 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 53648

[-- Attachment #1: Type: text/plain, Size: 1724 bytes --]


Maxime Devos <maximedevos@telenet.be> writes:

> [[PGP Signed Part:Undecided]]
> Zhu Zihao schreef op ma 07-02-2022 om 00:02 [+0800]:
>> Maxime Devos <maximedevos@telenet.be> writes:
>> 
>> > What's the point of building for three separate gtk versions?
>> > Why not just build for gtk@4?
>> 
>> Many packages still use GTK3, aren't they?
>> 
>> > Also, if we go for multiple outputs, shouldn't the latest gtk
>> version
>> > go into "out" instead of the middle version gtk@3?
>> 
>> IMO, GTK3 is still majority, so put it under "out", and make gtk2 and
>> gtk4 separated.
>
> It doesn't seem relevant to me that most packages use gtk+@3,
> since fcitx5-gtk is not most packages.  Majority is irrelevant here.
>
> Anyways, we try to use the latest version of packages in Guix whenever
> feasible (for features, for bugfixes, because eventually the old
> versions will be unsupported upstream and to have less versions to
> keep track of), and gtk@4 is the latest version of gtk, so it seems to
> me that we should simplify things here by just using the latest version
> of gtk, i.e., gtk@4.
>
> Greetings,
> Maximes
>
> [[End of PGP Signed Part]]

It matters, because fcitx5-gtk is not a GTK *application*, it provides
IM module for GTK applications. Guix users may have both GTK3 & GTK4
application in same environment. If we drop gtk3 (or even gtk2), their
input method will be broken.

I just check the comment left by iyzsong, and I think it's better to
make the glib client in "out", and make IM module for different GTK
version in "gtk2" "gtk3" "gtk4" output. Thoughts?
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-06 17:03     ` Maxime Devos
  2022-02-07  4:25       ` Zhu Zihao
@ 2022-02-07  5:58       ` Zhu Zihao
  1 sibling, 0 replies; 18+ messages in thread
From: Zhu Zihao @ 2022-02-07  5:58 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 53648


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



[-- 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: 2719 bytes --]

From ef83eb7614d8888fa538d16870a960cc84717147 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] <phases>: Split input method
module into different outputs for GTK2, GTK3 and GTK4.

Now default output only provides GLib client of Fcitx5.

[outputs]: Add new "gtk3" output.
---
 gnu/packages/fcitx5.scm | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/gnu/packages/fcitx5.scm b/gnu/packages/fcitx5.scm
index 123418cd4f..e9884d8f0a 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.
@@ -206,18 +206,12 @@ (define-public fcitx5-gtk
        (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"
+             (define (split-immodule gtk-version)
+               (substitute* (string-append gtk-version "/CMakeLists.txt")
                  (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
-                  (string-append gtk2 "/lib")))
+                  (string-append (assoc-ref outputs gtk-version) "/lib"))))
 
-               ;; Install for GTK 4.
-               (substitute* "gtk4/CMakeLists.txt"
-                 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
-                  (string-append gtk4 "/lib")))))))))
+             (for-each split-immodule '("gtk2" "gtk3" "gtk4")))))))
     (inputs
      `(("fcitx5" ,fcitx5)
        ("fmt" ,fmt)
@@ -233,7 +227,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" "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
-- 
2.34.0


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


-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-07  4:25       ` Zhu Zihao
@ 2022-02-07  8:42         ` Maxime Devos
  2022-02-08  4:19           ` Zhu Zihao
  0 siblings, 1 reply; 18+ messages in thread
From: Maxime Devos @ 2022-02-07  8:42 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 53648

[-- Attachment #1: Type: text/plain, Size: 1069 bytes --]

Zhu Zihao schreef op ma 07-02-2022 om 12:25 [+0800]:
> It matters, because fcitx5-gtk is not a GTK *application*, it
> provides IM module for GTK applications. Guix users may have both
> GTK3 & GTK4 application in same environment. If we drop gtk3 (or even
> gtk2), their input method will be broken.

Ok, that's a good reason, but it would deserve a comment in the package
definition to explain matters to future readers.

> I just check the comment left by iyzsong, and I think it's better to
> make the glib client in "out", and make IM module for different GTK
> version in "gtk2" "gtk3" "gtk4" output. Thoughts?

It would be useful to explain in the description that the output
that needs to be installed, depends on what other software in in the
profile.  E.g.:

"Fcitx5-gtk provides a Glib-based D-bus client and IM module for
GTK+2/GTK+3/GTK4 applications.  The output that needs to be installed,
depends on which variant of GTK that applications use.  When in doubt,
it is sufficient to simply install all outputs."

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-07  8:42         ` Maxime Devos
@ 2022-02-08  4:19           ` Zhu Zihao
  2022-02-08 10:02             ` Maxime Devos
  0 siblings, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2022-02-08  4:19 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 53648


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


I use @table texinfo command to make the use of different output clear
:)


[-- 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: 3334 bytes --]

From e54a1064c4c98f8a0c46e7151bcfb2b63b611ae0 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] <phases>: Split input method
module into different outputs for GTK2, GTK3 and GTK4.

Now default output only provides GLib client of Fcitx5.

[outputs]: Add new "gtk3" output.
---
 gnu/packages/fcitx5.scm | 36 +++++++++++++++++++++---------------
 1 file changed, 21 insertions(+), 15 deletions(-)

diff --git a/gnu/packages/fcitx5.scm b/gnu/packages/fcitx5.scm
index 123418cd4f..b7a7d8c8c4 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.
@@ -206,18 +206,14 @@ (define-public fcitx5-gtk
        (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"
+             ;; 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)
+               (substitute* (string-append gtk-version "/CMakeLists.txt")
                  (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
-                  (string-append gtk2 "/lib")))
+                  (string-append (assoc-ref outputs gtk-version) "/lib"))))
 
-               ;; Install for GTK 4.
-               (substitute* "gtk4/CMakeLists.txt"
-                 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
-                  (string-append gtk4 "/lib")))))))))
+             (for-each split-immodule '("gtk2" "gtk3" "gtk4")))))))
     (inputs
      `(("fcitx5" ,fcitx5)
        ("fmt" ,fmt)
@@ -232,12 +228,22 @@ (define-public fcitx5-gtk
     (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.")
+    (description "Fcitx5-gtk provides following functionality in 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: 101 bytes --]



-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-08  4:19           ` Zhu Zihao
@ 2022-02-08 10:02             ` Maxime Devos
  2022-02-09  2:12               ` Zhu Zihao
  0 siblings, 1 reply; 18+ messages in thread
From: Maxime Devos @ 2022-02-08 10:02 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 53648

[-- Attachment #1: Type: text/plain, Size: 3325 bytes --]

Zhu Zihao schreef op di 08-02-2022 om 12:19 [+0800]:
>        (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")))

Perhaps I should have mentioned this earlier, but this can be
simplified a little with G-exps:

   (out #$output)
   (gtk2 #output:gtk2)
   (gtk4 #$output:gtk4)

> -               ;; Install GTK+ 2 input method module to its own
> output.
> -               (substitute* "gtk2/CMakeLists.txt"
> +             ;; 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)

gtk-version -> gtk-output

> +               (substitute* (string-append gtk-version
> "/CMakeLists.txt")
>                   (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
> -                  (string-append gtk2 "/lib")))
> +                  (string-append (assoc-ref outputs gtk-version)
> "/lib"))))

(assoc-ref outputs gtk-version) -> gtk-output

>  
> -               ;; Install for GTK 4.
> -               (substitute* "gtk4/CMakeLists.txt"
> -                 (("\\$\\{CMAKE_INSTALL_LIBDIR\\}")
> -                  (string-append gtk4 "/lib")))))))))
> +             (for-each split-immodule '("gtk2" "gtk3" "gtk4")))))))

'("gtk2" "gtk3" "gtk4") --> (list gtk2 gtk3 gtk4)

YMMV whether this change would be an improvement.

Likewise, %output can be eliminated by using #$output..

>      (inputs
>       `(("fcitx5" ,fcitx5)
>         ("fmt" ,fmt)
> @@ -232,12 +228,22 @@ (define-public fcitx5-gtk
>      (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.")
> +    (description "Fcitx5-gtk provides following functionality in
> 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+)))

Looks nice and orderrly.
A few definite articles would seem to be in place though:
‘Fcitx5-gtk provides the following functionality in the corresponding
output:’

I'm not 100% sure but I think it's ‘GLib-based’ (with a hyphen) instead
of ’GLib based’.

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-08 10:02             ` Maxime Devos
@ 2022-02-09  2:12               ` Zhu Zihao
  2022-02-09 11:05                 ` Maxime Devos
  0 siblings, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2022-02-09  2:12 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 53648


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



[-- 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: 5518 bytes --]

From 231d1a839daf5ff5f7845a0084d8cbefd7238ad3 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..b1938619f9 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* (#:key outputs #:allow-other-keys)
+              ;; 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
+           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 following functionality in 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: 210 bytes --]


#$ ungexp reader macro doesn't support variable as output specification makes
code look a litte cumbersome...
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-09  2:12               ` Zhu Zihao
@ 2022-02-09 11:05                 ` Maxime Devos
  2022-02-09 15:54                   ` Zhu Zihao
  0 siblings, 1 reply; 18+ messages in thread
From: Maxime Devos @ 2022-02-09 11:05 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 53648

[-- Attachment #1: Type: text/plain, Size: 777 bytes --]

Zhu Zihao schreef op wo 09-02-2022 om 10:12 [+0800]:
> +            (lambda* (#:key outputs #:allow-other-keys)

Since you're doing #$output:FOO instead of (assoc-ref outputs "foo")
below now, 'outputs' is now unused, so this can be simplified to

(lambda _ ; <-- no (#:key outputs #:allow-other-keys) argument list needed
  ;; Take care of [...]
  (define (split-immodule gtk-version output)
    [...])
  [...])

> +    (description "Fcitx5-gtk provides following functionality in corresponding

As previously mentioned, a few definite articles would seem to be in place:
‘Fcitx5-gtk provides _the_ following functionality in _the_ corresponding
output:’ (emphasis mine).

Otherwise, LGTM, although I didn't test it.

Greetings,
Maxime.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-09 11:05                 ` Maxime Devos
@ 2022-02-09 15:54                   ` Zhu Zihao
  2022-02-09 20:33                     ` Maxime Devos
  0 siblings, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2022-02-09 15:54 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 53648


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

I've clean the code.


[-- 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: 5492 bytes --]

From 49f3d7e4f8a07f546c49a894867c8c633dd58309 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..514c94ef2e 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
+           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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-09 15:54                   ` Zhu Zihao
@ 2022-02-09 20:33                     ` Maxime Devos
  2022-02-09 23:23                       ` Zhu Zihao
  0 siblings, 1 reply; 18+ messages in thread
From: Maxime Devos @ 2022-02-09 20:33 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 53648

[-- Attachment #1: Type: text/plain, Size: 445 bytes --]

users guix
usertags 53648 reviewed-looks-good
thanks

Zhu Zihao schreef op wo 09-02-2022 om 23:54 [+0800]:
> +                  (("¥¥$¥¥{CMAKE_INSTALL_LIBDIR¥¥}")
> +                   (string-append output "/lib"))))

Aside from the file encoding issue of the patch file (which the
committer might be in a better position to figure out), LGTM
(although I didn't personally test it.)

Greetings,
Maxime.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-09 20:33                     ` Maxime Devos
@ 2022-02-09 23:23                       ` Zhu Zihao
  2022-02-11 17:42                         ` Zhu Zihao
  0 siblings, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2022-02-09 23:23 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 53648


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


Maxime Devos <maximedevos@telenet.be> writes:

> [[PGP Signed Part:Undecided]]
> users guix
> usertags 53648 reviewed-looks-good
> thanks
>
> Zhu Zihao schreef op wo 09-02-2022 om 23:54 [+0800]:
>> +                  (("¥¥$¥¥{CMAKE_INSTALL_LIBDIR¥¥}")
>> +                   (string-append output "/lib"))))
>
> Aside from the file encoding issue of the patch file (which the
> committer might be in a better position to figure out), LGTM
> (although I didn't personally test it.)
>
> Greetings,
> Maxime.
>
> [[End of PGP Signed Part]]

Re-format them in UTF-8 encoding. Sorry for that (maybe I tweaked the
prefer encoding of Emacs but I forget it.)


[-- 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: 5492 bytes --]

From 49f3d7e4f8a07f546c49a894867c8c633dd58309 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..514c94ef2e 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
+           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: 102 bytes --]




-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-09 23:23                       ` Zhu Zihao
@ 2022-02-11 17:42                         ` Zhu Zihao
  2022-02-14 13:36                           ` Ludovic Courtès
  0 siblings, 1 reply; 18+ messages in thread
From: Zhu Zihao @ 2022-02-11 17:42 UTC (permalink / raw)
  To: Maxime Devos; +Cc: 53648


[-- 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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-11 17:42                         ` Zhu Zihao
@ 2022-02-14 13:36                           ` Ludovic Courtès
  2022-02-16 13:25                             ` Zhu Zihao
  0 siblings, 1 reply; 18+ messages in thread
From: Ludovic Courtès @ 2022-02-14 13:36 UTC (permalink / raw)
  To: Zhu Zihao; +Cc: 53648, Maxime Devos

Hi,

Zhu Zihao <all_but_last@163.com> skribis:

>>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'.

[...]

>>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.

Applied!

However, I wonder if this should not be split into several packages,
rather than several outputs.  The main reason is that merely building
fcitx5-gtk now requires pulling all three GTK+ versions, and GTK4 has a
lot more dependencies, some of which may be unavailable on platforms
other than x86_64.

WDYT?

Thanks,
Ludo’.




^ permalink raw reply	[flat|nested] 18+ messages in thread

* [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
  2022-02-14 13:36                           ` Ludovic Courtès
@ 2022-02-16 13:25                             ` Zhu Zihao
  0 siblings, 0 replies; 18+ messages in thread
From: Zhu Zihao @ 2022-02-16 13:25 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: 53648, Maxime Devos

[-- Attachment #1: Type: text/plain, Size: 640 bytes --]


Ludovic Courtès <ludo@gnu.org> writes:
> Applied!
>
> However, I wonder if this should not be split into several packages,
> rather than several outputs.  The main reason is that merely building
> fcitx5-gtk now requires pulling all three GTK+ versions, and GTK4 has a
> lot more dependencies, some of which may be unavailable on platforms
> other than x86_64.
>
> WDYT?
>
> Thanks,
> Ludo’.

Fcitx5-gtk doesn't provide option to build only GTK4 module(GLib client
must build), it may requires heavily patch work.
-- 
Retrieve my PGP public key:

  gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2022-02-16 13:28 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2022-02-14 13:36                           ` Ludovic Courtès
2022-02-16 13:25                             ` Zhu Zihao
2022-02-07  5:58       ` Zhu Zihao

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.