[PATCH] gnu: fcitx5-gtk: Add GTK 4 support.

  • Done
  • quality assurance status badge
Details
3 participants
  • Zhu Zihao
  • Ludovic Courtès
  • Maxime Devos
Owner
unassigned
Submitted by
Zhu Zihao
Severity
normal
Z
Z
Zhu Zihao wrote on 31 Jan 2022 07:53
(address . guix-patches@gnu.org)
86ilu09yzs.fsf@163.com

-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYfeHlxUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/mEjQD+OI9AiZb4xp9x3ykvPE/ZpaovpzRQ
eBcHaVpKBWvN9XgA/2cKeAPNWpVMj8oPxd40aVmAZtmkurc1T54Xdjwm6icD
=XKjL
-----END PGP SIGNATURE-----

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(-)

Toggle diff (52 lines)
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
--
Retrieve my PGP public key:

gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
Z
Z
Zhu Zihao wrote on 6 Feb 2022 13:47
(address . guix-patches@gnu.org)
868ruocgb6.fsf@163.com
ping.
--
Retrieve my PGP public key:

gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYf/DbRUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/mxogEA0njVKKipIVcpc4WP5h+l4QZzOFLM
l4jsaaerxquNEvkBAIQkqQrEX28Mzcopx7ToiIXrV6aN011QFGgrKH6njMgK
=tSoI
-----END PGP SIGNATURE-----

