diff mbox series

[bug#53648] gnu: fcitx5-gtk: Add GTK 4 support.

Message ID 86pmnyyooc.fsf@163.com
State Accepted
Headers show
Series [bug#53648] gnu: fcitx5-gtk: Add GTK 4 support. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Zhu Zihao Feb. 8, 2022, 4:19 a.m. UTC
I use @table texinfo command to make the use of different output clear
:)

Comments

M Feb. 8, 2022, 10:02 a.m. UTC | #1
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.
diff mbox series

Patch

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