Add support for building WebView with libwebkit2gtk-4.1
libwebkit2gtk-4.1 has the same API as libwebkit2gtk-4.0, except that the former links with libsoup-3.0 and the latter links with libsoup-2.4. Fixes #23630. (cherry picked from commit 1b8664426603376b68f8ca3c54de97ec630e5940)
This commit is contained in:
parent
be772c284f
commit
df46add116
@ -453,15 +453,21 @@ if(wxUSE_GUI)
|
||||
if(wxUSE_WEBVIEW)
|
||||
if(WXGTK)
|
||||
if(wxUSE_WEBVIEW_WEBKIT)
|
||||
find_package(LIBSOUP)
|
||||
set(WEBKIT_LIBSOUP_VERSION 2.4)
|
||||
if(WXGTK2)
|
||||
find_package(WEBKIT 1.0)
|
||||
elseif(WXGTK3)
|
||||
find_package(WEBKIT2)
|
||||
find_package(WEBKIT2 4.1 QUIET)
|
||||
if(WEBKIT2_FOUND)
|
||||
set(WEBKIT_LIBSOUP_VERSION 3.0)
|
||||
else()
|
||||
find_package(WEBKIT2 4.0)
|
||||
endif()
|
||||
if(NOT WEBKIT2_FOUND)
|
||||
find_package(WEBKIT 3.0)
|
||||
endif()
|
||||
endif()
|
||||
find_package(LIBSOUP ${WEBKIT_LIBSOUP_VERSION})
|
||||
endif()
|
||||
set(wxUSE_WEBVIEW_WEBKIT OFF)
|
||||
set(wxUSE_WEBVIEW_WEBKIT2 OFF)
|
||||
|
@ -31,19 +31,27 @@
|
||||
# LibSoup does not provide an easy way to retrieve its version other than its
|
||||
# .pc file, so we need to rely on PC_LIBSOUP_VERSION and REQUIRE the .pc file
|
||||
# to be found.
|
||||
SET(LIBSOUP_VERSION 2.4)
|
||||
if(DEFINED LIBSOUP_FIND_VERSION)
|
||||
SET(LIBSOUP_VERSION ${LIBSOUP_FIND_VERSION})
|
||||
endif()
|
||||
|
||||
set(LIBSOUP_INCLUDE_DIRS LIBSOUP_INCLUDE_DIRS-NOTFOUND)
|
||||
set(LIBSOUP_LIBRARIES LIBSOUP_LIBRARIES-NOTFOUND)
|
||||
|
||||
FIND_PACKAGE(PkgConfig)
|
||||
PKG_CHECK_MODULES(PC_LIBSOUP QUIET libsoup-2.4)
|
||||
PKG_CHECK_MODULES(PC_LIBSOUP QUIET libsoup-${LIBSOUP_VERSION})
|
||||
|
||||
if(PC_LIBSOUP_FOUND)
|
||||
FIND_PATH(LIBSOUP_INCLUDE_DIRS
|
||||
NAMES libsoup/soup.h
|
||||
HINTS ${PC_LIBSOUP_INCLUDEDIR}
|
||||
${PC_LIBSOUP_INCLUDE_DIRS}
|
||||
PATH_SUFFIXES libsoup-2.4
|
||||
PATH_SUFFIXES libsoup-${LIBSOUP_VERSION}
|
||||
)
|
||||
|
||||
FIND_LIBRARY(LIBSOUP_LIBRARIES
|
||||
NAMES soup-2.4
|
||||
NAMES soup-${LIBSOUP_VERSION}
|
||||
HINTS ${PC_LIBSOUP_LIBDIR}
|
||||
${PC_LIBSOUP_LIBRARY_DIRS}
|
||||
)
|
||||
|
@ -5,7 +5,10 @@
|
||||
# WEBKIT2_LIBRARIES - List of libraries when using Webkit2.
|
||||
# WEBKIT2_FOUND - True if Webkit2 found.
|
||||
|
||||
SET( WEBKIT2_VERSION 4.0)
|
||||
SET(WEBKIT2_VERSION 4.0)
|
||||
if(DEFINED WEBKIT2_FIND_VERSION)
|
||||
SET(WEBKIT2_VERSION ${WEBKIT2_FIND_VERSION})
|
||||
endif()
|
||||
|
||||
set(WEBKIT2_INCLUDE_DIR WEBKIT2_INCLUDE_DIR-NOTFOUND)
|
||||
set(WEBKIT2_LIBRARY WEBKIT2_LIBRARY-NOTFOUND)
|
||||
|
95
configure
vendored
95
configure
vendored
@ -41832,6 +41832,86 @@ pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WEBKIT" >&5
|
||||
$as_echo_n "checking for WEBKIT... " >&6; }
|
||||
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$WEBKIT_CFLAGS"; then
|
||||
pkg_cv_WEBKIT_CFLAGS="$WEBKIT_CFLAGS"
|
||||
else
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"webkit2gtk-4.1\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "webkit2gtk-4.1") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_WEBKIT_CFLAGS=`$PKG_CONFIG --cflags "webkit2gtk-4.1" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$WEBKIT_LIBS"; then
|
||||
pkg_cv_WEBKIT_LIBS="$WEBKIT_LIBS"
|
||||
else
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"webkit2gtk-4.1\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "webkit2gtk-4.1") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_WEBKIT_LIBS=`$PKG_CONFIG --libs "webkit2gtk-4.1" 2>/dev/null`
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test $pkg_failed = yes; then
|
||||
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||||
_pkg_short_errors_supported=yes
|
||||
else
|
||||
_pkg_short_errors_supported=no
|
||||
fi
|
||||
if test $_pkg_short_errors_supported = yes; then
|
||||
WEBKIT_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "webkit2gtk-4.1"`
|
||||
else
|
||||
WEBKIT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "webkit2gtk-4.1"`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$WEBKIT_PKG_ERRORS" >&5
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk-4.1 not found, falling back to webkit2gtk-4.0" >&5
|
||||
$as_echo "$as_me: WARNING: webkit2gtk-4.1 not found, falling back to webkit2gtk-4.0" >&2;}
|
||||
|
||||
elif test $pkg_failed = untried; then
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk-4.1 not found, falling back to webkit2gtk-4.0" >&5
|
||||
$as_echo "$as_me: WARNING: webkit2gtk-4.1 not found, falling back to webkit2gtk-4.0" >&2;}
|
||||
|
||||
else
|
||||
WEBKIT_CFLAGS=$pkg_cv_WEBKIT_CFLAGS
|
||||
WEBKIT_LIBS=$pkg_cv_WEBKIT_LIBS
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
USE_WEBVIEW_WEBKIT2=1
|
||||
CXXFLAGS="$CXXFLAGS $WEBKIT_CFLAGS"
|
||||
EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
|
||||
|
||||
fi
|
||||
if test "$USE_WEBVIEW_WEBKIT2" = 0; then
|
||||
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for WEBKIT" >&5
|
||||
$as_echo_n "checking for WEBKIT... " >&6; }
|
||||
|
||||
if test -n "$PKG_CONFIG"; then
|
||||
if test -n "$WEBKIT_CFLAGS"; then
|
||||
pkg_cv_WEBKIT_CFLAGS="$WEBKIT_CFLAGS"
|
||||
@ -41887,13 +41967,13 @@ fi
|
||||
echo "$WEBKIT_PKG_ERRORS" >&5
|
||||
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk not found, falling back to webkitgtk" >&5
|
||||
$as_echo "$as_me: WARNING: webkit2gtk not found, falling back to webkitgtk" >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk-4.0 not found, falling back to webkitgtk" >&5
|
||||
$as_echo "$as_me: WARNING: webkit2gtk-4.0 not found, falling back to webkitgtk" >&2;}
|
||||
|
||||
elif test $pkg_failed = untried; then
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk not found, falling back to webkitgtk" >&5
|
||||
$as_echo "$as_me: WARNING: webkit2gtk not found, falling back to webkitgtk" >&2;}
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: webkit2gtk-4.0 not found, falling back to webkitgtk" >&5
|
||||
$as_echo "$as_me: WARNING: webkit2gtk-4.0 not found, falling back to webkitgtk" >&2;}
|
||||
|
||||
else
|
||||
WEBKIT_CFLAGS=$pkg_cv_WEBKIT_CFLAGS
|
||||
@ -41901,11 +41981,12 @@ else
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
|
||||
USE_WEBVIEW_WEBKIT2=1
|
||||
CXXFLAGS="$CXXFLAGS $WEBKIT_CFLAGS"
|
||||
EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
|
||||
USE_WEBVIEW_WEBKIT2=1
|
||||
CXXFLAGS="$CXXFLAGS $WEBKIT_CFLAGS"
|
||||
EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
|
||||
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
if test "$USE_WEBVIEW_WEBKIT2" = 0; then
|
||||
webkitgtk=webkit-1.0
|
||||
|
16
configure.in
16
configure.in
@ -7529,15 +7529,27 @@ if test "$wxUSE_WEBVIEW" = "yes"; then
|
||||
if test "$wxUSE_GTK" = 1; then
|
||||
if test "$WXGTK3" = 1; then
|
||||
PKG_CHECK_MODULES([WEBKIT],
|
||||
[webkit2gtk-4.0],
|
||||
[webkit2gtk-4.1],
|
||||
[
|
||||
USE_WEBVIEW_WEBKIT2=1
|
||||
CXXFLAGS="$CXXFLAGS $WEBKIT_CFLAGS"
|
||||
EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
|
||||
],
|
||||
[
|
||||
AC_MSG_WARN([webkit2gtk not found, falling back to webkitgtk])
|
||||
AC_MSG_WARN([webkit2gtk-4.1 not found, falling back to webkit2gtk-4.0])
|
||||
])
|
||||
if test "$USE_WEBVIEW_WEBKIT2" = 0; then
|
||||
PKG_CHECK_MODULES([WEBKIT],
|
||||
[webkit2gtk-4.0],
|
||||
[
|
||||
USE_WEBVIEW_WEBKIT2=1
|
||||
CXXFLAGS="$CXXFLAGS $WEBKIT_CFLAGS"
|
||||
EXTRALIBS_WEBVIEW="$WEBKIT_LIBS"
|
||||
],
|
||||
[
|
||||
AC_MSG_WARN([webkit2gtk-4.0 not found, falling back to webkitgtk])
|
||||
])
|
||||
fi
|
||||
fi
|
||||
if test "$USE_WEBVIEW_WEBKIT2" = 0; then
|
||||
webkitgtk=webkit-1.0
|
||||
|
@ -173,15 +173,18 @@ wxgtk_webview_webkit_load_failed(WebKitWebView *,
|
||||
{
|
||||
switch (error->code)
|
||||
{
|
||||
#if SOUP_MAJOR_VERSION < 3
|
||||
case SOUP_STATUS_CANCELLED:
|
||||
type = wxWEBVIEW_NAV_ERR_USER_CANCELLED;
|
||||
break;
|
||||
|
||||
case SOUP_STATUS_CANT_RESOLVE:
|
||||
#endif
|
||||
case SOUP_STATUS_NOT_FOUND:
|
||||
type = wxWEBVIEW_NAV_ERR_NOT_FOUND;
|
||||
break;
|
||||
|
||||
#if SOUP_MAJOR_VERSION < 3
|
||||
case SOUP_STATUS_CANT_RESOLVE_PROXY:
|
||||
case SOUP_STATUS_CANT_CONNECT:
|
||||
case SOUP_STATUS_CANT_CONNECT_PROXY:
|
||||
@ -193,6 +196,7 @@ wxgtk_webview_webkit_load_failed(WebKitWebView *,
|
||||
case SOUP_STATUS_MALFORMED:
|
||||
type = wxWEBVIEW_NAV_ERR_REQUEST;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case SOUP_STATUS_BAD_REQUEST:
|
||||
type = wxWEBVIEW_NAV_ERR_REQUEST;
|
||||
|
Loading…
Reference in New Issue
Block a user