M
M
Maxime Devos wrote on 6 Feb 2022 16:48
Re: [bug#53648] [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
da29865129c6afc30fc732469153156914a030d6.camel@telenet.be
Zhu Zihao schreef op ma 31-01-2022 om 14:53 [+0800]:
Toggle quote (3 lines)
> -    (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.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYf/tuRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7pKdAP9bD3JLxa3fsbx2yl4q7egEJ0Tu
DAffQ396FXluWJwIPwD+I8bMVrhCKoIUGSK3lz9sanYwWcLdbuxWJT7feKY5Agc=
=jubl
-----END PGP SIGNATURE-----


Z
Z
Zhu Zihao wrote on 6 Feb 2022 17:02
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53648@debbugs.gnu.org)
8635kwasnn.fsf@163.com
Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (3 lines)
> 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?

Toggle quote (3 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYf/xbBUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/lrlAD/bNUIA3/TTaL0wCdtHP55p+vnlE7s
gz5cj/Sb5briOt4BAPr1Blf3krItwxIrwkHq8ht67RqIbKArCg3EBP1evMgI
=ffqO
-----END PGP SIGNATURE-----

M
M
Maxime Devos wrote on 6 Feb 2022 18:03
(name . Zhu Zihao)(address . all_but_last@163.com)(address . 53648@debbugs.gnu.org)
cf67ecebe5ab6c9f8583204b349581fbbb85e807.camel@telenet.be
Zhu Zihao schreef op ma 07-02-2022 om 00:02 [+0800]:
Toggle quote (14 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYf//ZhccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7h0LAQDu6+Yc+4u0jEtUgC7DjN4XTgk2
vaGC5XgsvHr69VSb0AD9E9xkigv4SD1kuseEH1nMzlFYpQST4WZ7mKeRPqqDSgw=
=549h
-----END PGP SIGNATURE-----


Z
Z
Zhu Zihao wrote on 7 Feb 2022 05:25
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53648@debbugs.gnu.org)
86czjz8fmt.fsf@163.com
Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (31 lines)
> [[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
-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYgCf2hUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/n6DAD+Lf3SqwYhY7OoDSZ/b3R6oAEqL+Ye
u0neP0OHKfsGeIwA/jZH0W9j2OY03gTTDQJIHL3r1IiyWUL468gX6jmDf2MK
=i0hg
-----END PGP SIGNATURE-----

Z
Z
Zhu Zihao wrote on 7 Feb 2022 06:58
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53648@debbugs.gnu.org)
86zgn36wva.fsf@163.com

-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYgC1GRUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/kp+gD/Q8pLWs6KsEtQTNMNY2F8YceZ9t9F
DtYJxeiv8cK1BKAA/27NV7oluwDU2YT6AmhXW+SFT+F+OSnx6t9o7blHdq0J
=sp2X
-----END PGP SIGNATURE-----

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(-)

Toggle diff (52 lines)
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
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(-)

Toggle diff (45 lines)
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
--
Retrieve my PGP public key:

gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
M
M
Maxime Devos wrote on 7 Feb 2022 09:42
(name . Zhu Zihao)(address . all_but_last@163.com)(address . 53648@debbugs.gnu.org)
ef1b08bdda2aa332ef9c547cbd0febe0d514d8f1.camel@telenet.be
Zhu Zihao schreef op ma 07-02-2022 om 12:25 [+0800]:
Toggle quote (5 lines)
> 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.

Toggle quote (4 lines)
> 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.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgDbkRccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7nMgAP9Hz+QGnyapK6XvD7Sk/E0y0SfL
nC2mzrMS2nlS+SwtpgEAx8nHWruzm4Sf9VIyKMkZFOh7T+YXMBlqyLcDHCOtNAI=
=5kWj
-----END PGP SIGNATURE-----


Z
Z
Zhu Zihao wrote on 8 Feb 2022 05:19
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53648@debbugs.gnu.org)
86pmnyyooc.fsf@163.com
I use @table texinfo command to make the use of different output clear
:)
-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYgHvkxUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/kjnQEAsVX9EvaI/YqcAcIV2AOWX51FCmnG
C/GAtfu48AsRA4gBANUOBqzfs4pzEix+6ANC5UNSa3U/zyTEPVXinEvrCpsF
=CNgF
-----END PGP SIGNATURE-----

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(-)

Toggle diff (52 lines)
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
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(-)

Toggle diff (65 lines)
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
--
Retrieve my PGP public key:

gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
M
M
Maxime Devos wrote on 8 Feb 2022 11:02
(name . Zhu Zihao)(address . all_but_last@163.com)(address . 53648@debbugs.gnu.org)
eaf9a2fdec0e25b52fcc4314252e3c06803977d5.camel@telenet.be
Zhu Zihao schreef op di 08-02-2022 om 12:19 [+0800]:
Toggle quote (7 lines)
>        (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)

Toggle quote (9 lines)
> -               ;; 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

Toggle quote (7 lines)
> +               (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

Toggle quote (7 lines)
>  
> -               ;; 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..

Toggle quote (32 lines)
>      (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.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgI/ohccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7odOAP9bQGoVRMPW4JG/zBzhNWS+0neK
rUw/RfVmYqiBKbhsjwD+MwVCjGqts8LQKADgodLzQJnl1avAa9X88ctknX1rjgw=
=BDf3
-----END PGP SIGNATURE-----


Z
Z
Zhu Zihao wrote on 9 Feb 2022 03:12
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53648@debbugs.gnu.org)
86wni4yeg9.fsf@163.com

-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYgMjVhUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/lGIgEAxBQmZKsXlv9MJhlznti4QQlRKYev
00po+FpGIODa+VgBAK0Ineh8yt8SDvQzRummjsNSo5Z4iW/ymk2mlpqcHwoE
=b2jI
-----END PGP SIGNATURE-----

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(-)

Toggle diff (52 lines)
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
#$ 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
M
M
Maxime Devos wrote on 9 Feb 2022 12:05
(name . Zhu Zihao)(address . all_but_last@163.com)(address . 53648@debbugs.gnu.org)
7352ac1f2762ffe4f24f22427a5ab1d56ba9237b.camel@telenet.be
Zhu Zihao schreef op wo 09-02-2022 om 10:12 [+0800]:
Toggle quote (2 lines)
> +            (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)
[...])
[...])

Toggle quote (2 lines)
> + (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.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgOf8BccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7h89AQCUPCbbQs5AYl5vdUOSjUWKPSRr
IxpJvGQ9YJLHdIRhUgEA2uqD8BoYd+QzPTqFiNs05s3vLR4oKlKtwrjowb3c0w0=
=u0dN
-----END PGP SIGNATURE-----


Z
Z
Zhu Zihao wrote on 9 Feb 2022 16:54
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53648@debbugs.gnu.org)
86k0e4827w.fsf@163.com
I've clean the code.
-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYgPjwxUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/mRCwD9H660ZfyR8PlqjfcuRRm4XUCBI9z1
OKmbsA+gYU02t1YBAM1Dziwe2yts2gZcJCXxeBWKvitaS2czLainbg1vIDkJ
=1gcM
-----END PGP SIGNATURE-----

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(-)

