Subject: [bug#54261] [PATCH]: Update GTK to 4.6.1.

From: Ludovic Courtès <[email-masked]>
Date: Fri, 01 Apr 2022 17:54:46 +0200

Hi,

Zhu Zihao <[email-masked]> skribis:

> From 62a640576ae1de9523fba593219fb50ac97b44c6 Mon Sep 17 00:00:00 2001
> From: Zhu Zihao <[email-masked]>
> Date: Mon, 21 Mar 2022 09:16:38 +0800
> Subject: [PATCH 3/4] gnu: Add fcitx5-gtk4.
>
> * gnu/packages/fcitx5.scm (fcitx5-gtk4): New variable.
> ---
>  gnu/packages/fcitx5.scm | 42 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 42 insertions(+)
>
> diff --git a/gnu/packages/fcitx5.scm b/gnu/packages/fcitx5.scm
> index 2d5917f3c0..be46a5036c 100644
> --- a/gnu/packages/fcitx5.scm
> +++ b/gnu/packages/fcitx5.scm
> @@ -250,6 +250,48 @@ (define (split-immodule gtk-version output)
>  @end table")
>      (license license:lgpl2.1+)))
>  
> +;; XXX: This package is separated from fcitx5-gtk for following reasons.
> +;; 1. GTK4 has a lot more dependencies, some of which maybe unavailable on
> +;;    platforms other than x86_64. See <https://issues.guix.gnu.org/53648>.
> +;; 2. GTK4 now propagates [email-masked], it will conflict with GTK3 and GTK2
> +;;    (propagates [email-masked]) if they're all in the inputs of same package.
> +;;    See <https://issues.guix.gnu.org/54261>.
> +(define-public fcitx5-gtk4
> +  (package
> +    (inherit fcitx5-gtk)
> +    (name "fcitx5-gtk4")
> +    (arguments
> +     (list
> +      #:tests? #f                       ;No test
> +      #:configure-flags
> +      #~(list (string-append "-DCMAKE_CXX_FLAGS=-I"
> +                             #$(this-package-input "fcitx5-gtk")
> +                             "/include/Fcitx5/GClient"))

This one fails to build for me:

--8<---------------cut here---------------start------------->8---
-- Looking for shmat - found
-- Checking for module 'gtk+-2.0'
--   No package 'gtk+-2.0' found
CMake Error at /gnu/store/zga679c4nldah9l8dhd5a4hdy820hcyf-cmake-minimal-3.21.4/share/cmake-3.21/Modules/FindPkgConfig.cmake:562 (message):
  A required package was not found
Call Stack (most recent call first):
  /gnu/store/zga679c4nldah9l8dhd5a4hdy820hcyf-cmake-minimal-3.21.4/share/cmake-3.21/Modules/FindPkgConfig.cmake:784 (_pkg_check_modules_internal)
  gtk2/CMakeLists.txt:6 (pkg_check_modules)

-- Configuring incomplete, errors occurred!
See also "/tmp/guix-build-fcitx5-gtk4-5.0.9.drv-0/build/CMakeFiles/CMakeOutput.log".
error: in phase 'configure': uncaught exception:
%exception #<&invoke-error program: "cmake" arguments: ("../fcitx5-gtk-5.0.9" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DCMAKE_INSTALL_PREFIX=/gnu/store/5z0a2zrr19pmg4swzsb0jm5fwqh03x0y-fcitx5-gtk4-5.0.9" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE" "-DCMAKE_INSTALL_RPATH=/gnu/store/5z0a2zrr19pmg4swzsb0jm5fwqh03x0y-fcitx5-gtk4-5.0.9/lib" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DCMAKE_CXX_FLAGS=-I/gnu/store/fkq1pgfp1r43f2131f8yvx543n7gb7ww-fcitx5-gtk-5.0.9/include/Fcitx5/GClient") exit-status: 1 term-signal: #f stop-signal: #f> 
phase `configure' failed after 2.9 seconds
command "cmake" "../fcitx5-gtk-5.0.9" "-DCMAKE_BUILD_TYPE=RelWithDebInfo" "-DCMAKE_INSTALL_PREFIX=/gnu/store/5z0a2zrr19pmg4swzsb0jm5fwqh03x0y-fcitx5-gtk4-5.0.9" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE" "-DCMAKE_INSTALL_RPATH=/gnu/store/5z0a2zrr19pmg4swzsb0jm5fwqh03x0y-fcitx5-gtk4-5.0.9/lib" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DCMAKE_CXX_FLAGS=-I/gnu/store/fkq1pgfp1r43f2131f8yvx543n7gb7ww-fcitx5-gtk-5.0.9/include/Fcitx5/GClient" failed with status 1
builder for `/gnu/store/p9611ymj4mav45wi92fdyslb2p7854hl-fcitx5-gtk4-5.0.9.drv' failed with exit code 1
@ build-failed /gnu/store/p9611ymj4mav45wi92fdyslb2p7854hl-fcitx5-gtk4-5.0.9.drv - 1 builder for `/gnu/store/p9611ymj4mav45wi92fdyslb2p7854hl-fcitx5-gtk4-5.0.9.drv' failed with exit code 1
derivation '/gnu/store/p9611ymj4mav45wi92fdyslb2p7854hl-fcitx5-gtk4-5.0.9.drv' offloaded to 'localhost' failed: build of `/gnu/store/p9611ymj4mav45wi92fdyslb2p7854hl-fcitx5-gtk4-5.0.9.drv' failed
build of /gnu/store/p9611ymj4mav45wi92fdyslb2p7854hl-fcitx5-gtk4-5.0.9.drv failed
--8<---------------cut here---------------end--------------->8---

Could you take a look and send an updated patch?

Also, I find it surprising that ‘fcitx5-gtk4’ depends on ‘fcitx5-gtk’;
is it avoidable?

The rest LGTM, thanks!

Ludo’.