Subject: Re: bug#61387: 30.0.50; Support webkit2gtk-4.1

From: Po Lu <[email-masked]>
Date: Fri, 10 Feb 2023 10:56:01 +0800

Ulrich Müller <[email-masked]> writes:

>>>>>> On Thu, 09 Feb 2023, Eli Zaretskii wrote:
>
>> But if Gentoo is transitioning to this new version of webkit, wouldn't
>> it make sense for Emacs 29 to support that, rather than require users
>> to have a version of webkit that is considered outdated by Gentoo?
>
> We would have backported the patch to the Gentoo package for Emacs 29.
> Including it upstream is of course preferable.
>
>>> Should I update the patch to allow 3 values "4.0", "4.1", and "auto",
>>> with "auto" being the default?
>
>> Yes, please.
>
>>> And in the default case, should it check for 4.0 or 4.1 first?
>
>> I think 4.1 first, don't you agree?
>
> Yes. Please find the updated patch below. It applies cleanly to both
> master and emacs-29.
>
>
>>>From 9ac6e3711426eddacd095380b8e7f64a405706b2 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <[email-masked]>
> Date: Thu, 9 Feb 2023 10:58:48 +0100
> Subject: [PATCH] Support webkit2gtk version 4.1
>
> * configure.ac: Add --with-webkit2gtk=VALUE configuration option,
> where VALUE can be 4.0, 4.1, or auto (default).
> ---
>  configure.ac | 26 ++++++++++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/configure.ac b/configure.ac
> index fc17dbd8318..d951fa84701 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -521,6 +521,19 @@ otherwise for the first of 'inotify', 'kqueue' or 'gfile' that is usable.])
>  OPTION_DEFAULT_OFF([xwidgets],
>    [enable use of xwidgets in Emacs buffers (requires gtk3 or macOS Cocoa)])
>  
> +AC_ARG_WITH([webkit2gtk],[AS_HELP_STRING([--with-webkit2gtk=VALUE],
> +  [version of webkit2gtk API to use (VALUE one of: 4.0, 4.1, auto;
> +default auto)])],
> +  [ case "${withval}" in
> +      4.0|4.1|auto) val=$withval ;;
> +      *) AC_MSG_ERROR(['--with-webkit2gtk=$withval' is invalid;
> +this option's value should be '4.0', '4.1', or 'auto'.])
> +      ;;
> +    esac
> +    with_webkit2gtk=$val
> +  ],
> +  [with_webkit2gtk=auto])
> +
>  OPTION_DEFAULT_OFF([be-app],
>    [enable use of Haiku's Application Kit as a window system])
>  
> @@ -3583,8 +3596,17 @@ XWIDGETS_OBJ=
>  if test "$with_xwidgets" != "no"; then
>    if test "$USE_GTK_TOOLKIT" = "GTK3" && test "$window_system" != "none"; then
>      WEBKIT_REQUIRED=2.12
> -    WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED"
> -    EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
> +    if test "$with_webkit2gtk" = "auto"; then
> +      WEBKIT_MODULES="webkit2gtk-4.1 >= $WEBKIT_REQUIRED"
> +      EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
> +      if test "$HAVE_WEBKIT" = "no"; then
> +        WEBKIT_MODULES="webkit2gtk-4.0 >= $WEBKIT_REQUIRED"
> +        EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
> +      fi
> +    else
> +      WEBKIT_MODULES="webkit2gtk-$with_webkit2gtk >= $WEBKIT_REQUIRED"
> +      EMACS_CHECK_MODULES([WEBKIT], [$WEBKIT_MODULES])
> +    fi
>      HAVE_XWIDGETS=$HAVE_WEBKIT
>      XWIDGETS_OBJ="xwidget.o"
>      if test "$HAVE_X_WINDOWS" = "yes" && test "${with_cairo}" = "no"; then

Please make the configure script detect WebKitGTK 4.1 by default, and
fall back to 4.0.

Not many systems will have both installed at the same time, and it is
best for Emacs to use the newer version.

People who want to use the older version can specify the cflags on the
command line to configure.  There is no need for a ``--with-webkit2gtk''
option, which is not very consistent with every other library we support.