Toggle diff (52 lines)
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
--
Retrieve my PGP public key:

gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
M
M
Maxime Devos wrote on 9 Feb 2022 21:33
(name . Zhu Zihao)(address . all_but_last@163.com)(address . 53648@debbugs.gnu.org)
96291bfa6f21ac08474c400b8c42c30d5629840b.camel@telenet.be
users guix
usertags 53648 reviewed-looks-good
thanks

Zhu Zihao schreef op wo 09-02-2022 om 23:54 [+0800]:
Toggle quote (3 lines)
> +                  (("¥¥$¥¥{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.
-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYgQlLBccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7l0LAQDDfnW9kp7DLaSr4a1HDcu7Mjde
4/nGs8nIIeY0e+baGgD/ewdaHol7VasyjHwp2SU54IWhfOCoFKaCp1pqmrGrPgg=
=MWd6
-----END PGP SIGNATURE-----


Z
Z
Zhu Zihao wrote on 10 Feb 2022 00:23
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53648@debbugs.gnu.org)
86y22j7hew.fsf@163.com
Maxime Devos <maximedevos@telenet.be> writes:

Toggle quote (18 lines)
> [[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.)
-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYgRNFxUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/k7jQD/aywXVj6WX/n4pjyvvo00qqAUu2Mw
nESQ3MZGjIr16NoA/2HtEUDoVeoZtTwXMxQGWWp8bqwhNzwbxtW12ZgMHX8M
=pfJL
-----END PGP SIGNATURE-----

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(-)

Toggle diff (52 lines)
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
--
Retrieve my PGP public key:

gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
Z
Z
Zhu Zihao wrote on 11 Feb 2022 18:42
(name . Maxime Devos)(address . maximedevos@telenet.be)(address . 53648@debbugs.gnu.org)
865yplz3mx.fsf@163.com
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
-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYgaj1hUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/nyIQD+OVz10maDQDUSWxshWzAuGUC7E9cH
anexoFOHcKWrRm4A/0Img51EpSN0++cydFNNJqr21Qtbu2swK1ywI1B75qkP
=UZYz
-----END PGP SIGNATURE-----

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(-)

Toggle diff (52 lines)
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
--
Retrieve my PGP public key:

gpg --recv-keys D47A9C8B2AE3905B563D9135BE42B352A9F6821F

Zihao
L
L
Ludovic Courtès wrote on 14 Feb 2022 14:36
Re: bug#53648: [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
(name . Zhu Zihao)(address . all_but_last@163.com)
87a6ety3hr.fsf_-_@gnu.org
Hi,

Zhu Zihao <all_but_last@163.com> skribis:

Toggle quote (12 lines)
>>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'.

[...]

Toggle quote (18 lines)
>>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’.
L
L
Ludovic Courtès wrote on 14 Feb 2022 14:36
control message for bug #53648
(address . control@debbugs.gnu.org)
878rudy3hi.fsf@gnu.org
close 53648
quit
Z
Z
Zhu Zihao wrote on 16 Feb 2022 14:25
Re: bug#53648: [PATCH] gnu: fcitx5-gtk: Add GTK 4 support.
(name . Ludovic Courtès)(address . ludo@gnu.org)
868rub6ixi.fsf@163.com
Ludovic Courtès <ludo@gnu.org> writes:
Toggle quote (13 lines)
> 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
-----BEGIN PGP SIGNATURE-----

iIsEARYIADMWIQRefA5qkqvnKdl/GTlmOX+E92aT+QUCYgz7qRUcYWxsX2J1dF9s
YXN0QDE2My5jb20ACgkQZjl/hPdmk/lekQD/WFRs8e4/+eQxOuFES/Y2UszibOzo
4XQkqE95zUTBUm4BAPdqRHueH2TR3FaWU9fFZ+91uppJiFpgYmfsPgUfeLoN
=D+u7
-----END PGP SIGNATURE-----

?